diff options
author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-07-06 16:09:47 -0700 |
---|---|---|
committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2014-07-06 16:09:47 -0700 |
commit | 602cbf21d35ba898841cac0f3c458bd90b6b6841 (patch) | |
tree | 0d8b282562d866ff70d833666a383a50d6714f4e /libmpd/playlist.rb | |
parent | 4ebf4d0b5e8de5a79efa3811eb35ac8b85f26b07 (diff) | |
download | ruby-libmpd-602cbf21d35ba898841cac0f3c458bd90b6b6841.tar.gz ruby-libmpd-602cbf21d35ba898841cac0f3c458bd90b6b6841.tar.xz |
Style changes and simpler code.
Diffstat (limited to 'libmpd/playlist.rb')
-rw-r--r-- | libmpd/playlist.rb | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libmpd/playlist.rb b/libmpd/playlist.rb index cc5db9f..d4be0b8 100644 --- a/libmpd/playlist.rb +++ b/libmpd/playlist.rb @@ -1,7 +1,7 @@ #!/usr/bin/env ruby # #-- -# Copyright 2009 David Vazgenovich Shakaryan <dvshakaryan@gmail.com> +# Copyright 2009-2014 David Vazgenovich Shakaryan <dvshakaryan@gmail.com> # Distributed under the terms of the GNU General Public License v3. # See http://www.gnu.org/licenses/gpl.txt for the full license text. #++ @@ -14,46 +14,46 @@ module MPDPlaylist # Adds the specified file to the playlist. # Directories add recursively. def add(uri) - return send_request('add "%s"' % uri) + send_request('add "%s"' % uri) end # Adds the specified file to the playlist and returns the song id. # An optional playlist position can be specified. - def addid(uri, position=nil) + def addid(uri, position = nil) command = 'addid "%s"' % uri command << ' %s' % position if position - return send_request(command).scan(/\d+/).first.to_i + send_request(command).scan(/\d+/).first.to_i end # Clears the playlist. def clear - return send_request('clear') + send_request('clear') end # Deletes a song from the playlist. def delete(songpos) - return send_request('delete %s' % songpos) + send_request('delete %s' % songpos) end # Deletes a song from the playlist. def deleteid(songid) - return send_request('deleteid %s' % songid) + send_request('deleteid %s' % songid) end # Returns an Array composed of Hashes containing information about the songs # in the playlist. def playlist - return split_and_hash(send_request('playlistinfo')) + split_and_hash(send_request('playlistinfo')) end # Swaps the positions of the given songs, specified by playlist positions. - def swap first, second - return send_request('swap %s %s' % [first, second]) + def swap(first, second) + send_request('swap %s %s' % [first, second]) end # Swaps the positions of the given songs, specified by song ids. - def swapid first, second - return send_request('swapid %s %s' % [first, second]) + def swapid(first, second) + send_request('swapid %s %s' % [first, second]) end end |