mpd_client 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 27d31ef1a606cc442142258bf1bb55cdfd7065c1
4
- data.tar.gz: 8c255ecc5611f9afb18b19e6c1639bd5881ddbc4
2
+ SHA256:
3
+ metadata.gz: 6bbeae5055e98a65a3f47b86aaf40d85dbe4d1447dbabe1efffa70c801efb6b9
4
+ data.tar.gz: ba2f70d5db12c266c6bf70d714867dcdbd51a2845b4906f79689e6d724fc1dee
5
5
  SHA512:
6
- metadata.gz: 8ab1676dbed14eaf56a1f95f693edc3c42951524e67a782ac984760ce991fbc3c4825639564c867df4ac38892161bc62e1f1381f1310e676f66531286f075702
7
- data.tar.gz: a0a33c25af7499037d93f344ece03eafd8cd2515507072b8eae470633c181057822904418925162e8eab65f9bdd7e7908bec082d4b4981ee7045458e33e21ed0
6
+ metadata.gz: d4d105484473b078f546e9d961289552f09336e491fed04aa8213271127fcc6f725d2973746a77731fa0f505d9bf3656338b8ca40b5f908963c7dafa2daf66c4
7
+ data.tar.gz: 3d9829735ff01c8b5fc27d9c3e9d9dce06dad9504a80423bb6b938a849797ecd9443a842d0fecd37a7355d1062231df74238f7c30ee49d1fbfdc99e1d6a704df
@@ -0,0 +1,2 @@
1
+ rubocop:
2
+ config_file: .rubocop.yml
@@ -0,0 +1,27 @@
1
+ Metrics/LineLength:
2
+ Max: 120
3
+
4
+ Metrics/AbcSize:
5
+ Enabled: false
6
+
7
+ Metrics/ClassLength:
8
+ Enabled: false
9
+
10
+ Metrics/MethodLength:
11
+ Enabled: false
12
+
13
+ Metrics/ModuleLength:
14
+ Enabled: false
15
+
16
+ # TODO FIXME
17
+ Metrics/CyclomaticComplexity:
18
+ Max: 7
19
+
20
+ Metrics/PerceivedComplexity:
21
+ Max: 8
22
+
23
+ Security/Eval:
24
+ Exclude:
25
+ - 'lib/mpd_client.rb'
26
+
27
+
@@ -0,0 +1 @@
1
+ 2.5.1
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ script:
3
+ - rspec
4
+ - rubocop
@@ -1,33 +1,37 @@
1
- # MPDClient CHANGELOG
1
+ # MPD::Client CHANGELOG
2
2
 
3
- ### 0.0.6
3
+ ## 0.1.0
4
+
5
+ * Rename `MPDClient` to `MPD::Client`
6
+
7
+ ## 0.0.6
4
8
 
5
9
  * Fixed readcomments command
6
10
 
7
- ### 0.0.5
11
+ ## 0.0.5
8
12
 
9
13
  * Support for mount, umount, listmounts, listneighbors
10
14
  * Support for listfiles
11
15
  * Support for rangeid, addtagid, cleartagid
12
16
 
13
- ### 0.0.4
17
+ ## 0.0.4
14
18
 
15
19
  * Added support for readcomments, toggleoutput, volume
16
20
  * Added a mutex protecting execution of MPD commands
17
21
  * Automatic reconnect after the server dropped the connection
18
22
 
19
- ### 0.0.3
23
+ ## 0.0.3
20
24
 
21
25
  * Support for logging
22
26
  * Better support for fetching stickers from MPD
23
27
  * Fixed sticker commands
24
28
  * Add support for ranges
25
29
 
26
- ### 0.0.2
30
+ ## 0.0.2
27
31
 
28
32
  * Support for connecting to unix domain sockets
29
33
  * Fixed some bugs
30
34
 
31
- ### 0.0.1
35
+ ## 0.0.1
32
36
 
33
37
  * Porting code from mpd-python2
