From b1cf2dfe340e787b731bb9f6da6c75a236d45b2e Mon Sep 17 00:00:00 2001 From: Flo Faber Date: Sat, 14 Sep 2024 13:41:04 +0200 Subject: [PATCH] v1.2.6 --- CHANGELOG.md | 7 + docs/js/versions.js | 2 +- docs/v1.2.6/classes/Channel.html | 144 ++++ docs/v1.2.6/classes/DB.html | 317 ++++++++ docs/v1.2.6/classes/Filter.html | 108 +++ docs/v1.2.6/classes/MPDException.html | 283 +++++++ docs/v1.2.6/classes/MphpD.html | 1083 +++++++++++++++++++++++++ docs/v1.2.6/classes/Output.html | 146 ++++ docs/v1.2.6/classes/Partition.html | 144 ++++ docs/v1.2.6/classes/Player.html | 516 ++++++++++++ docs/v1.2.6/classes/Playlist.html | 312 +++++++ docs/v1.2.6/classes/Queue.html | 564 +++++++++++++ docs/v1.2.6/classes/Socket.html | 370 +++++++++ docs/v1.2.6/classes/Sticker.html | 171 ++++ docs/v1.2.6/classes/Utils.html | 110 +++ docs/v1.2.6/guides/Commandlist.html | 52 ++ docs/v1.2.6/guides/Configuration.html | 59 ++ docs/v1.2.6/guides/Range.html | 46 ++ docs/v1.2.6/index.html | 111 +++ docs/v1.2.6/overview.html | 578 +++++++++++++ 20 files changed, 5122 insertions(+), 1 deletion(-) create mode 100644 docs/v1.2.6/classes/Channel.html create mode 100644 docs/v1.2.6/classes/DB.html create mode 100644 docs/v1.2.6/classes/Filter.html create mode 100644 docs/v1.2.6/classes/MPDException.html create mode 100644 docs/v1.2.6/classes/MphpD.html create mode 100644 docs/v1.2.6/classes/Output.html create mode 100644 docs/v1.2.6/classes/Partition.html create mode 100644 docs/v1.2.6/classes/Player.html create mode 100644 docs/v1.2.6/classes/Playlist.html create mode 100644 docs/v1.2.6/classes/Queue.html create mode 100644 docs/v1.2.6/classes/Socket.html create mode 100644 docs/v1.2.6/classes/Sticker.html create mode 100644 docs/v1.2.6/classes/Utils.html create mode 100644 docs/v1.2.6/guides/Commandlist.html create mode 100644 docs/v1.2.6/guides/Configuration.html create mode 100644 docs/v1.2.6/guides/Range.html create mode 100644 docs/v1.2.6/index.html create mode 100644 docs/v1.2.6/overview.html diff --git a/CHANGELOG.md b/CHANGELOG.md index cf121c1..8a0d93a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v1.2.6 + +### Improvements + +* `Filter` may now have empty `$tag` and `$operator` in constructor. + + ## v1.2.5 ### Fixes diff --git a/docs/js/versions.js b/docs/js/versions.js index bdf3b8f..4006157 100644 --- a/docs/js/versions.js +++ b/docs/js/versions.js @@ -1,2 +1,2 @@ // AUTOGENERATED BY build.php! -window.versions = ["v1.2.5","v1.2.4","v1.2.3","v1.2.2","v1.2.1","v1.2.0","v1.1.1","v1.1.0","v1.1.0-rc.3","v1.1.0-rc.2","v1.1.0-rc.1","v1.0.1","v1.0.0","v1.0.0-rc.2",]; \ No newline at end of file +window.versions = ["v1.2.6","v1.2.5","v1.2.4","v1.2.3","v1.2.2","v1.2.1","v1.2.0","v1.1.1","v1.1.0","v1.1.0-rc.3","v1.1.0-rc.2","v1.1.0-rc.1","v1.0.1","v1.0.0","v1.0.0-rc.2",]; \ No newline at end of file diff --git a/docs/v1.2.6/classes/Channel.html b/docs/v1.2.6/classes/Channel.html new file mode 100644 index 0000000..712dad5 --- /dev/null +++ b/docs/v1.2.6/classes/Channel.html @@ -0,0 +1,144 @@ + + + + MphpD - Channel + + + + + + + + + + +
+ +

Channel

+

This subclass is used for client-to-client communication over MPD

+ +
MphpD::channel(string $name) : Channel
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::channel() instead to retrieve an instance of this class.

+

+ +
Channel::__construct(FloFaber\MphpD\MphpD $mphpd, string $name) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • +
  • $name
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

subscribe

+

+

Subscribe to the channel.

+

+ +
Channel::subscribe() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

unsubscribe

+

+

Unsubscribe the channel.

+

+ +
Channel::unsubscribe() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

read

+

+

Returns a list of the channel's messages.

+

+ +
Channel::read() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array containing the messages on success or false on failure.

+

+
+ + +
+

send

+

+

Send a message to the channel.

+

+ +
Channel::send(string $message) : bool
+ +

Parameters

+
    +
  • $message

    The message text.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/DB.html b/docs/v1.2.6/classes/DB.html new file mode 100644 index 0000000..8753adc --- /dev/null +++ b/docs/v1.2.6/classes/DB.html @@ -0,0 +1,317 @@ + + + + MphpD - DB + + + + + + + + + + +
+ +

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

+
    +
  • $mphpd
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

albumart

+

+

Returns the albumart (binary!) for given song.

+

+ +
DB::albumart(string $songuri) : mixed
+ +

Parameters

+
    +
  • $songuri
  • + +
+ +

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

+
    +
  • $filter
  • +
  • $group

    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.

  • +
  • $case_sensitive

    If true the search will be case-sensitive, If false the search will be case-insensitive.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

fingerprint

+

+

Calculate the song's fingerprint

+

+ +
DB::fingerprint(string $uri) : mixed
+ +

Parameters

+
    +
  • $uri

    URI to the file.

  • + +
+ +

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

+
    +
  • $filter
  • +
  • $sort

    Tag name to sort by. Like artist. If prefixed with - it will be sorted descending.

    +

    If omitted the order is undefined.

  • +
  • $window

    Retrieve only a given portion

  • + +
+ +

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

+
    +
  • $type

    Any tag supported by MPD. Like artist or album.

  • +
  • $filter
  • +
  • $group

    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.

  • + +
+ +

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

+
    +
  • $uri

    Directory URI.

  • +
  • $metadata

    Specifies if additional information should be included.

  • +
  • $recursive

    Specified if files and directories should be listed recursively.

  • + +
+ +

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

+
    +
  • $uri

    Song URI.

  • + +
+ +

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

+
    +
  • $uri

    Song URI.

  • +
  • $include_binary

    If true the array's binary-item will contain the picture. If false the array's binary-item is null.

  • + +
+ +

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

+
    +
  • $uri

    Song URI.

  • + +
+ +

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

+
    +
  • $filter
  • +
  • $sort
  • +
  • $window
  • + +
+ +

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

+
    +
  • $uri

    Optional. Only update the given path. Omit or specify an empty string to update everything.

  • +
  • $rescan

    If set to true also rescan unmodified files.

  • +
  • $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 Job-ID on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Filter.html b/docs/v1.2.6/classes/Filter.html new file mode 100644 index 0000000..c203669 --- /dev/null +++ b/docs/v1.2.6/classes/Filter.html @@ -0,0 +1,108 @@ + + + + MphpD - Filter + + + + + + + + + + +
+ +

