Module: MPD::Plugins::Database
- Included in:
- MPD
- Defined in:
- lib/ruby-mpd/plugins/database.rb
Overview
Commands for interacting with the music database.
Changes: listallinfo -> songs
Instance Method Summary collapse
-
#count(type, what) ⇒ Hash
Counts the number of songs and their total playtime in the db matching, matching the searched tag exactly.
-
#find(type, what) ⇒ Array<MPD::Song>
Finds songs in the database that are EXACTLY matched by the what argument.
-
#list(type, arg = nil) ⇒ Array<String>
List all tags of the specified type.
-
#rescan(path = nil) ⇒ Integer
Same as #update, but also rescans unmodified files.
-
#search(type, what) ⇒ Array<MPD::Song>
Searches for any song that contains
what
in thetype
field. -
#songs(path = nil) ⇒ Array<MPD::Song>
List all of the songs in the database starting at path.
-
#update(path = nil) ⇒ Integer
Tell the server to update the database.
Instance Method Details
#count(type, what) ⇒ Hash
Counts the number of songs and their total playtime in the db matching, matching the searched tag exactly.
11 12 13 |
# File 'lib/ruby-mpd/plugins/database.rb', line 11 def count(type, what) send_command :count, type, what end |
#find(type, what) ⇒ Array<MPD::Song>
Finds songs in the database that are EXACTLY matched by the what argument.
22 23 24 |
# File 'lib/ruby-mpd/plugins/database.rb', line 22 def find(type, what) build_songs_list send_command(:find, type, what) end |
#list(type, arg = nil) ⇒ Array<String>
List all tags of the specified type. Type can be any tag supported by MPD or :file
. If type is ‘album’ then arg can be a specific artist to list the albums for
33 34 35 |
# File 'lib/ruby-mpd/plugins/database.rb', line 33 def list(type, arg = nil) send_command :list, type, arg end |
#rescan(path = nil) ⇒ Integer
Same as #update, but also rescans unmodified files.
73 74 75 |
# File 'lib/ruby-mpd/plugins/database.rb', line 73 def rescan(path = nil) send_command :rescan, path end |
#search(type, what) ⇒ Array<MPD::Song>
Searches for any song that contains what
in the type
field. Searches are NOT case sensitive.
54 55 56 |
# File 'lib/ruby-mpd/plugins/database.rb', line 54 def search(type, what) build_songs_list(send_command(:search, type, what)) end |
#songs(path = nil) ⇒ Array<MPD::Song>
List all of the songs in the database starting at path. If path isn’t specified, the root of the database is used
43 44 45 |
# File 'lib/ruby-mpd/plugins/database.rb', line 43 def songs(path = nil) build_songs_list send_command(:listallinfo, path) end |
#update(path = nil) ⇒ Integer
Tell the server to update the database. Optionally, specify the path to update.
66 67 68 |
# File 'lib/ruby-mpd/plugins/database.rb', line 66 def update(path = nil) send_command :update, path end |