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
mixed
Returns the albumart (binary!) for given song.
DB::albumart(string $songuri) : mixed
mixed
false|string binary string
on success or false
on failure.
Counts the number of songs and their playtime matching the specified Filter.
DB::count(FloFaber\MphpD\Filter $filter, string $group = '', bool $case_sensitive = 1) : mixed
A tag name like artist
by which the results will be grouped.
If omitted returns an associative array containing a "songs" and "playtime" key.
If specified an array of associative array will be returned.
If true
the search will be case-sensitive, If false
the search will be case-insensitive.
mixed
array|false array
on success or false
on failure.
Calculate the song's fingerprint
DB::fingerprint(string $uri) : mixed
URI to the file.
mixed
string|false fingerprint on success or false
on failure.
Case-sensitive search for songs matching Filter and return an array of associative array of found songs.
DB::find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
Tag name to sort by. Like artist. If prefixed with -
it will be sorted descending.
If omitted the order is undefined.
Retrieve only a given portion
mixed
array|false array
on success and false
on failure.
Lists unique tags values of the specified type. $type
can be any tag supported by MPD.
DB::list(string $type, ?FloFaber\MphpD\Filter $filter = null, string $group = '') : mixed
Any tag supported by MPD. Like artist or album.
Tag name by which the result gets grouped. Like artist or album.
If omitted returns an array of unique tag values of the specified type.
If specified returns an array of associative arrays containing the grouped result.
mixed
array|false array
on success or false
on failure.
List files,directories and playlists in $uri
DB::ls(string $uri, bool $metadata = , bool $recursive = ) : mixed
Directory URI.
Specifies if additional information should be included.
Specified if files and directories should be listed recursively.
mixed
array|false array
containing the keys files
, directories
and playlists
on success or 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
Song URI.
mixed
array|false array
on success or false
on failure.
Returns data and content of a picture embedded in $uri
.
If $uri
is not found the function returns false
.
If $uri
is found but does not contain a picture the function will return [ "size" => 0, "type" => null, "binary" => null ]
.
If $uri
is found and contains a picture the returned array will contain information about the picture and
if $include_binary
is true
the array also contains the picture itself.
DB::get_picture(string $uri, bool $include_binary = 1) : mixed
Song URI.
If true
the array's binary
-item will contain the picture. If false
the array's binary
-item is null
.
mixed
array|false Returns false
on failure and an associative array containing size
,type
and (optionally) binary
on success.
Returns a picture of $uri
by reading embedded pictures from binary tags.
DB::read_picture(string $uri) : mixed
Song URI.
mixed
false|string false
on failure otherwise string
containing either the picture or an empty string in case the file does not contain a picture.
Case-INsensitive search for matching songs and returns an array of associative arrays containing song information.
DB::search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
mixed
array|false array
on success or false
on failure.
Update the Database and return the Job-ID.
DB::update(string $uri = '', bool $rescan = , bool $force = ) : mixed
Optional. Only update the given path. Omit or specify an empty string to update everything.
If set to true
also rescan unmodified files.
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 Job-ID on success or false
on failure.