This subclass is used to interact with and retrieve information from MPD's database.
MphpD::db() : DB
This class is not intended for direct usage. Use MphpD::db() instead to retrieve an instance of this class.
DB::__construct(FloFaber\MphpD\MphpD $mphpd) : mixed
@param \MphpD $mphpd
mixed
Returns the albumart (binary!) for given song.
DB::albumart(string $songuri) : mixed
@param string $songuri
mixed
false|string Returns binary data on success or false on failure.
Counts the number of songs and their playtime matching the specified Filter. If $group is omitted returns an associative array containing a "songs" and "playtime" key. If $group is specified an array of associative array will be returned.
DB::count(FloFaber\MphpD\Filter $filter, string $group = '') : mixed
@param \Filter $filter
@param string $group A tag name like artist. If specified the results will be grouped by this tag.
mixed
array|false
Calculate the song's fingerprint
DB::fingerprint(string $uri) : mixed
@param string $uri
mixed
string|false Returns the fingerprint on success or false on failure.
Search for songs matching Filter and return an array of associative array of found songs. Case-sensitive!
DB::find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
@param \Filter $filter
@param string $sort Tag name to sort by. Like artist. If prefixed with - it will be sorted descending.
If omitted the order is undefined.
@param array $window Retrieve only a given portion
mixed
array|false Returns array on success and false on failure.
Lists unique tags values of the specified type. $type can be any tag supported by MPD.
If group is omitted returns an array of unique tag values of the specified type.
If group is specified returns an array of associative arrays containing the grouped result.
DB::list(string $type, ?FloFaber\MphpD\Filter $filter = null, string $group = '') : mixed
@param string $type Any tag supported by MPD. Like artist or album.
@param \Filter|null $filter
@param string $group Tag name to group the result by. Like artist or album.
mixed
array|false
List files,directories and playlists in $uri
DB::ls(string $uri, bool $metadata = , bool $recursive = ) : mixed
@param string $uri
@param bool $metadata Specifies if additional information should be included.
@param bool $recursive Specified if files and directories should be listed recursively.
mixed
array|false Returns an array containing the keys files, directories and playlists on success and false on failure.
Read "comments" from the specified file. The meaning of these "comments" depend on the codec. For an OGG file this lists the vorbis commands.
DB::read_comments(string $uri) : mixed
@param string $uri
mixed
array|false
Returns a picture of $uri by reading embedded pictures from binary tags.
DB::read_picture(string $uri) : mixed
@param string $uri
mixed
false|string Binary data on success and false on failure.
Searches for matching songs and returns an array of associative arrays containing song information. NOT case-sensitive!
DB::search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
@param \Filter $filter
@param string $sort
@param array $window
mixed
array|false
Update the Database and return the Job-ID.
DB::update(string $uri = '', bool $rescan = , bool $force = ) : mixed
@param string $uri Optional. Only update the given path. Omit or specify an empty string to update everything.
@param bool $rescan If set to true also rescan unmodified files.
@param bool $force If set to false and an update Job is already running, just return its ID.
If true and an update Job is already running it starts another one and returns the ID of the new Job.
mixed
int|false Returns the Job-ID on success or false on failure.