-
Notifications
You must be signed in to change notification settings - Fork 0
Web Methods Library
These methods inspect and manipulate the music library.
Library Listing Methods ------------------- These methods query the music library for information. They do not alter the status of the queue or playback. ##libraryList [Back to top][top]libraryList()
Get the contents of the root directory of the music library. This will include names of saved playlists and subdirectories.
libraryList(path)
Get the contents of directory path in the music library. This will include names of subdirectories.
Example Usage
code
xml = XMLRPC.libraryList()
json = JSONRPC2('libraryList', [])
code
xml = XMLRPC.libraryList('Misc/')
json = JSONRPC2('libraryList', ['Misc/'])
result
[
{
"album": "Frieden",
"artist": "Extrabreit",
"track": "12/13",
"title": "Sch\u00f6nes Lied",
"disc": null,
"file": "Misc/lied.mp3",
"time": 195,
"id": 23
},
{
"directory": "Misc/Queen"
},
{
"playlist": "Rockout Workout"
},
...
]
libraryListAll()
Get a list of all songs in the music library. This can be very long, use with caution.
Example Usage
code
xml = XMLRPC.libraryListAll()
json = JSONRPC2('libraryListAll', [])
result
[
{
"album": "Frieden",
"artist": "Extrabreit",
"track": "12/13",
"title": "Sch\u00f6nes Lied",
"disc": null,
"file": "Misc/lied.mp3",
"time": 195,
"id": 23
},
{
...
},
...
]
libraryStats()
Get some statistics about the music library.
- artists: Number of unique metadata artists in the music library
- albums: Number of unique metadata albums in the music library
- songs: Number of music files in the music library
- uptime: Seconds since mpd started.
- playtime: Seconds spent playing since mpd started.
- db_update: Time since last library update in seconds sing the Unix epoch
- db_playtime: Total playtime of all songs in library in seconds
Example Usage
code
xml = XMLRPC.libraryStats()
json = JSONRPC2('libraryStats', [])
result
{
"uptime": 531832,
"db_update": 1338564705,
"artists": 804,
"playtime": 5572,
"albums": 685,
"db_playtime": 1315316,
"songs": 6770
}
The searching is performed against metadata from the songs. Not all codecs can encode all types of metadata. The following types of metadata are currently recognized:
-
artist- The name of the artist. -
album- The name of the album from which the song is taken. -
title- The title of the song. -
track- The track number of the song. -
name- The name of an audio stream. -
genre- Keywords that place the song in one or more aesthetic brackets. -
date- The date the song was recorded or released. -
composer- The composer of the song. -
performer- The principal soloist or performer. -
disc- The disc number in an album set. -
filename- The file name/path of the song in the music library. -
any- Match any of the above types.
libraryFind(type, needle)
Get a list of songs where needle exactly, case sensitive, matches metadata type
Example Usage
code
xml = XMLRPC.libraryFind('artist', 'Extrabreit')
json = JSONRPC2('libraryFind', ['artist', 'Extrabreit'])
result
[
{
"album": "Frieden",
"artist": "Extrabreit",
"track": "12/13",
"title": "Sch\u00f6nes Lied",
"disc": null,
"file": "Misc/lied.mp3",
"time": 195,
"id": 23
},
{
...
},
...
]
librarySearch(type, needle)
Get a list of songs where metadata type contains, case insensitive, needle.
Example Usage
code
xml = XMLRPC.librarySearch('title', 'lied')
json = JSONRPC2('librarySearch', ['title', 'lied'])
result
[
{
"album": "Frieden",
"artist": "Extrabreit",
"track": "12/13",
"title": "Sch\u00f6nes Lied",
"disc": null,
"file": "Misc/lied.mp3",
"time": 195,
"id": 23
},
{
...
},
...
]
libraryUpdate()
Look for changes in the music library, return the job id of the update operation.
libraryUpdate(path)
Look for changes in the music library under directory path, return the job id of the update operation.
Example Usage
code
xml = XMLRPC.libraryUpdate()
json = JSONRPC2('libraryUpdate', [])
code
xml = XMLRPC.libraryUpdate('Misc/')
json = JSONRPC2('libraryUpdate', ['Misc/'])
result
"1"
libraryRescan()
Rescan music library, refreshing metadata from music files. Return the job id of the rescan operation.
libraryRescan(path)
Rescan music library under directory path, refreshing metadata from music files. Return job id of the rescan operation.
Example Usage
code
xml = XMLRPC.libraryRescan()
json = JSONRPC2('libraryRescan', [])
code
xml = XMLRPC.libraryRescan('Misc/')
json = JSONRPC2('libraryRescan', ['Misc/'])
result
"2"