diff options
| author | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-08-01 13:10:30 -0700 | 
|---|---|---|
| committer | David Vazgenovich Shakaryan <dvshakaryan@gmail.com> | 2009-08-01 13:10:30 -0700 | 
| commit | a5b89802ef7614b214e92a1e6b03ebc17e3557b5 (patch) | |
| tree | 3666470265f4481810d5f6474dde6d5ffe032ae0 /libmpd | |
| parent | 86d08df03202ac183c1f38b47765f2a4cfcafd72 (diff) | |
| download | ruby-libmpd-a5b89802ef7614b214e92a1e6b03ebc17e3557b5.tar.gz ruby-libmpd-a5b89802ef7614b214e92a1e6b03ebc17e3557b5.tar.xz | |
Various cleanup.
Diffstat (limited to 'libmpd')
| -rw-r--r-- | libmpd/database.rb | 16 | ||||
| -rw-r--r-- | libmpd/playbackcontrol.rb | 1 | ||||
| -rw-r--r-- | libmpd/playlist.rb | 23 | ||||
| -rw-r--r-- | libmpd/status.rb | 6 | 
4 files changed, 23 insertions, 23 deletions
| diff --git a/libmpd/database.rb b/libmpd/database.rb index c71c517..00cc693 100644 --- a/libmpd/database.rb +++ b/libmpd/database.rb @@ -13,31 +13,31 @@  module MPDDatabase    # Counts the number of songs in the database where _field_ is _value_, as    # well as their total playtime. -  def count field, value -    return generate_hash send_request 'count %s "%s"' % [field, value] +  def count(field, value) +    return generate_hash(send_request('count %s "%s"' % [field, value]))    end    # Finds all songs in the database where _field_ is _value_.    #    # Possible field names: album, artist, title. -  def find field, value -    return split_and_hash send_request 'find %s "%s"' % [field, value] +  def find(field, value) +    return split_and_hash(send_request('find %s "%s"' % [field, value]))    end    # Finds all songs in the database where _field_ contains _value_.    # Matching is not case-sensitive.    #    # Possible field names: album, artist, filename, title. -  def search field, value -    return split_and_hash send_request 'search %s "%s"' % [field, value] +  def search(field, value) +    return split_and_hash(send_request('search %s "%s"' % [field, value]))    end    # Updates the database.    # If an argument is given, update that particular file or directory. -  def update uri=nil +  def update(uri=nil)      command = 'update'      command << ' "%s"' % uri if uri -    return send_request command +    return send_request(command)    end  end diff --git a/libmpd/playbackcontrol.rb b/libmpd/playbackcontrol.rb index a9a3d96..1e7a9c4 100644 --- a/libmpd/playbackcontrol.rb +++ b/libmpd/playbackcontrol.rb @@ -62,6 +62,7 @@ module MPDPlaybackControl    end    # Seeks to the given position of the current song. +  # Accepts an argument of seconds.    def seek(time)      return send_request('seek %s %s' % [status[:song], time])    end diff --git a/libmpd/playlist.rb b/libmpd/playlist.rb index 1b591c6..000f9c9 100644 --- a/libmpd/playlist.rb +++ b/libmpd/playlist.rb @@ -11,36 +11,35 @@  # Collection of methods related to the playlist.  module MPDPlaylist -  # Adds the specified file to the playlist. (Directories add recursively.) -  def add uri -    return send_request 'add "%s"' % uri +  # Adds the specified file to the playlist. +  # Directories add recursively. +  def add(uri) +    return send_request('add "%s"' % uri)    end    # Deletes a song from the playlist. -  def delete songpos -    return send_request 'delete ' + songpos.to_s +  def delete(songpos) +    return send_request('delete %s' % songpos)    end    # Clears the playlist.    def clear -    return send_request 'clear' +    return send_request('clear')    end    # Returns an Array composed of Hashes containing information about the songs    # in the playlist. -  # -  # Not yet complete. -  def playlistinfo -    return split_and_hash send_request 'playlistinfo' +  def playlist +    return 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] +    return 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] +    return send_request('swapid %s %s' % [first, second])    end  end diff --git a/libmpd/status.rb b/libmpd/status.rb index 639edb4..b86c135 100644 --- a/libmpd/status.rb +++ b/libmpd/status.rb @@ -13,16 +13,16 @@  module MPDStatus    # Returns a Hash containing information about the current song.    def currentsong -    return generate_hash send_request 'currentsong' +    return generate_hash(send_request('currentsong'))    end    # Returns a Hash containing the current status.    def status -    return generate_hash send_request 'status' +    return generate_hash(send_request('status'))    end    # Returns a Hash containing statistics.    def stats -    return generate_hash send_request 'stats' +    return generate_hash(send_request('stats'))    end  end | 
