ruby-mpd 0.1.5 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +100 -45
- data/lib/ruby-mpd.rb +42 -83
- data/lib/ruby-mpd/exceptions.rb +33 -0
- data/lib/ruby-mpd/parser.rb +24 -7
- data/lib/ruby-mpd/playlist.rb +5 -6
- data/lib/ruby-mpd/plugins/channels.rb +2 -5
- data/lib/ruby-mpd/plugins/controls.rb +2 -5
- data/lib/ruby-mpd/plugins/database.rb +44 -6
- data/lib/ruby-mpd/plugins/information.rb +7 -4
- data/lib/ruby-mpd/plugins/playback_options.rb +3 -3
- data/lib/ruby-mpd/plugins/playlists.rb +1 -3
- data/lib/ruby-mpd/plugins/queue.rb +3 -5
- data/lib/ruby-mpd/plugins/reflection.rb +3 -3
- data/lib/ruby-mpd/song.rb +9 -3
- data/ruby-mpd.gemspec +1 -1
- data/{tests → test}/libtests.rb +78 -89
- metadata +6 -11
- data/AUTHORS +0 -1
- data/DOC.rdoc +0 -78
- data/data/database.yaml +0 -347
- data/examples/rmpc.rb +0 -67
- data/examples/tailmpc.rb +0 -115
- data/lib/mpdserver.rb +0 -1206
- data/tests/servertests.rb +0 -3405
@@ -0,0 +1,33 @@
|
|
1
|
+
class MPD
|
2
|
+
# Standard MPD error.
|
3
|
+
class Error < StandardError; end
|
4
|
+
# When something goes wrong with the connection
|
5
|
+
class ConnectionError < Error; end
|
6
|
+
|
7
|
+
# When the server returns an error. Superclass. Used for ACK_ERROR_UNKNOWN too.
|
8
|
+
class ServerError < Error; end
|
9
|
+
|
10
|
+
class NotListError < ServerError; end # ACK_ERROR_NOT_LIST <-- unused?
|
11
|
+
# ACK_ERROR_ARG - There was an error with one of the arguments.
|
12
|
+
class ServerArgumentError < ServerError; end
|
13
|
+
# MPD server password incorrect - ACK_ERROR_PASSWORD
|
14
|
+
class IncorrectPassword < ServerError; end
|
15
|
+
# ACK_ERROR_PERMISSION - not permitted to use the command.
|
16
|
+
# (Mostly, the solution is to connect via UNIX domain socket)
|
17
|
+
class PermissionError < ServerError; end
|
18
|
+
|
19
|
+
# ACK_ERROR_NO_EXIST - The requested resource was not found
|
20
|
+
class NotFound < ServerError; end
|
21
|
+
# ACK_ERROR_PLAYLIST_MAX - Playlist is at the max size
|
22
|
+
class PlaylistMaxError < ServerError; end
|
23
|
+
# ACK_ERROR_SYSTEM - One of the systems has errored.
|
24
|
+
class SystemError < ServerError; end
|
25
|
+
# ACK_ERROR_PLAYLIST_LOAD - unused?
|
26
|
+
class PlaylistLoadError < ServerError; end
|
27
|
+
# ACK_ERROR_UPDATE_ALREADY - Already updating the DB.
|
28
|
+
class AlreadyUpdating < ServerError; end
|
29
|
+
# ACK_ERROR_PLAYER_SYNC - not playing.
|
30
|
+
class NotPlaying < ServerError; end
|
31
|
+
# ACK_ERROR_EXIST - the resource already exists.
|
32
|
+
class AlreadyExists < ServerError; end
|
33
|
+
end
|
data/lib/ruby-mpd/parser.rb
CHANGED
@@ -11,11 +11,13 @@ class MPD
|
|
11
11
|
if word.is_a?(TrueClass) || word.is_a?(FalseClass)
|
12
12
|
word ? '1' : '0' # convert bool to 1 or 0
|
13
13
|
elsif word.is_a?(Range)
|
14
|
-
if word.end == -1 #negative means to end of range
|
14
|
+
if word.end == -1 # negative means to end of range
|
15
15
|
"#{word.begin}:"
|
16
16
|
else
|
17
17
|
"#{word.begin}:#{word.end + (word.exclude_end? ? 0 : 1)}"
|
18
18
|
end
|
19
|
+
elsif word.is_a?(MPD::Song)
|
20
|
+
word.file
|
19
21
|
else
|
20
22
|
# escape any strings with space (wrap in double quotes)
|
21
23
|
word = word.to_s
|
@@ -36,9 +38,14 @@ class MPD
|
|
36
38
|
FLOAT_KEYS = [:mixrampdb, :elapsed]
|
37
39
|
BOOL_KEYS = [:repeat, :random, :single, :consume, :outputenabled]
|
38
40
|
|
39
|
-
# Parses key-value pairs into correct class
|
40
|
-
# @todo special parsing of playlist, it's a int in :status and a string in :listplaylists
|
41
41
|
|
42
|
+
# Commands, where it makes sense to always explicitly return an array.
|
43
|
+
RETURN_ARRAY = [:channels, :outputs, :readmessages, :list, :listall,
|
44
|
+
:listallinfo, :find, :search, :listplaylists, :listplaylist, :playlistfind,
|
45
|
+
:playlistsearch, :plchanges, :tagtypes, :commands, :notcommands, :urlhandlers,
|
46
|
+
:decoders, :listplaylistinfo]
|
47
|
+
|
48
|
+
# Parses key-value pairs into correct class.
|
42
49
|
def parse_key key, value
|
43
50
|
if INT_KEYS.include? key
|
44
51
|
value.to_i
|
@@ -113,11 +120,21 @@ class MPD
|
|
113
120
|
end
|
114
121
|
end
|
115
122
|
|
123
|
+
# Parses the response, determining per-command on what parsing logic
|
124
|
+
# to use (build_response vs build_grouped_response).
|
125
|
+
#
|
126
|
+
# @return [Array<Hash>, Array<String>, String, Integer] Parsed response.
|
127
|
+
def parse_response(command, string)
|
128
|
+
# return explicit array if needed
|
129
|
+
return RETURN_ARRAY.include?(command) ? [] : true if string.is_a?(TrueClass)
|
130
|
+
command == :listall ? build_grouped_response(string) : build_response(command, string)
|
131
|
+
end
|
132
|
+
|
116
133
|
# Parses the response into appropriate objects (either a single object,
|
117
134
|
# or an array of objects or an array of hashes).
|
118
135
|
#
|
119
136
|
# @return [Array<Hash>, Array<String>, String, Integer] Parsed response.
|
120
|
-
def build_response(string)
|
137
|
+
def build_response(command, string)
|
121
138
|
return [] if string.nil? || !string.is_a?(String)
|
122
139
|
|
123
140
|
chunks = make_chunks(string)
|
@@ -128,15 +145,15 @@ class MPD
|
|
128
145
|
result << (is_hash ? build_hash(chunk) : parse_line(chunk))
|
129
146
|
end
|
130
147
|
|
131
|
-
# if list has only one element, return it, else return array
|
132
|
-
result = list.length == 1 ? list.first : list
|
148
|
+
# if list has only one element and not set to explicit array, return it, else return array
|
149
|
+
result = (list.length == 1 && !RETURN_ARRAY.include?(command)) ? list.first : list
|
133
150
|
return result
|
134
151
|
end
|
135
152
|
|
136
153
|
# Parse the response into groups that have the same key (used for file lists,
|
137
154
|
# groups together files, directories and playlists).
|
138
155
|
# @return [Hash<Array>] A hash of key groups.
|
139
|
-
def
|
156
|
+
def build_grouped_response(string)
|
140
157
|
return [] if string.nil? || !string.is_a?(String)
|
141
158
|
|
142
159
|
string.split("\n").each_with_object({}) do |line, hash|
|
data/lib/ruby-mpd/playlist.rb
CHANGED
@@ -9,15 +9,12 @@ class MPD
|
|
9
9
|
# plugins instead of the hard-coded simple m3u parser. They can access
|
10
10
|
# playlists in the music directory (relative path including the suffix) or
|
11
11
|
# remote playlists (absolute URI with a supported scheme).
|
12
|
-
#
|
13
|
-
# Changes: rm -> destroy. listplaylistinfo -> songs. Playlist prefixes
|
14
|
-
# dropped also of course. Listplaylist not used, kinda inferior to listplaylistinfo
|
15
12
|
class Playlist
|
16
13
|
|
17
14
|
attr_accessor :name
|
18
15
|
|
19
16
|
def initialize(mpd, options)
|
20
|
-
@name = options[:playlist]
|
17
|
+
@name = options.is_a?(Hash) ? options[:playlist] : options.to_s
|
21
18
|
@mpd = mpd
|
22
19
|
#@last_modified = options[:'last-modified']
|
23
20
|
end
|
@@ -25,7 +22,9 @@ class MPD
|
|
25
22
|
# Lists the songs in the playlist. Playlist plugins are supported.
|
26
23
|
# @return [Array<MPD::Song>] songs in the playlist.
|
27
24
|
def songs
|
28
|
-
|
25
|
+
@mpd.send_command(:listplaylistinfo, @name).map {|hash| Song.new(hash) }
|
26
|
+
rescue NotFound
|
27
|
+
return [] # we rescue in the case the playlist doesn't exist.
|
29
28
|
end
|
30
29
|
|
31
30
|
# Loads the playlist into the current queue. Playlist plugins are supported.
|
@@ -51,7 +50,7 @@ class MPD
|
|
51
50
|
# and +:any+ to match against all available tags.
|
52
51
|
# @macro returnraise
|
53
52
|
def searchadd(type, what)
|
54
|
-
send_command :searchaddpl, @name, type, what
|
53
|
+
@mpd.send_command :searchaddpl, @name, type, what
|
55
54
|
end
|
56
55
|
|
57
56
|
# Clears the playlist.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
class MPD
|
2
|
+
# This namespace contains "plugins", which get included into the main class.
|
2
3
|
module Plugins
|
3
4
|
# = Client to client commands
|
4
5
|
#
|
@@ -30,9 +31,7 @@ class MPD
|
|
30
31
|
end
|
31
32
|
|
32
33
|
# Obtain a list of all channels.
|
33
|
-
# @return [Array<String>]
|
34
|
-
# @return [String] if only one channel exists.
|
35
|
-
# @return [true] if no channels exist.
|
34
|
+
# @return [Array<String>] a list of channels
|
36
35
|
def channels
|
37
36
|
send_command :channels
|
38
37
|
end
|
@@ -40,8 +39,6 @@ class MPD
|
|
40
39
|
# Reads messages for this client. The response is an array of
|
41
40
|
# hashes with +:channel+ and +:message+ keys or true if no messages.
|
42
41
|
# @return [Array<Hash>] Messages recieved.
|
43
|
-
# @return [Hash] if only one message recieved
|
44
|
-
# @return [true] if no messages.
|
45
42
|
def readmessages
|
46
43
|
send_command :readmessages
|
47
44
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class MPD
|
2
2
|
module Plugins
|
3
|
-
# Commands for controlling playback.
|
4
|
-
# command maps to +seekcur+ from MPD and the original seek command is
|
5
|
-
# {#seekpos} here.
|
3
|
+
# Commands for controlling playback.
|
6
4
|
module Controls
|
7
5
|
# Plays the next song in the playlist.
|
8
6
|
# @macro returnraise
|
@@ -11,7 +9,6 @@ class MPD
|
|
11
9
|
end
|
12
10
|
|
13
11
|
# Resume/pause playback.
|
14
|
-
# @note The use of pause without an argument is deprecated in MPD.
|
15
12
|
# @macro returnraise
|
16
13
|
def pause=(toggle)
|
17
14
|
send_command :pause, toggle
|
@@ -46,7 +43,7 @@ class MPD
|
|
46
43
|
# @since MPD 0.17
|
47
44
|
# @param [Integer, String] time Position within the current song.
|
48
45
|
# @param [Hash] options Either +:id+ or +:pos+ can be specified.
|
49
|
-
#
|
46
|
+
# @macro returnraise
|
50
47
|
def seek(time, options = {})
|
51
48
|
if options[:id]
|
52
49
|
send_command :seekid, options[:id], time
|
@@ -1,9 +1,6 @@
|
|
1
1
|
class MPD
|
2
2
|
module Plugins
|
3
3
|
# Commands for interacting with the music database.
|
4
|
-
#
|
5
|
-
# Changes: listallinfo -> songs, searchaddpl in MPD::Playlist#searchadd.
|
6
|
-
# search merges search, find, searchadd and findadd
|
7
4
|
module Database
|
8
5
|
|
9
6
|
# Counts the number of songs and their total playtime
|
@@ -22,7 +19,13 @@ class MPD
|
|
22
19
|
send_command :list, type, arg
|
23
20
|
end
|
24
21
|
|
25
|
-
#
|
22
|
+
# List all of the files in the database, starting at path.
|
23
|
+
# If path isn't specified, the root of the database is used.
|
24
|
+
#
|
25
|
+
# @return [Hash<String>] hash with array keys :file, :directory and :playlist.
|
26
|
+
def files(path = nil)
|
27
|
+
send_command :listall, path
|
28
|
+
end
|
26
29
|
|
27
30
|
# List all of the songs in the database starting at path.
|
28
31
|
# If path isn't specified, the root of the database is used
|
@@ -32,7 +35,8 @@ class MPD
|
|
32
35
|
build_songs_list send_command(:listallinfo, path)
|
33
36
|
end
|
34
37
|
|
35
|
-
# lsinfo
|
38
|
+
# lsinfo - Clients that are connected via UNIX domain socket may use this
|
39
|
+
# command to read the tags of an arbitrary local file (URI beginning with "file:///").
|
36
40
|
|
37
41
|
# Searches for any song that contains +what+ in the +type+ field.
|
38
42
|
# Searches are case insensitive by default, however you can enable
|
@@ -68,11 +72,45 @@ class MPD
|
|
68
72
|
|
69
73
|
# Same as {#update}, but also rescans unmodified files.
|
70
74
|
#
|
71
|
-
# @return
|
75
|
+
# @return (see #update)
|
72
76
|
def rescan(path = nil)
|
73
77
|
send_command :rescan, path
|
74
78
|
end
|
75
79
|
|
80
|
+
# unofficial
|
81
|
+
|
82
|
+
# List all of the directories in the database, starting at path.
|
83
|
+
# If path isn't specified, the root of the database is used.
|
84
|
+
#
|
85
|
+
# @return [Array<String>] Array of directory names
|
86
|
+
def directories(path = nil)
|
87
|
+
response = send_command(:listall, path)
|
88
|
+
return response[:directory]
|
89
|
+
end
|
90
|
+
|
91
|
+
# Lists all of the albums in the database.
|
92
|
+
# The optional argument is for specifying an artist to list
|
93
|
+
# the albums for
|
94
|
+
#
|
95
|
+
# @return [Array<String>] An array of album names.
|
96
|
+
def albums(artist = nil)
|
97
|
+
list :album, artist
|
98
|
+
end
|
99
|
+
|
100
|
+
# Lists all of the artists in the database.
|
101
|
+
#
|
102
|
+
# @return [Array<String>] An array of artist names.
|
103
|
+
def artists
|
104
|
+
list :artist
|
105
|
+
end
|
106
|
+
|
107
|
+
# List all of the songs by an artist.
|
108
|
+
#
|
109
|
+
# @return [Array<MPD::Song>]
|
110
|
+
def songs_by_artist(artist)
|
111
|
+
search :artist, artist
|
112
|
+
end
|
113
|
+
|
76
114
|
end
|
77
115
|
end
|
78
116
|
end
|
@@ -14,8 +14,11 @@ class MPD
|
|
14
14
|
# Get the currently playing song
|
15
15
|
#
|
16
16
|
# @return [MPD::Song]
|
17
|
+
# @return [nil] if there is no song playing
|
17
18
|
def current_song
|
18
|
-
|
19
|
+
hash = send_command :currentsong
|
20
|
+
# if there is no current song (we get true, then return nil)
|
21
|
+
hash.is_a?(TrueClass) ? nil : Song.new(hash)
|
19
22
|
end
|
20
23
|
|
21
24
|
# Waits until there is a noteworthy change in one or more of MPD's subsystems.
|
@@ -41,9 +44,9 @@ class MPD
|
|
41
44
|
#
|
42
45
|
# @since MPD 0.14
|
43
46
|
# @param [Symbol] masks A list of subsystems we want to be notified on.
|
44
|
-
def idle(*masks)
|
45
|
-
|
46
|
-
end
|
47
|
+
#def idle(*masks)
|
48
|
+
# send_command(:idle, *masks)
|
49
|
+
#end
|
47
50
|
|
48
51
|
# MPD status: volume, time, modes...
|
49
52
|
# * *volume*: 0-100
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class MPD
|
2
2
|
module Plugins
|
3
3
|
# Commands related to setting various aspects and modes of playback.
|
4
|
-
#
|
5
|
-
# Changes: setvol -> volume.
|
6
4
|
module PlaybackOptions
|
7
5
|
|
8
6
|
# Enable/disable consume mode.
|
@@ -26,6 +24,7 @@ class MPD
|
|
26
24
|
# volume so use negative values, I prefer -17dB. In the absence of mixramp
|
27
25
|
# tags crossfading will be used. See http://sourceforge.net/projects/mixramp
|
28
26
|
# @param [Float] decibels Maximum volume level in decibels.
|
27
|
+
# @macro returnraise
|
29
28
|
def mixrampdb=(decibels)
|
30
29
|
send_command :mixrampdb, decibels
|
31
30
|
end
|
@@ -33,6 +32,7 @@ class MPD
|
|
33
32
|
# Additional time subtracted from the overlap calculated by mixrampdb.
|
34
33
|
# A value of "nan" or Float::NAN disables MixRamp overlapping and falls
|
35
34
|
# back to crossfading.
|
35
|
+
# @macro returnraise
|
36
36
|
def mixrampdelay=(seconds)
|
37
37
|
send_command :mixrampdelay, seconds
|
38
38
|
end
|
@@ -51,7 +51,7 @@ class MPD
|
|
51
51
|
|
52
52
|
# Sets the volume level. (Maps to MPD's +setvol+)
|
53
53
|
# @param [Integer] vol Volume level between 0 and 100.
|
54
|
-
# @
|
54
|
+
# @return [Integer] The new volume level.
|
55
55
|
def volume=(vol)
|
56
56
|
send_command :setvol, vol
|
57
57
|
end
|
@@ -1,13 +1,11 @@
|
|
1
1
|
class MPD
|
2
2
|
module Plugins
|
3
3
|
# These commands manipulate stored playlists.
|
4
|
-
#
|
5
|
-
# Changes: listplaylists -> playlists.
|
6
4
|
module Playlists
|
7
5
|
|
8
6
|
# List all of the playlists in the database
|
9
7
|
#
|
10
|
-
# @return [Array<
|
8
|
+
# @return [Array<MPD::Playlist>] Array of playlists
|
11
9
|
def playlists
|
12
10
|
send_command(:listplaylists).map {|opt| MPD::Playlist.new(self, opt)}
|
13
11
|
end
|
@@ -2,17 +2,14 @@ class MPD
|
|
2
2
|
module Plugins
|
3
3
|
# These commands manipulate the current playlist, what's playing now.
|
4
4
|
# For a distinction between this and other playlists, this is called
|
5
|
-
# queue.
|
6
|
-
# Changes: playlistinfo -> queue, plchanges -> queue_changes,
|
7
|
-
# playlistid -> song_with_id, playlistfind -> queue_find,
|
8
|
-
# playlistsearch -> queue_search, prio -> song_priority.
|
5
|
+
# queue.
|
9
6
|
module Queue
|
10
7
|
|
11
8
|
# List the current playlist/queue.
|
12
9
|
# An Integer or Range can be used to limit the information returned
|
13
10
|
# to a specific subset.
|
14
11
|
#
|
15
|
-
# @return [
|
12
|
+
# @return [Array<MPD::Song>] Array of songs in the queue
|
16
13
|
# or a single song.
|
17
14
|
def queue(limit=nil)
|
18
15
|
build_songs_list send_command(:playlistinfo, limit)
|
@@ -27,6 +24,7 @@ class MPD
|
|
27
24
|
|
28
25
|
# Adds a song to the queue (*non-recursive*) and returns the song id.
|
29
26
|
# Optionally, one can specify the position on which to add the song (since MPD 0.14).
|
27
|
+
# @return [Integer] id of the song that was added.
|
30
28
|
def addid(path, pos=nil)
|
31
29
|
send_command :addid, pos
|
32
30
|
end
|
@@ -1,8 +1,6 @@
|
|
1
1
|
class MPD
|
2
2
|
module Plugins
|
3
3
|
# Informational commands regarding MPD's internals and config.
|
4
|
-
#
|
5
|
-
# Changes: tagtypes was mapped to tags and gets fetched only once.
|
6
4
|
module Reflection
|
7
5
|
# Returns the config of MPD (currently only music_directory).
|
8
6
|
# Only works if connected trough an UNIX domain socket.
|
@@ -36,7 +34,9 @@ class MPD
|
|
36
34
|
send_command :decoders
|
37
35
|
end
|
38
36
|
|
39
|
-
# Get a list of available song metadata.
|
37
|
+
# Get a list of available song metadata fields. This gets only
|
38
|
+
# mapped once per-connect (it gets remapped if you connect and
|
39
|
+
# disconnect).
|
40
40
|
# @return [Array] An array of tags.
|
41
41
|
def tags
|
42
42
|
@tags ||= send_command(:tagtypes).map {|tag| tag.downcase }
|
data/lib/ruby-mpd/song.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
class MPD; end
|
2
2
|
|
3
|
-
#
|
3
|
+
# Object representation of a song.
|
4
4
|
#
|
5
5
|
# If the field doesn't exist or isn't set, nil will be returned
|
6
6
|
class MPD::Song
|
7
|
+
# length in seconds
|
8
|
+
attr_accessor :time
|
9
|
+
|
7
10
|
def initialize(options)
|
8
|
-
@data = {}
|
11
|
+
@data = {} #allowed fields are @types + :file
|
12
|
+
@time = options.delete(:time).first #HAXX for array return
|
9
13
|
@data.merge! options
|
10
14
|
end
|
11
15
|
|
@@ -14,10 +18,12 @@ class MPD::Song
|
|
14
18
|
self.file == another.file
|
15
19
|
end
|
16
20
|
|
21
|
+
# @return [String] A formatted representation of the song length ("1:02")
|
17
22
|
def length
|
18
|
-
return "#{(@
|
23
|
+
return "#{(@time / 60)}:#{"%02d" % (@time % 60)}"
|
19
24
|
end
|
20
25
|
|
26
|
+
# Pass any unknown calls over to the data hash.
|
21
27
|
def method_missing(m, *a)
|
22
28
|
key = m #.to_s
|
23
29
|
if key =~ /=$/
|
data/ruby-mpd.gemspec
CHANGED
data/{tests → test}/libtests.rb
RENAMED
@@ -1,35 +1,24 @@
|
|
1
1
|
#
|
2
|
-
# Unit tests for
|
2
|
+
# Unit tests for ruby-mpd
|
3
3
|
#
|
4
|
-
# This uses the included mpdserver.rb test server
|
5
4
|
|
6
|
-
require '../lib/
|
7
|
-
require '../lib/mpdserver'
|
5
|
+
require '../lib/ruby-mpd'
|
8
6
|
require 'test/unit'
|
9
7
|
|
10
8
|
class MPDTester < Test::Unit::TestCase
|
11
9
|
|
12
10
|
def setup
|
13
11
|
begin
|
14
|
-
|
15
|
-
@server = MPDTestServer.new @port
|
16
|
-
@server.start
|
17
|
-
rescue Errno::EADDRINUSE
|
18
|
-
@port = 94942
|
19
|
-
@server = MPDTestServer.new @port
|
20
|
-
@server.start
|
21
|
-
end
|
22
|
-
@mpd = MPD.new 'localhost', @port
|
12
|
+
@mpd = MPD.new 'localhost', 94942
|
23
13
|
end
|
24
14
|
|
25
15
|
def teardown
|
26
16
|
@mpd.disconnect
|
27
|
-
@server.stop
|
28
17
|
end
|
29
18
|
|
30
19
|
def test_connect
|
31
20
|
ret = @mpd.connect
|
32
|
-
|
21
|
+
assert ret
|
33
22
|
end
|
34
23
|
|
35
24
|
def test_connected?
|
@@ -73,10 +62,10 @@ class MPDTester < Test::Unit::TestCase
|
|
73
62
|
assert_equal 'Are You Shpongled?', pls[0].album
|
74
63
|
assert_equal 'Shpongle Falls', pls[0].title
|
75
64
|
|
76
|
-
assert_raise(MPD::
|
65
|
+
assert_raise(MPD::ServerError) {@mpd.add('Does/Not/Exist')}
|
77
66
|
|
78
67
|
@mpd.disconnect
|
79
|
-
assert_raise(MPD::
|
68
|
+
assert_raise(MPD::ServerError) {@mpd.add('Shpongle')}
|
80
69
|
end
|
81
70
|
|
82
71
|
def test_clear
|
@@ -94,7 +83,7 @@ class MPDTester < Test::Unit::TestCase
|
|
94
83
|
assert_equal 0, pls.size
|
95
84
|
|
96
85
|
@mpd.disconnect
|
97
|
-
assert_raise(MPD::
|
86
|
+
assert_raise(MPD::ServerError) {@mpd.clear}
|
98
87
|
end
|
99
88
|
|
100
89
|
def test_clearerror
|
@@ -104,7 +93,7 @@ class MPDTester < Test::Unit::TestCase
|
|
104
93
|
assert @mpd.clearerror
|
105
94
|
|
106
95
|
@mpd.disconnect
|
107
|
-
assert_raise(MPD::
|
96
|
+
assert_raise(MPD::ServerError) {@mpd.clearerror}
|
108
97
|
end
|
109
98
|
|
110
99
|
def test_crossfade
|
@@ -116,8 +105,8 @@ class MPDTester < Test::Unit::TestCase
|
|
116
105
|
assert_equal '40', @mpd.status['xfade']
|
117
106
|
|
118
107
|
@mpd.disconnect
|
119
|
-
assert_raise(MPD::
|
120
|
-
assert_raise(MPD::
|
108
|
+
assert_raise(MPD::ServerError) {@mpd.crossfade = 20}
|
109
|
+
assert_raise(MPD::ServerError) {@mpd.crossfade}
|
121
110
|
end
|
122
111
|
|
123
112
|
def test_current_song
|
@@ -155,7 +144,7 @@ class MPDTester < Test::Unit::TestCase
|
|
155
144
|
assert_equal '1', s.track
|
156
145
|
|
157
146
|
@mpd.disconnect
|
158
|
-
assert_raise(MPD::
|
147
|
+
assert_raise(MPD::ServerError) {@mpd.current_song}
|
159
148
|
end
|
160
149
|
|
161
150
|
def test_delete
|
@@ -171,10 +160,10 @@ class MPDTester < Test::Unit::TestCase
|
|
171
160
|
assert_not_equal 'No On Ever Dreams', song.title
|
172
161
|
end
|
173
162
|
|
174
|
-
assert_raise(MPD::
|
163
|
+
assert_raise(MPD::ServerError) {@mpd.delete(999)}
|
175
164
|
|
176
165
|
@mpd.disconnect
|
177
|
-
assert_raise(MPD::
|
166
|
+
assert_raise(MPD::ServerError) {@mpd.delete(3)}
|
178
167
|
end
|
179
168
|
|
180
169
|
def test_deleteid
|
@@ -190,10 +179,10 @@ class MPDTester < Test::Unit::TestCase
|
|
190
179
|
assert_not_equal 'No One Ever Dreams', song.title
|
191
180
|
end
|
192
181
|
|
193
|
-
assert_raise(MPD::
|
182
|
+
assert_raise(MPD::ServerError) {@mpd.deleteid(999)}
|
194
183
|
|
195
184
|
@mpd.disconnect
|
196
|
-
assert_raise(MPD::
|
185
|
+
assert_raise(MPD::ServerError) {@mpd.deleteid(11)}
|
197
186
|
end
|
198
187
|
|
199
188
|
def test_find
|
@@ -230,10 +219,10 @@ class MPDTester < Test::Unit::TestCase
|
|
230
219
|
d = @mpd.find 'artist', 'no artist'
|
231
220
|
assert_equal 0, d.size
|
232
221
|
|
233
|
-
assert_raise(MPD::
|
222
|
+
assert_raise(MPD::ServerError) {@mpd.find('error', 'no-such')}
|
234
223
|
|
235
224
|
@mpd.disconnect
|
236
|
-
assert_raise(MPD::
|
225
|
+
assert_raise(MPD::ServerError) {@mpd.find('album', 'Are You Shpongled')}
|
237
226
|
end
|
238
227
|
|
239
228
|
def test_kill
|
@@ -243,7 +232,7 @@ class MPDTester < Test::Unit::TestCase
|
|
243
232
|
|
244
233
|
assert !@mpd.connected?
|
245
234
|
|
246
|
-
assert_raise(MPD::
|
235
|
+
assert_raise(MPD::ServerError) {@mpd.kill}
|
247
236
|
end
|
248
237
|
|
249
238
|
def test_albums
|
@@ -264,7 +253,7 @@ class MPDTester < Test::Unit::TestCase
|
|
264
253
|
assert_equal 'Nothing Lasts... But Nothing Is Lost', sh[1]
|
265
254
|
|
266
255
|
@mpd.disconnect
|
267
|
-
assert_raise(MPD::
|
256
|
+
assert_raise(MPD::ServerError) {@mpd.albums}
|
268
257
|
end
|
269
258
|
|
270
259
|
def test_artists
|
@@ -278,7 +267,7 @@ class MPDTester < Test::Unit::TestCase
|
|
278
267
|
assert_equal 'Shpongle', artists[2]
|
279
268
|
|
280
269
|
@mpd.disconnect
|
281
|
-
assert_raise(MPD::
|
270
|
+
assert_raise(MPD::ServerError) {@mpd.artists}
|
282
271
|
end
|
283
272
|
|
284
273
|
def test_list
|
@@ -305,11 +294,11 @@ class MPDTester < Test::Unit::TestCase
|
|
305
294
|
assert_equal 'Are You Shpongled?', arg[0]
|
306
295
|
assert_equal 'Nothing Lasts... But Nothing Is Lost', arg[1]
|
307
296
|
|
308
|
-
assert_raise(MPD::
|
309
|
-
assert_raise(MPD::
|
297
|
+
assert_raise(MPD::ServerError) {@mpd.list('fail')}
|
298
|
+
assert_raise(MPD::ServerError) {@mpd.list('fail', 'Shpongle')}
|
310
299
|
|
311
300
|
@mpd.disconnect
|
312
|
-
assert_raise(MPD::
|
301
|
+
assert_raise(MPD::ServerError) {@mpd.artists}
|
313
302
|
end
|
314
303
|
|
315
304
|
def test_directories
|
@@ -333,10 +322,10 @@ class MPDTester < Test::Unit::TestCase
|
|
333
322
|
assert_equal 'Shpongle/Are_You_Shpongled', shpongle[1]
|
334
323
|
assert_equal 'Shpongle/Nothing_Lasts..._But_Nothing_Is_Lost', shpongle[2]
|
335
324
|
|
336
|
-
assert_raise(MPD::
|
325
|
+
assert_raise(MPD::ServerError) {@mpd.directories('no-dirs')}
|
337
326
|
|
338
327
|
@mpd.disconnect
|
339
|
-
assert_raise(MPD::
|
328
|
+
assert_raise(MPD::ServerError) {@mpd.directories}
|
340
329
|
end
|
341
330
|
|
342
331
|
def test_files
|
@@ -364,10 +353,10 @@ class MPDTester < Test::Unit::TestCase
|
|
364
353
|
assert_equal 'Shpongle/Nothing_Lasts..._But_Nothing_Is_Lost/01.Botanical_Dimensions.ogg', sh[7]
|
365
354
|
assert_equal 'Shpongle/Nothing_Lasts..._But_Nothing_Is_Lost/20.Falling_Awake.ogg', sh[26]
|
366
355
|
|
367
|
-
assert_raise(MPD::
|
356
|
+
assert_raise(MPD::ServerError) {@mpd.files('no-files')}
|
368
357
|
|
369
358
|
@mpd.disconnect
|
370
|
-
assert_raise(MPD::
|
359
|
+
assert_raise(MPD::ServerError) {@mpd.files}
|
371
360
|
end
|
372
361
|
|
373
362
|
def test_playlists
|
@@ -381,7 +370,7 @@ class MPDTester < Test::Unit::TestCase
|
|
381
370
|
assert_equal 'Astral_Projection_-_Dancing_Galaxy', pls[1]
|
382
371
|
|
383
372
|
@mpd.disconnect
|
384
|
-
assert_raise(MPD::
|
373
|
+
assert_raise(MPD::ServerError) {@mpd.playlists}
|
385
374
|
end
|
386
375
|
|
387
376
|
def test_songs
|
@@ -413,10 +402,10 @@ class MPDTester < Test::Unit::TestCase
|
|
413
402
|
assert_equal 'Botanical Dimensions', sh[7].title
|
414
403
|
assert_equal 'Falling Awake', sh[26].title
|
415
404
|
|
416
|
-
assert_raise(MPD::
|
405
|
+
assert_raise(MPD::ServerError) {@mpd.songs('no-songs')}
|
417
406
|
|
418
407
|
@mpd.disconnect
|
419
|
-
assert_raise(MPD::
|
408
|
+
assert_raise(MPD::ServerError) {@mpd.songs}
|
420
409
|
end
|
421
410
|
|
422
411
|
def test_songs_by_artist
|
@@ -439,7 +428,7 @@ class MPDTester < Test::Unit::TestCase
|
|
439
428
|
assert_equal 0, songs.size
|
440
429
|
|
441
430
|
@mpd.disconnect
|
442
|
-
assert_raise(MPD::
|
431
|
+
assert_raise(MPD::ServerError) {@mpd.songs_by_artist('Shpongle')}
|
443
432
|
end
|
444
433
|
|
445
434
|
def test_load
|
@@ -465,10 +454,10 @@ class MPDTester < Test::Unit::TestCase
|
|
465
454
|
assert_equal 'Liquid Sun', pls[6].title
|
466
455
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[7].title
|
467
456
|
|
468
|
-
assert_raise(MPD::
|
457
|
+
assert_raise(MPD::ServerError) {@mpd.load('No-PLS')}
|
469
458
|
|
470
459
|
@mpd.disconnect
|
471
|
-
assert_raise(MPD::
|
460
|
+
assert_raise(MPD::ServerError) {@mpd.load('Astral_Projection_-_Dancing_Galaxy')}
|
472
461
|
end
|
473
462
|
|
474
463
|
def test_move
|
@@ -495,10 +484,10 @@ class MPDTester < Test::Unit::TestCase
|
|
495
484
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[6].title
|
496
485
|
assert_equal 'Soundform', pls[7].title
|
497
486
|
|
498
|
-
assert_raise(MPD::
|
487
|
+
assert_raise(MPD::ServerError) {@mpd.move(999,1)}
|
499
488
|
|
500
489
|
@mpd.disconnect
|
501
|
-
assert_raise(MPD::
|
490
|
+
assert_raise(MPD::ServerError) {@mpd.move(3,1)}
|
502
491
|
end
|
503
492
|
|
504
493
|
def test_moveid
|
@@ -525,10 +514,10 @@ class MPDTester < Test::Unit::TestCase
|
|
525
514
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[6].title
|
526
515
|
assert_equal 'Soundform', pls[7].title
|
527
516
|
|
528
|
-
assert_raise(MPD::
|
517
|
+
assert_raise(MPD::ServerError) {@mpd.moveid(999,1)}
|
529
518
|
|
530
519
|
@mpd.disconnect
|
531
|
-
assert_raise(MPD::
|
520
|
+
assert_raise(MPD::ServerError) {@mpd.moveid(10,1)}
|
532
521
|
|
533
522
|
end
|
534
523
|
|
@@ -546,7 +535,7 @@ class MPDTester < Test::Unit::TestCase
|
|
546
535
|
assert_equal pos + 1, @mpd.status['song'].to_i
|
547
536
|
|
548
537
|
@mpd.disconnect
|
549
|
-
assert_raise(MPD::
|
538
|
+
assert_raise(MPD::ServerError) {@mpd.next}
|
550
539
|
end
|
551
540
|
|
552
541
|
def test_pause
|
@@ -573,19 +562,19 @@ class MPDTester < Test::Unit::TestCase
|
|
573
562
|
assert !@mpd.paused?
|
574
563
|
|
575
564
|
@mpd.disconnect
|
576
|
-
assert_raise(MPD::
|
577
|
-
assert_raise(MPD::
|
565
|
+
assert_raise(MPD::ServerError) {@mpd.pause = true}
|
566
|
+
assert_raise(MPD::ServerError) {@mpd.paused?}
|
578
567
|
end
|
579
568
|
|
580
569
|
def test_password
|
581
570
|
@mpd.connect
|
582
571
|
|
583
|
-
assert_raise(MPD::
|
572
|
+
assert_raise(MPD::ServerError) {@mpd.password('wrong')}
|
584
573
|
|
585
574
|
assert @mpd.password('test')
|
586
575
|
|
587
576
|
@mpd.disconnect
|
588
|
-
assert_raise(MPD::
|
577
|
+
assert_raise(MPD::ServerError) {@mpd.password('test')}
|
589
578
|
end
|
590
579
|
|
591
580
|
def test_ping
|
@@ -594,7 +583,7 @@ class MPDTester < Test::Unit::TestCase
|
|
594
583
|
assert @mpd.ping
|
595
584
|
|
596
585
|
@mpd.disconnect
|
597
|
-
assert_raise(MPD::
|
586
|
+
assert_raise(MPD::ServerError) {@mpd.ping}
|
598
587
|
end
|
599
588
|
|
600
589
|
def test_play
|
@@ -624,8 +613,8 @@ class MPDTester < Test::Unit::TestCase
|
|
624
613
|
assert_equal 'Flying Into A Star', song.title
|
625
614
|
|
626
615
|
@mpd.disconnect
|
627
|
-
assert_raise(MPD::
|
628
|
-
assert_raise(MPD::
|
616
|
+
assert_raise(MPD::ServerError) {@mpd.play}
|
617
|
+
assert_raise(MPD::ServerError) {@mpd.playing?}
|
629
618
|
end
|
630
619
|
|
631
620
|
def test_playid
|
@@ -655,8 +644,8 @@ class MPDTester < Test::Unit::TestCase
|
|
655
644
|
assert_equal 'Flying Into A Star', song.title
|
656
645
|
|
657
646
|
@mpd.disconnect
|
658
|
-
assert_raise(MPD::
|
659
|
-
assert_raise(MPD::
|
647
|
+
assert_raise(MPD::ServerError) {@mpd.playid}
|
648
|
+
assert_raise(MPD::ServerError) {@mpd.playing?}
|
660
649
|
|
661
650
|
end
|
662
651
|
|
@@ -674,7 +663,7 @@ class MPDTester < Test::Unit::TestCase
|
|
674
663
|
assert_equal 9, ver
|
675
664
|
|
676
665
|
@mpd.disconnect
|
677
|
-
assert_raise(MPD::
|
666
|
+
assert_raise(MPD::ServerError) {@mpd.playlist_version}
|
678
667
|
end
|
679
668
|
|
680
669
|
def test_playlist
|
@@ -700,7 +689,7 @@ class MPDTester < Test::Unit::TestCase
|
|
700
689
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[7].title
|
701
690
|
|
702
691
|
@mpd.disconnect
|
703
|
-
assert_raise(MPD::
|
692
|
+
assert_raise(MPD::ServerError) {@mpd.playlist}
|
704
693
|
end
|
705
694
|
|
706
695
|
def test_song_at_pos
|
@@ -717,10 +706,10 @@ class MPDTester < Test::Unit::TestCase
|
|
717
706
|
assert_equal 'Liquid Sun', @mpd.song_at_pos(6).title
|
718
707
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', @mpd.song_at_pos(7).title
|
719
708
|
|
720
|
-
assert_raise(MPD::
|
709
|
+
assert_raise(MPD::ServerError) {@mpd.song_at_pos(999)}
|
721
710
|
|
722
711
|
@mpd.disconnect
|
723
|
-
assert_raise(MPD::
|
712
|
+
assert_raise(MPD::ServerError) {@mpd.song_at_pos(0)}
|
724
713
|
end
|
725
714
|
|
726
715
|
def test_song_with_id
|
@@ -737,10 +726,10 @@ class MPDTester < Test::Unit::TestCase
|
|
737
726
|
assert_equal 'Liquid Sun', @mpd.song_with_id(13).title
|
738
727
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', @mpd.song_with_id(14).title
|
739
728
|
|
740
|
-
assert_raise(MPD::
|
729
|
+
assert_raise(MPD::ServerError) {@mpd.song_with_id(999)}
|
741
730
|
|
742
731
|
@mpd.disconnect
|
743
|
-
assert_raise(MPD::
|
732
|
+
assert_raise(MPD::ServerError) {@mpd.song_with_id(10)}
|
744
733
|
end
|
745
734
|
|
746
735
|
def test_playlist_changes
|
@@ -770,7 +759,7 @@ class MPDTester < Test::Unit::TestCase
|
|
770
759
|
assert_equal 8, changes.size
|
771
760
|
|
772
761
|
@mpd.disconnect
|
773
|
-
assert_raise(MPD::
|
762
|
+
assert_raise(MPD::ServerError) {@mpd.playlist_changes(9)}
|
774
763
|
end
|
775
764
|
|
776
765
|
def test_previous
|
@@ -791,7 +780,7 @@ class MPDTester < Test::Unit::TestCase
|
|
791
780
|
assert_equal pos - 1, @mpd.status['song'].to_i
|
792
781
|
|
793
782
|
@mpd.disconnect
|
794
|
-
assert_raise(MPD::
|
783
|
+
assert_raise(MPD::ServerError) {@mpd.previous}
|
795
784
|
end
|
796
785
|
|
797
786
|
def test_random
|
@@ -804,8 +793,8 @@ class MPDTester < Test::Unit::TestCase
|
|
804
793
|
assert !@mpd.random?
|
805
794
|
|
806
795
|
@mpd.disconnect
|
807
|
-
assert_raise(MPD::
|
808
|
-
assert_raise(MPD::
|
796
|
+
assert_raise(MPD::ServerError) {@mpd.random = false}
|
797
|
+
assert_raise(MPD::ServerError) {@mpd.random?}
|
809
798
|
end
|
810
799
|
|
811
800
|
def test_repeat
|
@@ -818,8 +807,8 @@ class MPDTester < Test::Unit::TestCase
|
|
818
807
|
assert !@mpd.repeat?
|
819
808
|
|
820
809
|
@mpd.disconnect
|
821
|
-
assert_raise(MPD::
|
822
|
-
assert_raise(MPD::
|
810
|
+
assert_raise(MPD::ServerError) {@mpd.repeat = false}
|
811
|
+
assert_raise(MPD::ServerError) {@mpd.repeat?}
|
823
812
|
end
|
824
813
|
|
825
814
|
def test_rm
|
@@ -833,10 +822,10 @@ class MPDTester < Test::Unit::TestCase
|
|
833
822
|
|
834
823
|
assert_equal 'Shpongle_-_Are_You_Shpongled', pls[0]
|
835
824
|
|
836
|
-
assert_raise(MPD::
|
825
|
+
assert_raise(MPD::ServerError) {@mpd.rm('Not-Exist')}
|
837
826
|
|
838
827
|
@mpd.disconnect
|
839
|
-
assert_raise(MPD::
|
828
|
+
assert_raise(MPD::ServerError) {@mpd.rm('Astral_Projection_-_Dancing_Galaxy')}
|
840
829
|
end
|
841
830
|
|
842
831
|
def test_save
|
@@ -872,7 +861,7 @@ class MPDTester < Test::Unit::TestCase
|
|
872
861
|
assert_equal '... and the Day Turned to Night', pls[14].title
|
873
862
|
|
874
863
|
@mpd.disconnect
|
875
|
-
assert_raise(MPD::
|
864
|
+
assert_raise(MPD::ServerError) {@mpd.save('test')}
|
876
865
|
end
|
877
866
|
|
878
867
|
def test_search
|
@@ -908,10 +897,10 @@ class MPDTester < Test::Unit::TestCase
|
|
908
897
|
z = @mpd.search 'title', 'no-title'
|
909
898
|
assert_equal 0, z.size
|
910
899
|
|
911
|
-
assert_raise(MPD::
|
900
|
+
assert_raise(MPD::ServerError) {@mpd.search('error', 'nosuch')}
|
912
901
|
|
913
902
|
@mpd.disconnect
|
914
|
-
assert_raise(MPD::
|
903
|
+
assert_raise(MPD::ServerError) {@mpd.search('artist','searching')}
|
915
904
|
end
|
916
905
|
|
917
906
|
def test_seek
|
@@ -940,7 +929,7 @@ class MPDTester < Test::Unit::TestCase
|
|
940
929
|
assert_equal '200:585', status['time']
|
941
930
|
|
942
931
|
@mpd.disconnect
|
943
|
-
assert_raise(MPD::
|
932
|
+
assert_raise(MPD::ServerError) {@mpd.seek(1, 100)}
|
944
933
|
end
|
945
934
|
|
946
935
|
def test_seekid
|
@@ -969,7 +958,7 @@ class MPDTester < Test::Unit::TestCase
|
|
969
958
|
assert_equal '200:585', status['time']
|
970
959
|
|
971
960
|
@mpd.disconnect
|
972
|
-
assert_raise(MPD::
|
961
|
+
assert_raise(MPD::ServerError) {@mpd.seekid(1, 100)}
|
973
962
|
end
|
974
963
|
|
975
964
|
def test_volume
|
@@ -984,8 +973,8 @@ class MPDTester < Test::Unit::TestCase
|
|
984
973
|
assert_equal vol, @mpd.volume
|
985
974
|
|
986
975
|
@mpd.disconnect
|
987
|
-
assert_raise(MPD::
|
988
|
-
assert_raise(MPD::
|
976
|
+
assert_raise(MPD::ServerError) {@mpd.volume = 10}
|
977
|
+
assert_raise(MPD::ServerError) {@mpd.volume}
|
989
978
|
end
|
990
979
|
|
991
980
|
def test_shuffle
|
@@ -1001,7 +990,7 @@ class MPDTester < Test::Unit::TestCase
|
|
1001
990
|
assert_not_equal 'Dancing Galaxy', pls[0].title
|
1002
991
|
|
1003
992
|
@mpd.disconnect
|
1004
|
-
assert_raise(MPD::
|
993
|
+
assert_raise(MPD::ServerError) {@mpd.shuffle}
|
1005
994
|
end
|
1006
995
|
|
1007
996
|
def test_stats
|
@@ -1015,7 +1004,7 @@ class MPDTester < Test::Unit::TestCase
|
|
1015
1004
|
assert_equal '500', stats['uptime']
|
1016
1005
|
|
1017
1006
|
@mpd.disconnect
|
1018
|
-
assert_raise(MPD::
|
1007
|
+
assert_raise(MPD::ServerError) {@mpd.stats}
|
1019
1008
|
end
|
1020
1009
|
|
1021
1010
|
def test_status
|
@@ -1028,7 +1017,7 @@ class MPDTester < Test::Unit::TestCase
|
|
1028
1017
|
assert_equal '0', status['random']
|
1029
1018
|
|
1030
1019
|
@mpd.disconnect
|
1031
|
-
assert_raise(MPD::
|
1020
|
+
assert_raise(MPD::ServerError) {@mpd.status}
|
1032
1021
|
end
|
1033
1022
|
|
1034
1023
|
def test_stop
|
@@ -1046,8 +1035,8 @@ class MPDTester < Test::Unit::TestCase
|
|
1046
1035
|
assert !@mpd.playing?
|
1047
1036
|
|
1048
1037
|
@mpd.disconnect
|
1049
|
-
assert_raise(MPD::
|
1050
|
-
assert_raise(MPD::
|
1038
|
+
assert_raise(MPD::ServerError) {@mpd.stop}
|
1039
|
+
assert_raise(MPD::ServerError) {@mpd.stopped?}
|
1051
1040
|
end
|
1052
1041
|
|
1053
1042
|
def test_swap
|
@@ -1081,10 +1070,10 @@ class MPDTester < Test::Unit::TestCase
|
|
1081
1070
|
assert_equal 'Liquid Sun', pls[6].title
|
1082
1071
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[1].title
|
1083
1072
|
|
1084
|
-
assert_raise(MPD::
|
1073
|
+
assert_raise(MPD::ServerError) {@mpd.swap(999,1)}
|
1085
1074
|
|
1086
1075
|
@mpd.disconnect
|
1087
|
-
assert_raise(MPD::
|
1076
|
+
assert_raise(MPD::ServerError) {@mpd.swap(2, 5)}
|
1088
1077
|
end
|
1089
1078
|
|
1090
1079
|
def test_swapid
|
@@ -1118,10 +1107,10 @@ class MPDTester < Test::Unit::TestCase
|
|
1118
1107
|
assert_equal 'Liquid Sun', pls[6].title
|
1119
1108
|
assert_equal 'Ambient Galaxy (Disco Valley Mix)', pls[1].title
|
1120
1109
|
|
1121
|
-
assert_raise(MPD::
|
1110
|
+
assert_raise(MPD::ServerError) {@mpd.swapid(999,8)}
|
1122
1111
|
|
1123
1112
|
@mpd.disconnect
|
1124
|
-
assert_raise(MPD::
|
1113
|
+
assert_raise(MPD::ServerError) {@mpd.swapid(9, 12)}
|
1125
1114
|
end
|
1126
1115
|
|
1127
1116
|
def test_update
|
@@ -1140,6 +1129,6 @@ class MPDTester < Test::Unit::TestCase
|
|
1140
1129
|
assert_nil status['updating_db']
|
1141
1130
|
|
1142
1131
|
@mpd.disconnect
|
1143
|
-
assert_raise(MPD::
|
1132
|
+
assert_raise(MPD::ServerError) {@mpd.update}
|
1144
1133
|
end
|
1145
1134
|
end
|