Filter

+

Filters provide a way to search for specific songs. They take care of parsing and escaping. +They are used in various other methods like DB::search, Playlist::add_search and more. +Refer to the MPD documentation for more information about filters.

+ +
new FloFaber\MphpD\Filter(string $tag, string $operator, string $value) : Filter
+ +

Methods

+ + +
+

__construct

+

+

Creates a new filter. If $tag or $operator is empty, an empty Filter is returned.

+

+ +
Filter::__construct(string $tag = '', string $operator = '', string $value = '') : mixed
+ +

Parameters

+
    +
  • $tag

    Tag to be searched for. Like artist, title,...

  • +
  • $operator

    Comparison operator. Like ==, contains, ~=,...

  • +
  • $value

    The value to search for. Unescaped.

  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

and

+

+

Used to chain multiple filters together with a logical AND. If $tag or $operator is empty, the condition is not added to the Filter.

+

+ +
Filter::and(string $tag, string $operator, string $value) : FloFaber\MphpD\Filter
+ +

Parameters

+
    +
  • $tag
  • +
  • $operator
  • +
  • $value
  • + +
+ +

Returns FloFaber\MphpD\Filter

+

+

$this

+

+
+ + +
+

__toString

+

+

Generate and return the Filter string.

+

+ +
Filter::__toString() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+

string

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/MPDException.html b/docs/v1.2.6/classes/MPDException.html new file mode 100644 index 0000000..58e9b97 --- /dev/null +++ b/docs/v1.2.6/classes/MPDException.html @@ -0,0 +1,283 @@ + + + + MphpD - MPDException + + + + + + + + + + +
+ +

MPDException

+

MPDException is a slightly modified version of a standard Exception. +You may call MPDException::getCode and MPDException::getMessage to retrieve information about the error.

+

In case an error occurs at the protocol level the called methods simply return false.

+

To retrieve the last occurred error call MphpD::get_last_error.

+ +
MphpD::get_last_error() : array
+ +

Methods

+ + +
+

__construct

+

+ +

+ +
MPDException::__construct( $message = '',  $code = 0, ?Throwable $previous = null, string $command = '', int $commandlist_num = 0) : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+ +

+
+ + +
+

__toString

+

+

Returns all information as string

+

+ +
MPDException::__toString() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+

string

+

+
+ + +
+

getCommand

+

+

Returns the command which caused the error.

+

+ +
MPDException::getCommand() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+

string

+

+
+ + +
+

getCommandlistNum

+

+

Returns the command's list-number in case a commandlist was used.

+

+ +
MPDException::getCommandlistNum() : int
+ +

Parameters

+
    + None. +
+ +

Returns int

+

+

int

+

+
+ + +
+

__wakeup

+

+ +

+ +
MPDException::__wakeup() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+ +

+
+ + +
+

getMessage

+

+ +

+ +
MPDException::getMessage() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+ +

+
+ + +
+

getCode

+

+ +

+ +
MPDException::getCode() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+ +

+
+ + +
+

getFile

+

+ +

+ +
MPDException::getFile() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+ +

+
+ + +
+

getLine

+

+ +

+ +
MPDException::getLine() : int
+ +

Parameters

+
    + None. +
+ +

Returns int

+

+ +

+
+ + +
+

getTrace

+

+ +

+ +
MPDException::getTrace() : array
+ +

Parameters

+
    + None. +
+ +

Returns array

+

+ +

+
+ + +
+

getPrevious

+

+ +

+ +
MPDException::getPrevious() : Throwable
+ +

Parameters

+
    + None. +
+ +

Returns Throwable

+

+ +

+
+ + +
+

getTraceAsString

+

+ +

+ +
MPDException::getTraceAsString() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+ +

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/MphpD.html b/docs/v1.2.6/classes/MphpD.html new file mode 100644 index 0000000..9605d44 --- /dev/null +++ b/docs/v1.2.6/classes/MphpD.html @@ -0,0 +1,1083 @@ + + + + MphpD - MphpD + + + + + + + + + + +
+ +

MphpD

+

The Main MphpD class.

+ +
new MphpD(array $config = []) : MphpD
+ +

Methods

+ + +
+

__construct

+

+ +

+ +
MphpD::__construct(array $options = []) : mixed
+ +

Parameters

+ + +

Returns mixed

+

+ +

+
+ + +
+

db

+

+

Return the DB instance

+

+ +
MphpD::db() : FloFaber\MphpD\DB
+ +

Parameters

+
    + None. +
+ +

Returns FloFaber\MphpD\DB

+

+

\DB

+

+
+ + +
+

player

+

+

Return the Player instance

+

+ +
MphpD::player() : FloFaber\MphpD\Player
+ +

Parameters

+
    + None. +
+ +

Returns FloFaber\MphpD\Player

+

+

\Player

+

+
+ + +
+

queue

+

+

Return the Queue instance

+

+ +
MphpD::queue() : FloFaber\MphpD\Queue
+ +

Parameters

+
    + None. +
+ +

Returns FloFaber\MphpD\Queue

+

+

\Queue

+

+
+ + +
+

playlist

+

+

Returns a Playlist instance with the given name or null if the name is empty

+

+ +
MphpD::playlist(string $name) : FloFaber\MphpD\Playlist
+ +

Parameters

+
    +
  • $name

    The name of the playlist. Must not be empty.

  • + +
+ +

Returns FloFaber\MphpD\Playlist

+

+

\Playlist|null

+

+
+ + +
+

playlists

+

+

Returns a list of playlists.

+

+ +
MphpD::playlists(bool $metadata = ) : mixed
+ +

Parameters

+
    +
  • $metadata

    If true an array of associative arrays containing information about the playlists (like last-modified,...) will be returned.

    +

    If false or omitted an array containing all playlists names is returned.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

output

+

+

Return a new output instance

+

+ +
MphpD::output(int $id) : FloFaber\MphpD\Output
+ +

Parameters

+
    +
  • $id

    The ID of the output

  • + +
+ +

Returns FloFaber\MphpD\Output

+

+

\Output

+

+
+ + +
+

outputs

+

+

Returns an Array of associative arrays containing all available outputs

+

+ +
MphpD::outputs() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

neighbors

+

+

Return neighbors on the network like available SMB servers

+

+ +
MphpD::neighbors() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

partition

+

+

Return a new Partition instance

+

+ +
MphpD::partition(string $name) : FloFaber\MphpD\Partition
+ +

Parameters

+
    +
  • $name

    The name of the partition

  • + +
+ +

Returns FloFaber\MphpD\Partition

+

+

\Partition

+

+
+ + +
+

partitions

+

+

Return a list of all available partitions

+

+ +
MphpD::partitions() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

channel

+

+

Return a new Channel instance

+

+ +
MphpD::channel(string $name = '') : FloFaber\MphpD\Channel
+ +

Parameters

+
    +
  • $name

    The name of the channel

  • + +
+ +

Returns FloFaber\MphpD\Channel

+

+

\Channel

+

+
+ + +
+

channels

+

+

Return a list of available channels

+

+ +
MphpD::channels() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|bool array on success or false on failure.

+

+
+ + +
+

clear_error

+

+

Clears the current error

+

+ +
MphpD::clear_error() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

status

+

+

Returns the value of the specified key(s) from MPD's status.

+

+ +
MphpD::status(array $items = []) : mixed
+ +

Parameters

