mpd_client 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -112,6 +112,6 @@ For more information about logging configuration, see http://www.ruby-doc.org/st
112
112
 
113
113
  ## License and Author
114
114
 
115
- Copyright (c) 2013 by Anton Maminov
115
+ Copyright (c) 2013-2015 by Anton Maminov
116
116
 
117
117
  This library is distributed under the MIT license. Please see the LICENSE file.
@@ -1,3 +1,3 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'mpd_client', :path => '../'
@@ -14,6 +14,7 @@ client.connect('localhost', 6600)
14
14
  client.delete([10,])
15
15
 
16
16
  # move the first three songs after the fifth number in the playlist
17
- client.move([0, 3], 69)
17
+ client.move([0, 3], 5)
18
18
 
19
- pp client.playlistinfo([69, 71])
19
+ # print songs form 5 to 10
20
+ client.playlistinfo([5, 10]).each{ |s| puts "#{s['artist']} - #{s['title']}"}
@@ -0,0 +1,24 @@
1
+ require 'bundler'
2
+ Bundler.setup :default
3
+
4
+ require 'pp'
5
+ require 'logger'
6
+ require 'mpd_client'
7
+
8
+ MPDClient.log = Logger.new($stderr)
9
+
10
+ client = MPDClient.new
11
+ client.connect('localhost', 6600)
12
+
13
+ # Get id of the first song in the playllist
14
+ song = client.playlistinfo(1).first
15
+ pp "#{song['artist']} - #{song['title']}"
16
+ song_id = song['id']
17
+
18
+ # Specifies the portion of the song that shall be played
19
+ client.rangeid(song_id, [60,70])
20
+
21
+ # Play the playlist at song 1
22
+ client.play(1)
23
+
24
+ pp client.status
@@ -14,7 +14,7 @@ MPDClient.log = Logger.new($stderr)
14
14
  client = MPDClient.new
15
15
 
16
16
  # Connecting to the server
17
- client.connect('/var/run/mpd/socket')
17
+ client.connect('/run/mpd/socket')
18
18
 
19
19
  puts "MPD version: #{client.mpd_version}"
20
20
  puts "mpd_client version: #{MPDClient::VERSION}"
@@ -9,7 +9,7 @@ SUCCESS = "OK"
9
9
  NEXT = "list_OK"
10
10
 
11
11
  # MPD changelog: http://git.musicpd.org/cgit/master/mpd.git/plain/NEWS
12
- # http://mpd.wikia.com/wiki/MusicPlayerDaemonCommands
12
+ # http://www.musicpd.org/doc/protocol/command_reference.html
13
13
  # http://git.musicpd.org/cgit/cirrus/mpd.git/plain/doc/protocol.xml
14
14
  #
15
15
  COMMANDS = {
@@ -45,6 +45,8 @@ COMMANDS = {
45
45
  # Playlist Commands
46
46
  "add" => "fetch_nothing",
47
47
  "addid" => "fetch_item",
48
+ "addtagid" => "fetch_nothing",
49
+ "cleartagid" => "fetch_nothing",
48
50
  "clear" => "fetch_nothing",
49
51
  "delete" => "fetch_nothing",
50
52
  "deleteid" => "fetch_nothing",
@@ -59,6 +61,7 @@ COMMANDS = {
59
61
  "plchangesposid" => "fetch_changes",
60
62
  "prio" => "fetch_nothing",
61
63
  "prioid" => "fetch_nothing",
64
+ "rangeid" => "fetch_nothing",
62
65
  "shuffle" => "fetch_nothing",
63
66
  "swap" => "fetch_nothing",
64
67
  "swapid" => "fetch_nothing",
@@ -81,6 +84,7 @@ COMMANDS = {
81
84
  "list" => "fetch_list",
82
85
  "listall" => "fetch_database",
83
86
  "listallinfo" => "fetch_database",
87
+ "listfiles" => "fetch_database",
84
88
  "lsinfo" => "fetch_database",
85
89
  "search" => "fetch_songs",
86
90
  "searchadd" => "fetch_nothing",
@@ -88,6 +92,11 @@ COMMANDS = {
88
92
  "update" => "fetch_item",
89
93
  "rescan" => "fetch_item",
90
94
  "readcomments" => "fetch_item",
95
+ # Mounts and neighbors
96
+ "mount" => "fetch_nothing",
97
+ "unmount" => "fetch_nothing",
98
+ "listmounts" => "fetch_mounts",
99
+ "listneighbors" => "fetch_neighbors",
91
100
  # Sticker Commands
92
101
  "sticker get" => "fetch_sticker",
93
102
  "sticker set" => "fetch_nothing",
@@ -165,7 +174,7 @@ class MPDClient
165
174
  end
166
175
 
167
176
  def reconnect
168
- log.info("MPD (re)connect #{host}, #{port}") if log
177
+ log.info("MPD (re)connect #{@host}, #{@port}") if log
169
178
  if @host.start_with?('/')
170
179
  @socket = UNIXSocket.new(@host)
171
180
  hello
@@ -339,6 +348,10 @@ class MPDClient
339
348
 
340
349
  def fetch_songs; fetch_objects(['file']); end
341
350
 
351
+ def fetch_mounts; fetch_objects(['mount']); end
352
+
353
+ def fetch_neighbors; fetch_objects(['neighbor']); end
354
+
342
355
  def fetch_messages; fetch_objects('channel'); end
343
356
 
344
357
  def fetch_outputs; fetch_objects(['outputid']); end
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class MPDClient
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpd_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Maminov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-06 00:00:00.000000000 Z
11
+ date: 2015-03-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Yet another Ruby MPD client library
14
14
  email:
@@ -26,6 +26,7 @@ files:
26
26
  - Rakefile
27
27
  - examples/Gemfile
28
28
  - examples/range.rb
29
+ - examples/rangeid.rb
29
30
  - examples/search_and_replace_playlist.rb
30
31
  - examples/stickers.rb
31
32
  - lib/mpd_client.rb
@@ -50,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
50
51
  version: '0'
51
52
  requirements: []
52
53
  rubyforge_project:
53
- rubygems_version: 2.4.2
54
+ rubygems_version: 2.4.5
54
55
  signing_key:
55
56
  specification_version: 4
56
57
  summary: Simple Music Player Daemon library written entirely in Ruby