DB

This subclass is used to interact with and retrieve information from MPD's database.

MphpD::db() : DB

Methods

__construct

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

Parameters

Returns mixed

albumart

Returns the albumart (binary!) for given song.

DB::albumart(string $songuri) : mixed

Parameters

Returns mixed

false|string binary string on success or false on failure.

count

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

Parameters

Returns mixed

array|false array on success or false on failure.

fingerprint

Calculate the song's fingerprint

DB::fingerprint(string $uri) : mixed

Parameters

Returns mixed

string|false fingerprint on success or false on failure.

find

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

Parameters

Returns mixed

array|false array on success and false on failure.

list

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

Parameters

Returns mixed

array|false array on success or false on failure.

ls

List files,directories and playlists in $uri

DB::ls(string $uri, bool $metadata = , bool $recursive = ) : mixed

Parameters

Returns mixed

array|false array containing the keys files, directories and playlists on success or false on failure.

read_comments

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

Parameters

Returns mixed

array|false array on success or false on failure.

get_picture

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

Parameters

Returns mixed

array|false Returns false on failure and an associative array containing size,type and (optionally) binary on success.

read_picture

Returns a picture of $uri by reading embedded pictures from binary tags.

DB::read_picture(string $uri) : mixed

Parameters

Returns 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.

search

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

Parameters

Returns mixed

array|false array on success or false on failure.

update

Update the Database and return the Job-ID.

DB::update(string $uri = '', bool $rescan = , bool $force = ) : mixed

Parameters

Returns mixed

int|false Job-ID on success or false on failure.

© 2023 Florian Faber