+
    +
  • $items

    Optional. Array containing the wanted key(s) like status, songid,...

    +

    If only one item is given only it's value will be returned instead of an associative array.

    +

    If the given item(s) do not exist null will be set as their value.

    +

    If omitted, an associative array containing all status information will be returned.

  • + +
+ +

Returns mixed

+

+

array|false|int|float|null false on error

+

string, int, float or null if $items contains only one item. If it does not exist null will be returned instead.

+

Otherwise, an associative array containing all available (or specified) keys.

+

+
+ + +
+

stats

+

+

Returns the value of the specified key from MPD's stats.

+

+ +
MphpD::stats(array $items = []) : mixed
+ +

Parameters

+
    +
  • $items

    Optional. Array containing the wanted stat(s). Example: [ "artists", "uptime", "playtime" ]

    +

    If only one item is given only it's value will be returned instead of an associative array.

    +

    If the given item(s) do not exist null will be set as their value.

    +

    If omitted, an associative array containing all stats will be returned.

  • + +
+ +

Returns mixed

+

+

array|false|int|null Returns +false on error

+

string, int or null if $items contains only one item. If it does not exist null will be returned instead.

+

Otherwise, an associative array containing all available (or specified) stats.

+

+
+ + +
+

sticker

+

+

Returns a Sticker instance

+

+ +
MphpD::sticker(string $type, string $uri) : FloFaber\MphpD\Sticker
+ +

Parameters

+
    +
  • $type
  • +
  • $uri
  • + +
+ +

Returns FloFaber\MphpD\Sticker

+

+

\Sticker

+

+
+ + +
+

mounts

+

+

Return a list of all mounts.

+

+ +
MphpD::mounts() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false

+

+
+ + +
+

mount

+

+

Mount $uri to path

+

+ +
MphpD::mount(string $path, string $uri) : bool
+ +

Parameters

+
    +
  • $path
  • +
  • $uri

    The URI to mount

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

unmount

+

+

Unmount a path

+

+ +
MphpD::unmount(string $path) : bool
+ +

Parameters

+
    +
  • $path

    The path to unmount

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

bulk_start

+

+

Function to start a command-list.

+

+ +
MphpD::bulk_start() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

void

+

+
+ + +
+

bulk_end

+

+

Function to end a command-list and execute its commands. +The command list is stopped in case an error occurs.

+

+ +
MphpD::bulk_end() : array
+ +

Parameters

+
    + None. +
+ +

Returns array

+

+

array|false array containing the commands responses or false on failure.

+

+
+ + +
+

bulk_abort

+

+

Function to abort the current command list. +We can do that because we only start the list at protocol level when bulk_end() is called.

+

+ +
MphpD::bulk_abort() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

void

+

+
+ + +
+

bulk_add

+

+

Function to add a command to the bulk_list.

+

+ +
MphpD::bulk_add(string $cmd, array $params = [], int $mode = 32) : bool
+ +

Parameters

+
    +
  • $cmd
  • +
  • $params
  • +
  • $mode
  • + +
+ +

Returns bool

+

+

bool

+

+
+ + +
+

tagtypes

+

+

Return a list of all available tag types.

+

+ +
MphpD::tagtypes() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

tagtypes_disable

+

+

Disable specified tag types.

+

+ +
MphpD::tagtypes_disable(array $tagtypes) : bool
+ +

Parameters

+
    +
  • $tagtypes

    A list of tag types to disable.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

tagtypes_enable

+

+

Enable specified tag types.

+

+ +
MphpD::tagtypes_enable(array $tagtypes) : bool
+ +

Parameters

+
    +
  • $tagtypes

    A list of tag types to enable.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

tagtypes_clear

+

+

Remove all tag types from responses.

+

+ +
MphpD::tagtypes_clear() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

tagtypes_all

+

+

Enable all available tag types.

+

+ +
MphpD::tagtypes_all() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

ping

+

+

Ping.

+

+ +
MphpD::ping() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

config

+

+

Returns an associative array of configuration values. +This function is only available for client connected via Unix Socket!

+

+ +
MphpD::config() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array containing configuration parameters on success or false on failure.

+

+
+ + +
+

commands

+

+

Returns a list of all available commands.

+

+ +
MphpD::commands() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

notcommands

+

+

Returns a list of all not-available commands.

+

+ +
MphpD::notcommands() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

urlhandlers

+

+

Returns a list of all available urlhandlers. Like smb://, sftp://, http://. +..

+

+ +
MphpD::urlhandlers() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

decoders

+

+

Returns a list of available decoder plugins and their supported suffixes and mimetypes.

+

+ +
MphpD::decoders() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

cmd

+

+

Send $command with $params to the MPD server. +You, the library's user, are not intended to ever +need this method. If you ever need it because the library does not support +a specific command please file a bug report. +This method also parses MPDs response depending on the chosen mode.

+

+ +
MphpD::cmd(string $command, array $params = [], int $mode = 2, array $list_start = []) : mixed
+ +

Parameters

+
    +
  • $command

    The command

  • +
  • $params

    Parameters, automatically escaped

  • +
  • $mode

    One of the following constants:

    +
      +
    • +

      MPD_CMD_READ_NONE - Do not read anything from the answer. Returns an empty array.

      +
    • +
    • +

      MPD_CMD_READ_NORMAL - Parses the answer as a one-dimensional "key=>value" array. +If a key already existed its value gets overwritten. +Used for commands like "status" where only unique keys are given.

      +
    • +
    • +

      MPD_CMD_READ_GROUP - Used for parsing grouped responses like list album group albumartist. +Example: + +Albumartist: Eternal Decision +Album: E.D.III +Album: Eternal Decision +Album: Ghost in the machine +Albumartist: Black Sabbath +Album: Paranoid +Album: Reunion + +Will become +[ +"Eternal Decision" => [ +"album" => [ "E.D.III", "Eternal Decision", "Ghost in the machine" ] +], "Black Sabbath" => [ +"album" => [ "Paranoid", "Reunion" ] +] +]

      +
    • +
    • +

      MPD_CMD_READ_LIST - Parses the answer as a list of "key=>value" arrays. +Used for commands like "listplaylists" where keys are not unique.

      +
    • +
    • +

      MPD_CMD_READ_LIST_SINGLE - Parses the answer into a simple "list"-array. +Used for commands like "idle" where there is +only a single possible "key".

      +
                           If used for commands where more than a single key is possible e.g. `listplaylists` only the value of the first seen key is added to the returned list.
      +                     All other keys are ignored. In this case you probably want to use `MPD_CMD_READ_LIST`.
      +
    • +
    • +

      MPD_CMD_READ_BOOL - Parses the answer into true on OK and list_OK and false on ACK. +Used for commands which do not return anything but OK or ACK.

      +
    • +
  • +
  • $list_start

    In combination with $mode = MPD_CMD_READ_LIST indicates on which key a new list starts.

  • + +
+ +

Returns mixed

+

+

array|bool False on failure. +Array on success. +True on success if $mode is MPD_CMD_READ_BOOL.

+

+
+ + +
+

get_socket

+

+

Returns the socket resource.

+

+ +
MphpD::get_socket() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

resource

+

+
+ + +
+

get_version

+

+

Returns MPDs version as string

+

+ +
MphpD::get_version() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+

string

+

+
+ + +
+

version_bte

+

+

Function to compare a given version string with the current version of MPD

+

+ +
MphpD::version_bte(string $version) : bool
+ +

Parameters

+
    +
  • $version

    Version to compare to.

  • + +
+ +

Returns bool

+

+

bool Returns true if MPDs version is equal to or newer than the given version. False otherwise.

