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

@param \MphpD $mphpd

Returns mixed

albumart

Returns the albumart (binary!) for given song.

DB::albumart(string $songuri) : mixed

Parameters

@param string $songuri

Returns mixed

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

count

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

Parameters

@param \Filter $filter

@param string $group A tag name like artist. If specified the results will be grouped by this tag.

Returns mixed

array|false

fingerprint

Calculate the song's fingerprint

DB::fingerprint(string $uri) : mixed

Parameters

@param string $uri

Returns mixed

string|false Returns the fingerprint on success or false on failure.

find

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

Parameters

@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

Returns mixed

array|false Returns array on success and false on failure.

list

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

Parameters

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

Returns mixed

array|false

ls

List files,directories and playlists in $uri

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

Parameters

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

Returns mixed

array|false Returns an array containing the keys files, directories and playlists on success and 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

@param string $uri

Returns mixed

array|false

read_picture

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

DB::read_picture(string $uri) : mixed

Parameters

@param string $uri

Returns mixed

false|string Binary data on success and false on failure.

search

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

Parameters

@param \Filter $filter

@param string $sort

@param array $window

Returns mixed

array|false

update

Update the Database and return the Job-ID.

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

Parameters

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

Returns mixed

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

© 2023 Florian Faber