data/Gemfile CHANGED
@@ -1,8 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in mpd_client.gemspec
4
6
  gemspec
5
7
 
6
- group :development do
8
+ group :development, :test do
7
9
  gem 'pry'
10
+ gem 'rubocop'
11
+ end
12
+
13
+ group :test do
14
+ gem 'rspec'
8
15
  end
@@ -1,3 +1,5 @@
1
+ # MPD Commands
2
+
1
3
  * [Status Commands](#status-commands)
2
4
  * [Playback Option Commands](#playback-option-commands)
3
5
  * [Playback Control Commands](#playback-control-commands)
@@ -10,7 +12,7 @@
10
12
  * [Reflection Commands](#reflection-commands)
11
13
  * [Client to client](#client-to-client)
12
14
 
13
- ### Status Commands ###
15
+ ## Status Commands
14
16
 
15
17
  ---
16
18
  `clearerror => fetch_nothing`
@@ -27,7 +29,7 @@
27
29
 
28
30
  > Waits until there is a noteworthy change in one or more of MPD's subsystems. As soon as there is one, it lists all changed systems in a line in the format changed: `SUBSYSTEM`, where `SUBSYSTEM` is one of the following:
29
31
 
30
- > * `database`: the song database has been modified after update.
32
+ * `database`: the song database has been modified after update.
31
33
  * `update`: a database update has started or finished. If the database was modified during the update, the database event is also emitted.
32
34
  * `stored_playlist`: a stored playlist has been modified, renamed, created or deleted
33
35
  * `playlist`: the current playlist has been modified
@@ -39,21 +41,19 @@
39
41
  * `subscription`: a client has subscribed or unsubscribed to a channel
40
42
  * `message`: a message was received on a channel this client is subscribed to; this event is only emitted when the queue is empty
41
43
 
42
- > While a client is waiting for `idle` results, the server disables timeouts, allowing a client to wait for events as long as mpd runs. The `idle` command can be canceled by sending the command `noidle` (no other commands are allowed). MPD will then leave `idle` mode and print results immediately; might be empty at this time.
44
+ While a client is waiting for `idle` results, the server disables timeouts, allowing a client to wait for events as long as mpd runs. The `idle` command can be canceled by sending the command `noidle` (no other commands are allowed). MPD will then leave `idle` mode and print results immediately; might be empty at this time.
43
45
 
44
- > If the optional `SUBSYSTEMS` argument is used, MPD will only send notifications when something changed in one of the specified subsytems.
46
+ If the optional `SUBSYSTEMS` argument is used, MPD will only send notifications when something changed in one of the specified subsytems.
45
47
 
46
48
  ---
47
49
  `noidle`
48
50
 
49
- >
50
-
51
51
  ---
52
52
  `status => "fetch_object`
53
53
 
54
54
  > Reports the current status of the player and the volume level.
55
55
 
56
- > * `volume`: 0-100
56
+ * `volume`: 0-100
57
57
  * `repeat`: 0 or 1
58
58
  * `random`: 0 or 1
59
59
  * `single`: 0 or 1
@@ -80,14 +80,14 @@
80
80
 
81
81
  > Displays statistics.
82
82
 
83
- > * `artists`: number of artists
83
+ * `artists`: number of artists
84
84
  * `songs`: number of albums
85
85
  * `uptime`: daemon uptime in seconds
86
86
  * `db_playtime`: sum of all song times in the db
87
87
  * `db_update`: last db update in UNIX time
88
88
  * `playtime`: time length of music played
89
89
 
90
- ### Playback Option Commands ###
90
+ ## Playback Option Commands
91
91
 
92
92
  ---
93
93
  `consume {STATE} => fetch_nothing`
@@ -102,7 +102,7 @@
102
102
  ---
103
103
  `mixrampdb {deciBels} => fetch_nothing`
104
104
 
105
- > Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See http://sourceforge.net/projects/mixramp
105
+ > Sets the threshold at which songs will be overlapped. Like crossfading but doesn't fade the track volume, just overlaps. The songs need to have MixRamp tags added by an external tool. 0dB is the normalized maximum volume so use negative values, I prefer -17dB. In the absence of mixramp tags crossfading will be used. See [mixramp](https://sourceforge.net/projects/mixramp/)
106
106
 
107
107
  ---
108
108
  `mixrampdelay {SECONDS} => fetch_nothing`
@@ -134,9 +134,9 @@
134
134
 
135
135
  > Sets the replay gain mode. One of `off`, `track`, `album`, `auto`.
136
136
 
137
- > Changing the mode during playback may take several seconds, because the new settings does not affect the buffered data.
137
+ Changing the mode during playback may take several seconds, because the new settings does not affect the buffered data.
138
138
 
139
- > This command triggers the options idle event.
139
+ This command triggers the options idle event.
140
140
 
141
141
  ---
142
142
  `replay_gain_status => fetch_item`
@@ -148,7 +148,7 @@
148
148
 
149
149
  > Changes volume by amount `CHANGE`.
150
150
 
151
- ### Playback Control Commands ###
151
+ ## Playback Control Commands
152
152
 
153
153
  ---
154
154
  `next => fetch_nothing`
@@ -196,8 +196,7 @@
196
196
 
197
197
  > Stops playing.
198
198
 
199
-
200
- ### Playlist Commands ###
199
+ ## Playlist Commands
201
200
 
202
201
  ---
203
202
  `add {URI} => fetch_nothing`
@@ -209,7 +208,7 @@
209
208
 
210
209
  > Adds a song to the playlist (non-recursive) and returns the song id.
211
210
 
212
- > `URI` is always a single file or URL.
211
+ `URI` is always a single file or URL.
213
212
 
214
213
  ---
215
214
  `clear => fetch_nothing`
@@ -240,7 +239,6 @@
240
239
  `playlist => fetch_playlist`
241
240
 
242
241
  > Displays the current playlist.
243
-
244
242
  > > **Note**: Do not use this, instead use `playlistinfo`.
245
243
 
246
244
  ---
@@ -268,21 +266,21 @@
268
266
 
269
267
  > Displays changed songs currently in the playlist since `VERSION`.
270
268
 
271
- > To detect songs that were deleted at the end of the playlist, use `playlistlength` returned by status command.
269
+ To detect songs that were deleted at the end of the playlist, use `playlistlength` returned by status command.
272
270
 
273
271
  ---
274
272
  `plchangesposid {VERSION} => fetch_changes`
275
273
 
276
274
  > Displays changed songs currently in the playlist since `VERSION`. This function only returns the position and the id of the changed song, not the complete metadata. This is more bandwidth efficient.
277
275
 
278
- > To detect songs that were deleted at the end of the playlist, use `playlistlength` returned by status command.
276
+ To detect songs that were deleted at the end of the playlist, use `playlistlength` returned by status command.
279
277
 
280
278
  ---
281
279
  `prio {PRIORITY} {START:END...} => fetch_nothing`
282
280
 
283
281
  > Set the priority of the specified songs. A higher priority means that it will be played first when "random" mode is enabled.
284
282
 
285
- > A priority is an integer between 0 and 255. The default priority of new songs is 0.
283
+ A priority is an integer between 0 and 255. The default priority of new songs is 0.
286
284
 
287
285
  ---
288
286
  `prioid {PRIORITY} {ID...} => fetch_nothing`
@@ -319,7 +317,7 @@
319
317
 
320
318
  > Removes `TAG` from the specified `SONGID`. If `TAG` is not specified, then all tag values will be removed. Editing song tags is only possible for remote songs.
321
319
 
322
- ### Stored Playlist Commands ###
320
+ ## Stored Playlist Commands
323
321
 
324
322
  Playlists are stored inside the configured playlist directory. They are addressed with their file name (without the directory and without the .m3u suffix).
325
323
 
@@ -340,7 +338,7 @@ Some of the commands described in this section can be used to run playlist plugi
340
338
 
341
339
  > Prints a list of the playlist directory.
342
340
 
343
- > After each playlist name the server sends its last modification time as attribute "Last-Modified" in ISO 8601 format. To avoid problems due to clock differences between clients and the server, clients should not compare this value with their local clock.
341
+ After each playlist name the server sends its last modification time as attribute "Last-Modified" in ISO 8601 format. To avoid problems due to clock differences between clients and the server, clients should not compare this value with their local clock.
344
342
 
345
343
  ---
346
344
  `load {NAME} [START:END] => fetch_nothing`
@@ -352,7 +350,7 @@ Some of the commands described in this section can be used to run playlist plugi
352
350
 
353
351
  > Adds `URI` to the playlist `NAME.m3u`.
354
352
 
355
- > `NAME.m3u` will be created if it does not exist.
353
+ `NAME.m3u` will be created if it does not exist.
356
354
 
357
355
  ---
358
356
  `playlistclear {NAME} => fetch_nothing`
@@ -384,7 +382,7 @@ Some of the commands described in this section can be used to run playlist plugi
384
382
 
385
383
  > Saves the current playlist to `NAME.m3u` in the playlist directory.
386
384
 
387
- ### Database Commands ###
385
+ ## Database Commands
388
386
 
389
387
  ---
390
388
  `count {TAG} {NEEDLE} => fetch_object`
@@ -406,7 +404,7 @@ Some of the commands described in this section can be used to run playlist plugi
406
404
 
407
405
  > Lists all tags of the specified type. `TYPE` can be any tag supported by MPD or file.
408
406
 
409
- > `ARTIST` is an optional parameter when type is album, this specifies to list albums by an artist.
407
+ `ARTIST` is an optional parameter when type is album, this specifies to list albums by an artist.
410
408
 
411
409
  ---
412
410
  `listall [URI] => fetch_database`
@@ -423,14 +421,14 @@ Some of the commands described in this section can be used to run playlist plugi
423
421
 
424
422
  > Lists the contents of the directory `URI`, including files are not recognized by `MPD`. `URI` can be a path relative to the music directory or an `URI` understood by one of the storage plugins. The response contains at least one line for each directory entry with the prefix `"file: "` or `"directory: "`, and may be followed by file attributes such as `"Last-Modified"` and `"size"`.
425
423
 
426
- > For example, `smb://SERVER` returns a list of all shares on the given SMB/CIFS server; `nfs://servername/path` obtains a directory listing from the NFS server.
424
+ For example, `smb://SERVER` returns a list of all shares on the given SMB/CIFS server; `nfs://servername/path` obtains a directory listing from the NFS server.
427
425
 
428
426
  ---
429
427
  `lsinfo [URI] => fetch_database`
430
428
 
431
429
  > Lists the contents of the directory `URI`.
432
430
 
433
- > When listing the root directory, this currently returns the list of stored playlists. This behavior is deprecated; use `listplaylists` instead.
431
+ When listing the root directory, this currently returns the list of stored playlists. This behavior is deprecated; use `listplaylists` instead.
434
432
 
435
433
  > Clients that are connected via UNIX domain socket may use this command to read the tags of an arbitrary local file (`URI` beginning with "file:///").
436
434
 
@@ -444,25 +442,25 @@ Some of the commands described in this section can be used to run playlist plugi
444
442
 
445
443
  > Searches for any song that contains `WHAT` in tag `TYPE` and adds them to current playlist.
446
444
 
447
- > Parameters have the same meaning as for `find`, except that search is not case sensitive.
445
+ Parameters have the same meaning as for `find`, except that search is not case sensitive.
448
446
 
449
447
  ---
450
448
  `searchaddpl {NAME} {TYPE} {WHAT} [...] => fetch_nothing`
451
449
 
452
450
  > Searches for any song that contains `WHAT` in tag `TYPE` and adds them to the playlist named `NAME`.
453
451
 
454
- > If a playlist by that name doesn't exist it is created.
452
+ If a playlist by that name doesn't exist it is created.
455
453
 
456
- > Parameters have the same meaning as for find, except that search is not case sensitive.
454
+ Parameters have the same meaning as for find, except that search is not case sensitive.
457
455
 
458
456
  ---
459
457
  `update [URI] => fetch_item`
460
458
 
461
459
  > Updates the music database: find new files, remove deleted files, update modified files.
462
460
 
463
- > `URI` is a particular directory or song/file to update. If you do not specify it, everything is updated.
461
+ `URI` is a particular directory or song/file to update. If you do not specify it, everything is updated.
464
462
 
465
- > Prints "updating_db: JOBID" where JOBID is a positive number identifying the update job. You can read the current job id in the status response.
463
+ Prints "updating_db: JOBID" where JOBID is a positive number identifying the update job. You can read the current job id in the status response.
466
464
 
467
465
  ---
468
466
  `rescan [URI] => fetch_item`
@@ -474,11 +472,11 @@ Some of the commands described in this section can be used to run playlist plugi
474
472
 
475
473
  > Read "comments" (i.e. key-value pairs) from the file specified by `URI`. This `URI` can be a path relative to the music directory or a URL in the form `file:///foo/bar.ogg`.
476
474
 
477
- > The response consists of lines in the form "KEY: VALUE". Comments with suspicious characters (e.g. newlines) are ignored silently.
475
+ The response consists of lines in the form "KEY: VALUE". Comments with suspicious characters (e.g. newlines) are ignored silently.
478
476
 
479
- > The meaning of these depends on the codec, and not all decoder plugins support it. For example, on Ogg files, this lists the Vorbis comments.
477
+ The meaning of these depends on the codec, and not all decoder plugins support it. For example, on Ogg files, this lists the Vorbis comments.
480
478
 
481
- ### Mounts and neighbors ###
479
+ ## Mounts and neighbors
482
480
 
483
481
  A "storage" provides access to files in the directory tree. The most basic storage plugin is a "local" storage plugin which accesses the local file system, and there are plugins to access NFS and SMB servers.
484
482
 
@@ -504,7 +502,7 @@ Multiple storages can be "mounted" together, similar to the `mount` command on m
504
502
 
505
503
  > Queries a list of "neighbors" (e.g. accessible file servers on the local net). Items on that list may be used with the `mount` command.
506
504
 
507
- ### Sticker Commands ###
505
+ ## Sticker Commands
508
506
 
509
507
  "Stickers" are pieces of information attached to existing MPD objects (e.g. song files, directories, albums). Clients can create arbitrary name/value pairs. MPD itself does not assume any special meaning in them.
510
508
 
@@ -539,7 +537,7 @@ Objects which may have stickers are addressed by their object type ("song" for s
539
537
 
540
538
  > Searches the sticker database for stickers with the specified name, below the specified directory (`URI`). For each matching song, it prints the URI and that one sticker's value.
541
539
 
542
- ### Connection Commands ###
540
+ ## Connection Commands
543
541
 
544
542
  ---
545
543
  `close`
@@ -583,20 +581,18 @@ Objects which may have stickers are addressed by their object type ("song" for s
583
581
 
584
582
  > Turns an output on or off, depending on the current state.
585
583
 
586
-
587
- ### Reflection Commands ###
584
+ ## Reflection Commands
588
585
 
589
586
  ---
590
587
  `config => fetch_item`
591
588
 
592
589
  > Dumps configuration values that may be interesting for the client. This command is only permitted to "local" clients (connected via UNIX domain socket).
593
590
 
594
- > The following response attributes are available:
591
+ The following response attributes are available:
595
592
 
596
- >
597
- | Name | Description |
598
- | ------------------ | ---------------------------------------- |
599
- | music_directory | The absolute path of the music directory |
593
+ | Name | Description |
594
+ | --- | --- |
595
+ | music_directory | The absolute path of the music directory |
600
596
 
601
597
  ---
602
598
  `commands => fetch_list`
@@ -623,7 +619,7 @@ Objects which may have stickers are addressed by their object type ("song" for s
623
619
 
624
620
  > Print a list of decoder plugins, followed by their supported suffixes and MIME types.
625
621
 
626
- ### Client to client ###
622
+ ## Client to client
627
623
 
628
624
  Clients can communicate with each others over "channels". A channel is created by a client subscribing to it. More than one client can be subscribed to a channel at a time; all of them will receive the messages which get sent to it.
629
625
 
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # MPDClient
1
+ # MPD::Client
2
+
3
+ [![Build Status](https://badgen.net/travis/mamantoha/mpd_client)](https://travis-ci.org/mamantoha/mpd_client)
4
+ [![Gem Version](https://badge.fury.io/rb/mpd_client.svg)](https://badge.fury.io/rb/mpd_client)
2
5
 
3
6
  Yet another Music Player Daemon (MPD) client library written entirely in Ruby.
4
7
  `mpd_client` is a Ruby port of the [python-mpd](https://github.com/Mic92/python-mpd2) library.
@@ -13,24 +16,25 @@ gem 'mpd_client'
13
16
 
14
17
  And then execute:
15
18
 
16
- ```
17
- $ bundle
19
+ ```console
20
+ bundle
18
21
  ```
19
22
 
20
23
  Or install it yourself as:
21
24
 
22
- ```
23
- $ gem install mpd_client
25
+ ```console
26
+ gem install mpd_client
24
27
  ```
25
28
 
26
29
  ## Usage
27
- All functionality is contained in the `MPDClient` class. Creating an instance of this class is as simple as:
30
+
31
+ All functionality is contained in the `MPD::Client` class. Creating an instance of this class is as simple as:
28
32
 
29
33
  ```ruby
30
- client = MPDClient.new
34
+ client = MPD::Client.new
31
35
  ```
32
36
 
33
- Once you have an instance of the `MPDClient` class, start by connecting to the server:
37
+ Once you have an instance of the `MPD::Client` class, start by connecting to the server:
34
38
 
35
39
  ```ruby
36
40
  client.connect('localhost', 6600)
@@ -78,28 +82,28 @@ client.delete([10,])
78
82
 
79
83
  ### Logging
80
84
 
81
- Default logger for all MPDClient instances:
85
+ Default logger for all MPD::Client instances:
82
86
 
83
87
  ```ruby
84
88
  require 'logger'
85
89
  require 'mpd_client'
86
90
 
87
- MPDClient.log = Logger.new($stderr)
91
+ MPD::Client.log = Logger.new($stderr)
88
92
 
89
- client = MPDClient.new
93
+ client = MPD::Client.new
90
94
  ```
91
95
 
92
- Sets the logger used by this instance of MPDClient:
96
+ Sets the logger used by this instance of MPD::Client:
93
97
 
94
98
  ```ruby
95
99
  require 'logger'
96
100
  require 'mpd_client'
97
101
 
98
- client = MPDClient.new
102
+ client = MPD::Client.new
99
103
  client.log = Logger.new($stderr)
100
104
  ```
101
105
 
102
- For more information about logging configuration, see http://www.ruby-doc.org/stdlib-1.9.3/libdoc/logger/rdoc/Logger.html
106
+ For more information about logging configuration, see [Logger](https://ruby-doc.org/stdlib-2.5.1/libdoc/logger/rdoc/Logger.html)
103
107
 
104
108
  ## Development
105
109
 
@@ -117,6 +121,6 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
117
121
 
118
122
  ## License and Author
119
123
 
120
- Copyright (c) 2013-2017 by Anton Maminov
124
+ Copyright (c) 2013-2018 by Anton Maminov
121
125
 
122
126
  This library is distributed under the MIT license. Please see the LICENSE file.