+

+
+ + +
+

idle

+

+

Waits until there is a noteworthy change in one or more of MPD’s subsystems.

+

+ +
MphpD::idle(string $subsystem = '', int $timeout = 60) : mixed
+ +

Parameters

+
    +
  • $subsystem
  • +
  • $timeout

    Specifies how long to wait for MPD to return an answer.

  • + +
+ +

Returns mixed

+

+

array|false array of changed subsystems or false on timeout.

+

+
+ + +
+

close

+

+

Close the connection to the MPD socket

+

+ +
MphpD::close() : void
+ +

Parameters

+
    + None. +
+ +

Returns void

+

+

void

+

+
+ + +
+

kill

+

+

Kill MPD.

+

+ +
MphpD::kill() : void
+ +

Parameters

+
    + None. +
+ +

Returns void

+

+

void

+

+
+ + +
+

get_binarylimit

+

+

Returns the current binarylimit

+

+ +
MphpD::get_binarylimit() : int
+ +

Parameters

+
    + None. +
+ +

Returns int

+

+

int The current binarylimit.

+

+
+ + +
+

set_error

+

+

Function to set the last occurred error. +Should only be used inside the library!

+

+ +
MphpD::set_error( $err) : bool
+ +

Parameters

+
    +
  • $err
  • + +
+ +

Returns bool

+

+

false

+

+
+ + +
+

get_last_error

+

+

Return an array containing information about the last error.

+

+ +
MphpD::get_last_error() : array
+ +

Parameters

+
    + None. +
+ +

Returns array

+

+

array associative array containing the following keys: + +[ +"code" => (int), +"message" => (string), +"command" => (string), +"commandlistnum" => (int) +] +

+

+
+ + +
+

connect

+

+

Initiate connection to MPD with the parameters given at instantiation.

+

+ +
MphpD::connect() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

disconnect

+

+

Disconnect from MPD

+

+ +
MphpD::disconnect() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

void

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Output.html b/docs/v1.2.6/classes/Output.html new file mode 100644 index 0000000..64e19de --- /dev/null +++ b/docs/v1.2.6/classes/Output.html @@ -0,0 +1,146 @@ + + + + MphpD - Output + + + + + + + + + + +
+ +

Output

+

This subclass is used to configure audio outputs. +Have a look at the MPD doc for more.

+ +
MphpD::output(int $id) : Output
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::output() instead to retrieve an instance of this class.

+

+ +
Output::__construct(FloFaber\MphpD\MphpD $mphpd, int $id) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • +
  • $id
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

disable

+

+

Disable the given output

+

+ +
Output::disable() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

enable

+

+

Enable the given output

+

+ +
Output::enable() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

toggle

+

+

Enable/Disable the given output depending on the current state.

+

+ +
Output::toggle() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

set

+

+

Set a runtime attribute. Supported values can be retrieved from the MphpD::outputs() method.

+

+ +
Output::set(string $name, string $value) : bool
+ +

Parameters

+
    +
  • $name
  • +
  • $value
  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Partition.html b/docs/v1.2.6/classes/Partition.html new file mode 100644 index 0000000..612f3dd --- /dev/null +++ b/docs/v1.2.6/classes/Partition.html @@ -0,0 +1,144 @@ + + + + MphpD - Partition + + + + + + + + + + +
+ +

Partition

+

This subclass is used to create, switch and configure partitions

+ +
MphpD::partition(string $name) : Partition
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::partition() instead to retrieve an instance of this class.

+

+ +
Partition::__construct(FloFaber\MphpD\MphpD $mphpd, string $name) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • +
  • $name
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

switch

+

+

Switch the client to the given partition

+

+ +
Partition::switch() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

create

+

+

Create a new partition with the given name.

+

+ +
Partition::create() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

delete

+

+

Delete the given partition

+

+ +
Partition::delete() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

move_output

+

+

Move a specific output to the current partition

+

+ +
Partition::move_output(string $name) : bool
+ +

Parameters

+
    +
  • $name

    Name of the output.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Player.html b/docs/v1.2.6/classes/Player.html new file mode 100644 index 0000000..9dacd80 --- /dev/null +++ b/docs/v1.2.6/classes/Player.html @@ -0,0 +1,516 @@ + + + + MphpD - Player + + + + + + + + + + +
+ +

Player

+

This subclass is used to control MPDs playback. +You may also want to have a look at the MPD documentation.

+ +
MphpD::player() : Player
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::player() instead to retrieve an instance of this class.

+

+ +
Player::__construct(FloFaber\MphpD\MphpD $mphpd) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

consume

+

+

Enables/Disables the consume mode

+

+ +
Player::consume(int $state) : bool
+ +

Parameters

+
    +
  • $state

    One of the following:

    +
      +
    • +

      MPD_STATE_ON - Enables consume mode

      +
    • +
    • +

      MPD_STATE_OFF - Disables consume mode

      +
    • +
    • +

      MPD_STATE_ONESHOT - Enables consume mode for a single song. +This is only supported on MPD version 0.24 and newer.

      +
    • +
  • + +
+ +

Returns bool

+

+

bool true on success and false on failure

+

+
+ + +
+

crossfade

+

+

Sets crossfade to $seconds seconds.

+

+ +
Player::crossfade(int $seconds) : bool
+ +

Parameters

+
    +
  • $seconds

    Crossfade duration in seconds.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

mixramp_db

+

+

Sets the threshold at which songs will be overlapped. +See https://mpd.readthedocs.io/en/latest/user.html#mixramp for more information

+

+ +
Player::mixramp_db(int $dB) : bool
+ +

Parameters

+
    +
  • $dB
  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

mixramp_delay

+

+

Additional time subtracted from the overlap calculated by mixrampdb. +A value of nan disables MixRamp overlapping and falls back to crossfading. See MixRamp.

+

+ +
Player::mixramp_delay(float $seconds) : bool
+ +

Parameters

+
    +
  • $seconds
  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

random

+

+

Specified if MPD should play the queue in random order

+

+ +
Player::random(int $state) : bool
+ +

Parameters

+
    +
  • $state

    Either MPD_STATE_OFF or MPD_STATE_ON

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

repeat

+

+

Specifies if MPD should start from the top again when reaching the end of the queue.

+

+ +
Player::repeat(int $state) : bool
+ +

Parameters

+
    +
  • $state

    Either MPD_STATE_OFF or MPD_STATE_ON

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

volume

+

+

Sets volume to $volume or returns the current volume if $volume is omitted.

+

+ +
Player::volume(int $volume = -1) : mixed
+ +

Parameters

+
    +
  • $volume

    If specified the current volume is set to $volume.

    +

    If omitted the current volume is returned.

  • + +
+ +

Returns mixed

+

+

int|bool true on success, false on failure and int if $volume was omitted.

+

+
+ + +
+

single

+

+

Enables/Disables the single-mode. If enabled MPD will play the same song over and over.

+

+ +
Player::single(int $state) : bool
+ +

Parameters

+
    +
  • $state

    One of the following:

    +
      +
    • +

      MPD_STATE_ON - Enables single mode

      +
    • +
    • +

      MPD_STATE_OFF - Disables single mode

      +
    • +
    • +

      MPD_STATE_ONESHOT - Enables single mode for only a single time. +This is only supported on MPD version 0.21 and newer.

      +
    • +
  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

replay_gain_mode

+

+

Specifies whether MPD shall adjust the volume of songs played using ReplayGain tags.

+

+ +
Player::replay_gain_mode(string $mode) : bool
+ +

Parameters

+
    +
  • $mode

    One of off, track, album, auto

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

replay_gain_status

+

+

Get the current replay gain. Currently only the variable replay_gain_mode is returned by MPD.

+

+ +
Player::replay_gain_status() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

current_song

+

+

Returns an associative array containing information about the currently playing song.

+

+ +
Player::current_song() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array containing song information on success or false on failure.

+

+
+ + +
+

next

+

+

Plays the next song in the Queue

+

+ +
Player::next() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

pause

+

+

Pause or resume playback.

+

+ +
Player::pause(?int $state = null) : bool
+ +

Parameters

+
    +
  • $state

    Optional. One of the following:

    +
      +
    • +

      MPD_STATE_ON - Pause

      +
    • +
    • +

      MPD_STATE_OFF - Resume

      +
    • +
    +

    If omitted or null the pause state is toggled.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

play

+

+

Plays the song position $pos in the Queue

+

+ +
Player::play(int $pos) : bool
+ +

Parameters

+
    +
  • $pos

    Song position starting at 0.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

play_id

+

+

Begins playing the playlist at song $id

+

+ +
Player::play_id(int $id) : bool
+ +

Parameters

+
    +
  • $id

    ID of the song.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

previous

+

+

Plays the previous song in the Queue

+

+ +
Player::previous() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

seek

+

+

Seeks to $seconds of song $songpos in the Queue.

+

+ +
Player::seek(int $songpos, float $time) : bool
+ +

Parameters

+
    +
  • $songpos

    Queue-position of the song.

  • +
  • $time

    Seconds to seek to.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

seek_id

+

+

Seeks to $seconds of song $songid. Same as Player::seek() but with a song ID instead of a position.

+

+ +
Player::seek_id(int $songid, float $time) : bool
+ +

Parameters

+
    +
  • $songid

    ID of the song.

  • +
  • $time

    Seconds to seek to.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

seek_cur

+

+

Seeks to $seconds of the current song.

+

+ +
Player::seek_cur( $time) : bool
+ +

Parameters

+
    +
  • $time

    If prefixed with + or - the time is relative to the current playing position.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

stop

+

+

Stops playing.

+

+ +
Player::stop() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Playlist.html b/docs/v1.2.6/classes/Playlist.html new file mode 100644 index 0000000..49e38cf --- /dev/null +++ b/docs/v1.2.6/classes/Playlist.html @@ -0,0 +1,312 @@ + + + + MphpD - Playlist + + + + + + + + + + +
+ +

Playlist

+

Subclass to interact with stored Playlists.

+ +
MphpD::playlist(string $name) : Playlist
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::playlist() instead to retrieve an instance of this class.

+

+ +
Playlist::__construct(FloFaber\MphpD\MphpD $mphpd, string $name) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • +
  • $name
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

exists

+

+

Function to determine if the specified playlist exists.

+

+ +
Playlist::exists() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true if it exists, otherwise false.

+

+
+ + +
+

get_songs

+

+

Returns a list of all songs in the specified playlist.

+

+ +
Playlist::get_songs(bool $metadata = ) : mixed
+ +

Parameters

+
    +
  • $metadata

    If set to true metadata like duration, last-modified,... will be included.

  • + +
+ +

Returns mixed

+

+

array|false array of associative Arrays containing song information on success or false on failure.

+

+
+ + +
+

load

+

+

Loads the specified playlist into the Queue.

+

+ +
Playlist::load(array $range = [],  $pos = '') : bool
+ +

Parameters

+
    +
  • $range

    Range. If specified only the requested portion of the playlist is loaded. Starts at 0.

  • +
  • $pos

    Specifies where the songs will be inserted into the queue.

    +

    Can be relative if prefixed with + or -

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

add

+

+

Adds $uri to the specified playlist at position $pos.

+

+ +
Playlist::add(string $uri,  $pos = '') : bool
+ +

Parameters

+
    +
  • $uri

    Relative file path or other supported URIs.

  • +
  • $pos

    Specifies where the songs will be inserted into the playlist. +Can be relative if prefixed with + or -

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

add_search

+

+

Search for songs using Filter and add them into the Playlist at position $pos.

+

+ +
Playlist::add_search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $position = -1) : bool
+ +

Parameters

+
    +
  • $filter
  • +
  • $sort
  • +
  • $window
  • +
  • $position
  • + +
+ +

Returns bool

+

+

bool

+

+
+ + +
+

clear

+

+

Removes all songs from the specified playlist.

+

+ +
Playlist::clear() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

remove_song

+

+

Deletes $songpos from the specified playlist.

+

+ +
Playlist::remove_song( $songpos = -1) : bool
+ +

Parameters

+
    +
  • $songpos

    Position of the song or Range

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

move_song

+

+

Moves the song at position $from in the specified playlist to the position $to.

+

+ +
Playlist::move_song(int $from, int $to) : bool
+ +

Parameters

+
    +
  • $from

    Current song position

  • +
  • $to

    New song position

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

rename

+

+

Renames the specified playlist to $new_name

+

+ +
Playlist::rename(string $new_name) : bool
+ +

Parameters

+
    +
  • $new_name

    New playlist name

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

delete

+

+

Removes the specified playlist from the playlist directory.

+

+ +
Playlist::delete() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

save

+

+

Saves the queue to the specified playlist in the playlist directory

+

+ +
Playlist::save(int $mode = 1) : bool
+ +

Parameters

+
    +
  • $mode

    Optional. One of the following:

    +
      +
    • +

      MPD_MODE_CREATE: The default. Create a new playlist. Fails if a playlist with name $name already exists.

      +
    • +
    • +

      MPD_MODE_APPEND: Append an existing playlist. Fails if a playlist with name $name doesn't already exist. +Only supported on MPD v0.24 and newer.

      +
    • +
    • +

      MPD_MODE_REPLACE: Replace an existing playlist. Fails if a playlist with name $name doesn't already exist. +Only supported on MPD v0.24 and newer.

      +
    • +
  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Queue.html b/docs/v1.2.6/classes/Queue.html new file mode 100644 index 0000000..1840afa --- /dev/null +++ b/docs/v1.2.6/classes/Queue.html @@ -0,0 +1,564 @@ + + + + MphpD - Queue + + + + + + + + + + +
+ +

Queue

+

Subclass to control the Queue.

+ +
MphpD::queue() : Queue
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::queue() instead to retrieve an instance of this class.

+

+ +
Queue::__construct(FloFaber\MphpD\MphpD $mphpd) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

add

+

+

Adds the file $uri to the queue (directories add recursively). $uri can also be a single file.

+

+ +
Queue::add(string $uri,  $pos = -1) : bool
+ +

Parameters

+
    +
  • $uri

    Can be a single file or folder. +If connected via Unix socket you may add arbitrary local files (absolute paths)

  • +
  • $pos

    If set the song is inserted at the specified position. +If the parameter starts with + or -, then it is relative to the current song. +e.g. +0 inserts right after the current song and -0 inserts right before the current song (i.e. zero songs between the current song and the newly added song).

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

add_id

+

+

Adds a song to the playlist (non-recursive) and returns the song id.

+

+ +
Queue::add_id(string $uri,  $pos = -1) : mixed
+ +

Parameters

+
    +
  • $uri

    Is always a single file or URL

  • +
  • $pos

    If set the song is inserted at the specified position. +If the parameter starts with + or -, then it is relative to the current song. +e.g. +0 inserts right after the current song and -0 inserts right before the current song (i.e. zero songs between the current song and the newly added song).

  • + +
+ +

Returns mixed

+

+

int|false The song ID on success or false on failure.

+

+
+ + +
+

add_search

+

+

Same as search() but adds the songs into the Queue at position $pos.

+

+ +
Queue::add_search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $position = -1) : bool
+ +

Parameters

+
    +
  • $filter
  • +
  • $sort
  • +
  • $window
  • +
  • $position
  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

add_find

+

+

Same as find() but this adds the matching song to the Queue.

+

+ +
Queue::add_find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $pos = -1) : bool
+ +

Parameters

+
    +
  • $filter
  • +
  • $sort
  • +
  • $window
  • +
  • $pos

    Optional. If specified the matched songs will be added to this position in the Queue.

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

clear

+

+

Clears the queue

+

+ +
Queue::clear() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

delete

+

+

Deletes a song or a range of songs from the queue

+

+ +
Queue::delete( $p) : bool
+ +

Parameters

+
    +
  • $p

    The song position or Range

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

delete_id

+

+

Deletes the song with ID $songid from the Queue

+

+ +
Queue::delete_id(int $songid) : bool
+ +

Parameters

+
    +
  • $songid

    The song ID

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

move

+

+

Moves the song at $from to $to in the queue

+

+ +
Queue::move( $from, string $to) : bool
+ +

Parameters

+
    +
  • $from

    Song position or Range

  • +
  • $to

    If starting with + or -, then it is relative to the current song +e.g. +0 moves to right after the current song and -0 moves to right before the current song +(i.e. zero songs between the current song and the moved range).

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

move_id

+

+

Moves the song with $from (songid) to $to (playlist index) in the queue.

+

+ +
Queue::move_id(int $from, string $to) : bool
+ +

Parameters

+
    +
  • $from

    Song ID

  • +
  • $to

    Playlist Index. If starting with + or -, then it is relative to the current song +e.g. +0 moves to right after the current song and -0 moves to right before the current song +(i.e. zero songs between the current song and the moved song).

  • + +
+ +

Returns bool

+

+

bool true on success and false on failure.

+

+
+ + +
+

find

+

+

Same as Queue::search but case-sensitive

+

+ +
Queue::find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
+ +

Parameters

+
    +
  • $filter
  • +
  • $sort
  • +
  • $window
  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

get_id

+

+

Returns an associative arrays containing information about the song with ID $songid.

+

+ +
Queue::get_id(int $songid) : mixed
+ +

Parameters

+
    +
  • $songid

    Song ID

  • + +
+ +

Returns mixed

+

+

array|false Associative array containing song information or false on failure.

+

+
+ + +
+

get

+

+

Returns information about all or specific songs in the Queue.

+

+ +
Queue::get( $p = -1) : mixed
+ +

Parameters

+
    +
  • int|array

    Optional. Song Position or Range. +If omitted returns an array of associative arrays containing information about all songs in the Queue. +If specified returns an associative array containing the given songs information only.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure. An empty array is returned if the queue is empty.

+

+
+ + +
+

search

+

+

Search the queue for matching songs.

+

+ +
Queue::search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
+ +

Parameters

+
    +
  • $filter

    The Filter.

  • +
  • $sort

    If specified the results are sorted by the specified tag.

  • +
  • $window

    If specified returns only the given portion.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

changes

+

+

Returns an array of changed songs currently in the playlist since $version.

+

+ +
Queue::changes(int $version,  $range = -1, bool $metadata = ) : mixed
+ +

Parameters

+
    +
  • $version

    The current version can be retrieved with MphpD::status([ "playlist" ]).

  • +
  • $range

    Position of song or Range

  • +
  • $metadata

    If set to true the metadata will be included.

    +

    If set to false only the position and ID of the changed songs will be returned.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

prio

+

+

Sets the priority of given songs to $priority. +This only has effect when the random-mode is enabled. +A higher priority means that it will be played first when random is enabled.

+

+ +
Queue::prio(int $priority,  $range = -1) : bool
+ +

Parameters

+
    +
  • $priority

    Priority 0-255.

  • +
  • $range

    Position of song or Range

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

prio_id

+

+

Sets the priority of Song ID $id to $priority. +This only has effect when the random-mode is enabled. +A higher priority means that it will be played first when random is enabled.

+

+ +
Queue::prio_id(int $priority, int $id) : bool
+ +

Parameters

+
    +
  • $priority

    Priority 0-255.

  • +
  • $id

    Song ID.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

range_id

+

+

Set's the portion of the song that should be played. +You can't edit the currently playing song!

+

+ +
Queue::range_id(int $songid, array $range = []) : bool
+ +

Parameters

+
    +
  • $songid

    Song ID.

  • +
  • $range

    Range. Start and End are offsets in seconds. If omitted the "play-range" will be removed from the song.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

shuffle

+

+

Shuffle the Queue.

+

+ +
Queue::shuffle(array $range = []) : bool
+ +

Parameters

+
    +
  • $range

    If specified only this portion will be shuffled.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

swap

+

+

Swap two songs in Queue. By Position.

+

+ +
Queue::swap(int $songpos_1, int $songpos_2) : bool
+ +

Parameters

+
    +
  • $songpos_1
  • +
  • $songpos_2
  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

swap_id

+

+

Swap two songs in Queue. By ID.

+

+ +
Queue::swap_id(int $songid_1, int $songid_2) : bool
+ +

Parameters

+
    +
  • $songid_1

    First song ID

  • +
  • $songid_2

    Second song ID

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

add_tag_id

+

+

Adds a tag to the specified song

+

+ +
Queue::add_tag_id(int $songid, string $tag, string $value) : bool
+ +

Parameters

+
    +
  • $songid

    Song ID

  • +
  • $tag

    Tag name

  • +
  • $value

    Tag value

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

clear_tag_id

+

+

Removes a tag from the specified song

+

+ +
Queue::clear_tag_id(int $songid, string $tag) : bool
+ +

Parameters

+
    +
  • $songid

    Song ID

  • +
  • $tag

    Tag name

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Socket.html b/docs/v1.2.6/classes/Socket.html new file mode 100644 index 0000000..0e29915 --- /dev/null +++ b/docs/v1.2.6/classes/Socket.html @@ -0,0 +1,370 @@ + + + + MphpD - Socket + + + + + + + + + + +
+ +

Socket

+

Class which is used for socket communication and extended by the MphpD class. +Is and should only be used inside the library.

+ +
+ +

Methods

+ + +
+

__construct

+

+ +

+ +
Socket::__construct(array $options = []) : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+ +

+
+ + +
+

cmd

+

+

Send $command with $params to the MPD server. +You, the library's user, are not intended to ever +need this method. If you ever need it because the library does not support +a specific command please file a bug report. +This method also parses MPDs response depending on the chosen mode.

+

+ +
Socket::cmd(string $command, array $params = [], int $mode = 2, array $list_start = []) : mixed
+ +

Parameters

+
    +
  • $command

    The command

  • +
  • $params

    Parameters, automatically escaped

  • +
  • $mode

    One of the following constants:

    +
      +
    • +

      MPD_CMD_READ_NONE - Do not read anything from the answer. Returns an empty array.

      +
    • +
    • +

      MPD_CMD_READ_NORMAL - Parses the answer as a one-dimensional "key=>value" array. +If a key already existed its value gets overwritten. +Used for commands like "status" where only unique keys are given.

      +
    • +
    • +

      MPD_CMD_READ_GROUP - Used for parsing grouped responses like list album group albumartist. +Example: + +Albumartist: Eternal Decision +Album: E.D.III +Album: Eternal Decision +Album: Ghost in the machine +Albumartist: Black Sabbath +Album: Paranoid +Album: Reunion + +Will become +[ +"Eternal Decision" => [ +"album" => [ "E.D.III", "Eternal Decision", "Ghost in the machine" ] +], "Black Sabbath" => [ +"album" => [ "Paranoid", "Reunion" ] +] +]

      +
    • +
    • +

      MPD_CMD_READ_LIST - Parses the answer as a list of "key=>value" arrays. +Used for commands like "listplaylists" where keys are not unique.

      +
    • +
    • +

      MPD_CMD_READ_LIST_SINGLE - Parses the answer into a simple "list"-array. +Used for commands like "idle" where there is +only a single possible "key".

      +
                           If used for commands where more than a single key is possible e.g. `listplaylists` only the value of the first seen key is added to the returned list.
      +                     All other keys are ignored. In this case you probably want to use `MPD_CMD_READ_LIST`.
      +
    • +
    • +

      MPD_CMD_READ_BOOL - Parses the answer into true on OK and list_OK and false on ACK. +Used for commands which do not return anything but OK or ACK.

      +
    • +
  • +
  • $list_start

    In combination with $mode = MPD_CMD_READ_LIST indicates on which key a new list starts.

  • + +
+ +

Returns mixed

+

+

array|bool False on failure. +Array on success. +True on success if $mode is MPD_CMD_READ_BOOL.

+

+
+ + +
+

get_socket

+

+

Returns the socket resource.

+

+ +
Socket::get_socket() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

resource

+

+
+ + +
+

get_version

+

+

Returns MPDs version as string

+

+ +
Socket::get_version() : string
+ +

Parameters

+
    + None. +
+ +

Returns string

+

+

string

+

+
+ + +
+

version_bte

+

+

Function to compare a given version string with the current version of MPD

+

+ +
Socket::version_bte(string $version) : bool
+ +

Parameters

+
    +
  • $version

    Version to compare to.

  • + +
+ +

Returns bool

+

+

bool Returns true if MPDs version is equal to or newer than the given version. False otherwise.

+

+
+ + +
+

idle

+

+

Waits until there is a noteworthy change in one or more of MPD’s subsystems.

+

+ +
Socket::idle(string $subsystem = '', int $timeout = 60) : mixed
+ +

Parameters

+
    +
  • $subsystem
  • +
  • $timeout

    Specifies how long to wait for MPD to return an answer.

  • + +
+ +

Returns mixed

+

+

array|false array of changed subsystems or false on timeout.

+

+
+ + +
+

close

+

+

Close the connection to the MPD socket

+

+ +
Socket::close() : void
+ +

Parameters

+
    + None. +
+ +

Returns void

+

+

void

+

+
+ + +
+

kill

+

+

Kill MPD.

+

+ +
Socket::kill() : void
+ +

Parameters

+
    + None. +
+ +

Returns void

+

+

void

+

+
+ + +
+

get_binarylimit

+

+

Returns the current binarylimit

+

+ +
Socket::get_binarylimit() : int
+ +

Parameters

+
    + None. +
+ +

Returns int

+

+

int The current binarylimit.

+

+
+ + +
+

set_error

+

+

Function to set the last occurred error. +Should only be used inside the library!

+

+ +
Socket::set_error( $err) : bool
+ +

Parameters

+
    +
  • $err
  • + +
+ +

Returns bool

+

+

false

+

+
+ + +
+

get_last_error

+

+

Return an array containing information about the last error.

+

+ +
Socket::get_last_error() : array
+ +

Parameters

+
    + None. +
+ +

Returns array

+

+

array associative array containing the following keys: + +[ +"code" => (int), +"message" => (string), +"command" => (string), +"commandlistnum" => (int) +] +

+

+
+ + +
+

connect

+

+

Initiate connection to MPD with the parameters given at instantiation.

+

+ +
Socket::connect() : bool
+ +

Parameters

+
    + None. +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

disconnect

+

+

Disconnect from MPD

+

+ +
Socket::disconnect() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

void

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Sticker.html b/docs/v1.2.6/classes/Sticker.html new file mode 100644 index 0000000..85f59bd --- /dev/null +++ b/docs/v1.2.6/classes/Sticker.html @@ -0,0 +1,171 @@ + + + + MphpD - Sticker + + + + + + + + + + +
+ +

Sticker

+

Subclass for Stickers.

+ +
MphpD::sticker(string $type, string $uri) : Sticker
+ +

Methods

+ + +
+

__construct

+

+

This class is not intended for direct usage. +Use MphpD::sticker() instead to retrieve an instance of this class.

+

+ +
Sticker::__construct(FloFaber\MphpD\MphpD $mphpd, string $type, string $uri) : mixed
+ +

Parameters

+
    +
  • $mphpd
  • +
  • $type
  • +
  • $uri
  • + +
+ +

Returns mixed

+

+ +

+
+ + +
+

get

+

+

Returns the value of the specified sticker

+

+ +
Sticker::get(string $name) : mixed
+ +

Parameters

+
    +
  • $name

    Name of the sticker.

  • + +
+ +

Returns mixed

+

+

false|string string on success or false on failure.

+

+
+ + +
+

set

+

+

Add a value to the specified sticker.

+

+ +
Sticker::set(string $name, string $value) : bool
+ +

Parameters

+
    +
  • $name

    Name of the value.

  • +
  • $value

    Value of the value.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

delete

+

+

Deletes the value from the specified sticker.

+

+ +
Sticker::delete(string $name = '') : bool
+ +

Parameters

+
    +
  • $name

    If omitted all sticker values will be deleted.

  • + +
+ +

Returns bool

+

+

bool true on success or false on failure.

+

+
+ + +
+

list

+

+

Returns an associative array containing sticker names and values of the specified object.

+

+ +
Sticker::list() : mixed
+ +

Parameters

+
    + None. +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + +
+

find

+

+

Search the sticker database for sticker with the specified name and/or value in the specified $uri

+

+ +
Sticker::find(string $name, string $operator = '', string $value = '') : mixed
+ +

Parameters

+
    +
  • $name

    The sticker name

  • +
  • $operator

    Optional. Can be one of =, < or >. Only in combination with $value.

  • +
  • $value

    Optional. The value to search for. Only in combination with $operator.

  • + +
+ +

Returns mixed

+

+

array|false array on success or false on failure.

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/classes/Utils.html b/docs/v1.2.6/classes/Utils.html new file mode 100644 index 0000000..31b170d --- /dev/null +++ b/docs/v1.2.6/classes/Utils.html @@ -0,0 +1,110 @@ + + + + MphpD - Utils + + + + + + + + + + +
+ +

Utils

+

Class containing several utility or helper functions.

+ +
+ +

Methods

+ + +
+

escape_params

+

+

Function to parse an array of given parameters.

+

+ +
Utils::escape_params(array $params, int $flags = 4) : string
+ +

Parameters

+
    +
  • $params

    Array of strings.

  • +
  • $flags

    One or multiple OR-ed together of the following:

    +
      +
    • MPD_ESCAPE_NORMAL - "beetle's juice" becomes "\"beetle\'s juice\""
    • +
    • MPD_ESCAPE_DOUBLE_QUOTES - "beetle's juice" becomes "\\"beetle\'s juice\\""
    • +
    • MPD_ESCAPE_PREFIX_SPACE - Adds a space at the params beginning
    • +
    • MPD_ESCAPE_SUFFIX_SPACE - Adds a space at the params ending
    • +
  • + +
+ +

Returns string

+

+

string

+

+
+ + +
+

pos_or_range

+

+

Function to "convert" int or array to a pos or range argument

+

+ +
Utils::pos_or_range( $p) : mixed
+ +

Parameters

+
    +
  • $p
  • + +
+ +

Returns mixed

+

+

int|string

+

+
+ + +
+

parse_error

+

+

Function to parse an MPD error string to an array

+

+ +
Utils::parse_error(string $error) : FloFaber\MphpD\MPDException
+ +

Parameters

+
    +
  • $error

    The error string. For example "ACK [error@command_listNum] {current_command} message_text"

  • + +
+ +

Returns FloFaber\MphpD\MPDException

+

+

\MPDException

+

+
+ + + +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/guides/Commandlist.html b/docs/v1.2.6/guides/Commandlist.html new file mode 100644 index 0000000..484c5dc --- /dev/null +++ b/docs/v1.2.6/guides/Commandlist.html @@ -0,0 +1,52 @@ + + + + MphpD Guides - Commandlist.md + + + + + + + + + + +
+

Command lists

+

MPD supports what's called command lists. You can start a command list, +insert a few commands and then end, say execute, it. +No command is executed before the command list is ended.

+

It should mainly be used for commands which don't return anything other +than OK or ACK. add is such a command, for example. +However, you can use it as you like with all commands the MPD protocol has to offer and +still get everything returned and parsed as you wish.

+

Keep in mind that command lists are only useful when performing a lot of commands at once as they are +designed to reduce overhead in such situations. +They do not help you much when adding 10 songs to the queue. +Use the library's built-in functions in combination with a loop for such small amounts.

+

The execution of a command list is stopped in case an error occurs.

+

Methods

+ +


+

You may want to have a look at the MPD Protocol documentation for all available commands.

+
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/guides/Configuration.html b/docs/v1.2.6/guides/Configuration.html new file mode 100644 index 0000000..bce29ae --- /dev/null +++ b/docs/v1.2.6/guides/Configuration.html @@ -0,0 +1,59 @@ + + + + MphpD Guides - Configuration.md + + + + + + + + + + +
+

Configuration

+

You can pass the following settings to MphpD when initializing it:

+
use FloFaber\MphpD\MphpD;
+$mphpd = new MphpD([
+  "host" => "127.0.0.1",
+  "port" => 6600,
+  "timeout" => 5,
+  "password" => "beetlejuice",
+  "binarylimit" => 8192
+]);
+

All of those are optional. If one is not specified the default value is used. See below.

+

Host

+

String. Specifies the IP to which MphpD should connect.

+

If prefixed with unix: the path to MPD's Unix socket. Example: unix:/var/run/mpd.sock

+

Default: 127.0.0.1

+

Port

+

Int. The port on which MPD is listening.

+

Default: 6600

+

Timeout

+

Int. Defines the connect-, read- and write-timeout in seconds.

+

Default: 1

+

Password

+

String. The plaintext password used for authentication on MPD.

+

Default: empty string

+

Binarylimit

+

Int. The maximum number of bytes a binary chunk returned by MPD can have.

+

A bigger value means less overhead. Don't change it if you don't experience any problems with the default value.

+

Only supported on MPD v0.22.4 and newer. It's simply ignored and set to 8192 on older versions.

+

Default: 8192

+
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/guides/Range.html b/docs/v1.2.6/guides/Range.html new file mode 100644 index 0000000..5b5218d --- /dev/null +++ b/docs/v1.2.6/guides/Range.html @@ -0,0 +1,46 @@ + + + + MphpD Guides - Range.md + + + + + + + + + + +
+

Ranges

+

Some methods, like Queue::delete allow specifying a Range of songs instead of a single position.

+

Here they are implemented by simple arrays containing two ints. +The first one is the start and the seconds one is the end.

+

The end is excluded like in Python Ranges. +If you specify [10,20] the first song will be 10 but the last song will be 19. +Keep that in mind.

+

If end is omitted (an array containing only a single item), it's interpreted as an open end. +So all songs from start are affected.

+

Usage

+

For example, if you wanted to remove songs 5-20 from the Queue you want to do the following:

+
use FloFaber\MphpD\MphpD;
+$mphpd = new MphpD(...);
+$mphpd->queue()->delete([5,21]);
+

Or if you want load all songs from a playlist starting at 30 until the end:

+
$mphpd->playlist("keygen")->load([30,]);
+
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/index.html b/docs/v1.2.6/index.html new file mode 100644 index 0000000..81a61bd --- /dev/null +++ b/docs/v1.2.6/index.html @@ -0,0 +1,111 @@ + + + + MphpD + + + + + + + + + + +
+

A fully-featured, dependency-free PHP library for MPD

+

MphpD is a library for the Music Player Daemon. +It lets you control MPD from within your PHP application in a simple and object-oriented +way while also taking care of escaping, parsing, error reporting and all the other +painful stuff.

+

The whole MPD protocol is supported!

+
+

Warning

+

This Library as well as it's documentation is rather young and therefore not perfect.

+

Please report any bugs or issues you encounter here. Thanks.

+
+

Installation

+

You can either install this library by using composer:

+
composer require flofaber/mphpd
+

and then autoload it:

+
require_once __DIR__ . "/vendor/autoload.php";
+

or by simply downloading it and including it in your code like so:

+
require_once __DIR__ . "/MphpD/MphpD.php";
+

Usage

+

Create a new MphpD instance:

+
use FloFaber\MphpD\MphpD;
+use FloFaber\MphpD\MPDException;
+
+$mphpd = new MphpD([
+  "host" => "127.0.0.1",
+  "port" => 6600,
+  "timeout" => 5
+]);
+

and connect to MPD

+
try{
+  $mphpd->connect();
+}catch (MPDException $e){
+  echo $e->getMessage();
+  return false;
+}
+

Example

+

Here are some examples of what you can do with it:

+
// get MPD's status like current song, volume, state, etc...
+$status = $mphpd->status();
+
+// if you only want to retrieve only one (or more) values
+// you can pass it a list of keys.
+$state = $mphpd->status([ "state" ]);
+
+// clear the queue
+$mphpd->queue()->clear();
+
+// load the first 10 songs of a playlist into the queue and exit on failure.
+if(!$mphpd->playlist("some-playlist")->load([0,10])){
+  echo $mphpd->get_last_error()["message"]; // prints "No such playlist"
+  return false;
+}
+
+// shuffle the queue
+$mphpd->queue()->shuffle();
+
+// adjust volume to 40%
+$mphpd->player()->volume(40);
+
+// start playing
+$mphpd->player()->play();
+

For further information have a look at the Documentation.

+

Supported PHP versions

+ +

Required PHP extensions

+ +

Required PHP functions

+

A list of PHP functions required by MphpD for socket communication:

+ +
+
© 2023 Florian Faber
+ + + + diff --git a/docs/v1.2.6/overview.html b/docs/v1.2.6/overview.html new file mode 100644 index 0000000..b749d83 --- /dev/null +++ b/docs/v1.2.6/overview.html @@ -0,0 +1,578 @@ + + + + MphpD - Overview + + + + + + + + + + +
+ +

Versions

+ + + + +

Changelog

+ + +

Guides

+ + +

Classes

+ + +

Methods

+ + +
+
© 2023 Florian Faber
+ + + +