Audio::RPLD(3pm) | User Contributed Perl Documentation | Audio::RPLD(3pm) |
Audio::RPLD - Module to communicate with RoarAudio PlayList Daemon
use Audio::RPLD; # Open new connection my $rpld = Audio::RPLD->new([$addr[, $type[, $port]]]); # Work with the connection $rpld->play(); $rpld->stop(); #... # close the connection $rpld->disconnect(); # reconnect: $rpld->connect($addr[, $type[, $port]]);
This module is used to communicate with a RoarAudio PlayList Daemon (rpld). It includes support for nearly all of the protocol.
Here is a list of all the arguments used in this documentation so I do not need to explain later for each method again.
Do not limit the user to hostname or filenames or something. The user should be abled to enter any server location in a freeform text input.
If a song does not include a UUID in it's meta data the server will generate a random one so each song has one.
Those UUIDs can also be used together with the Tantalos protocol.
As of rpld 0.1rc7 multi queue support was added. To support this pointers can have a queue and client ID suffix. The suffix has the syntax: pointer[queue:client]. Both queue and client can be omitted. If the client ID is omitted the colon (':') can be omitted, too. If both are omitted the brackets ('[]') can also be omitted. Queue defaults to the current client's default queue and client defaults to the current client.
The following return types are used by methods in this module:
$rpld = Audio::RPLD->new([$addr[, $type[, $port]]])
This method creates a new Audio::RPLD object. If arguments are passed they are directly passed to a call to the connect method (see below) in order to connect to the server. If this fails undef is returned. If no arguments are given you need to connect the object to the server via the connect method later on your own.
$res = $rpld->connect($addr[, $type[, $port]])
Connect to a server. You must not call this on a already connected object.
$res = $rpld->connect_default()
Connect to a server by trying default locations. You must not call this on a already connected object.
$res = $rpld->disconnect()
Disconnect from the server. You may use $rpld->connect() again to connect to a (new/different) server.
$res = $rpld->is_connected()
Returns true value if the object is currently connected to a server or undef if not.
$res = $rpld->identify([%options])
This identifies the process at the server. An optional list of options is taken. Each key-value pair is send to the server as it is.
Currently supported keys are: name, pid, nodename and hostid.
This command is send automatically at connect. You only need to call this manually if want to set one of those options. It is recommended to do this at least for the application name.
$any = $rpld->any()
This function returns a value that can be used as playlist wildcard.
$res = $rpld->noop()
Send a NOOP command to the server.
This can be used to ping the server or for keep-alive.
$res = $rpld->serverinfo()
Send a SERVERINFO command to the server.
This tells basic information about the server like it's version and location.
The return value is a hashref which contains the following keys (all keys may or may not be set depending on what info the server provides):
$res = $rpld->store()
Ask the server to store (dump) all data on permanent storage (disk). This is normally used at exit to save all the playlists on disk so they can be restored at next startup.
$res = $rpld->restore()
Restore from disk. This is normally done at startup time (by rpld itself). You should not call this again if the server already restored it's state because this may result in undefined behavior. Current behavior of rpld is that it forgets the complete current state and loads the new state. This was changed in version 0.1rc7. Before version 0.1rc7 it added everything to the current state resulting in duplicates. This may change in future.
$res = $rpld->play()
Start playback.
$res = $rpld->stop()
Stop playback.
$res = $rpld->next()
Skip to next song.
$res = $rpld->prev()
Skip to previous song.
$res = $rpld->isplaying()
Return a true value if we are currently playing.
$res = $rpld->showidentifier()
Return a identifier for the currently running stream at the server. The format of this identifier is undefined. This should not be used. Using this value can result in race conditions.
$res = $rpld->flushq()
Flush the Main Queue. Playback is stopped (because no songs are left in the queue).
$res = $rpld->showcur()
Return the Playlist entry for the current song (if playback is running this is the currently played song). This contains information about this song from the playlist. If you want to read the current meta data or other live data use $rpld->showplaying().
The return value is in the same format as that of $rpld->showple(). See $rpld->showple() for more information on it.
$res = $rpld->showplaying()
Returns live information on what is currently played.
The return value is a hashref which contains the following keys (all keys may or may not be set depending on what info the server provides):
$res = $rpld->listq([$playlist])
List playlist entries of the Main Queue or the given playlist. This is the same as $rpld->listple() expect that the default playlist is the Main Queue not the currently selected playlist.
$res = $rpld->showqueue([$playlist])
Returns a hashref with information about the given list or the current queue if no list is given. The structure of the hashref is the same as for listplaylist(). This function is the same as showlist() but returns the current queue as default of no list is given.
$res = $rpld->setvolume($vol)
Set volume to $vol.
$res = $rpld->showvolume()
Return a hashref to a hash containing volume information.
The hash contains the following keys:
The current volume (as float) is value/scale.
$res = $rpld->pause()
Set the playback in pause mode.
You should not use this function but $rpld->togglepause() if possible.
$res = $rpld->unpause()
Unpause the playback.
You should not use this function but $rpld->togglepause() if possible.
$res = $rpld->togglepause()
Toggle the pause state. This is the recommended function to change the pause state of playback.
This is because it interacts best with other applications changing the current pause state.
$res = $rpld->setplaylist($playlist)
Select the given playlist. After selecting a playlist it becomes the default playlist for most operations which take a optional playlist argument. (Operations for which this does not set the default are marked in the corresponding description).
$res = $rpld->addplaylist($name)
Add a playlist.
$res = $rpld->delplaylist($playlist)
Delete a playlist. All entries are deleted, too.
$res = $rpld->flushplaylist($playlist)
Flush a playlist. If this is used on the Main Queue the playback is stopped as no songs are left to play.
$res = $rpld->listplaylist()
Get a list of playlists known by the server. This returns a arrayref to a array containing a hashref for each list. This hash contains the following keys:
Parent/child information should be used to display a tree to the user.
$res = $rpld->showlist($playlist)
Returns a hashref with information about the given playlist. The structure of the hashref is the same as for listplaylist().
$res = $rpld->setparentlist($playlist)
Set the parent playlist of the current playlist. Setting parent playlist of a list the current one is currently not supported.
$res = $rpld->setqueue($playlist)
Select the given playlist as queue. After selecting a queue it becomes the default queue for the current connection.
$res = $rpld->delqueue($playlist)
Delete a queue from a playlist. The playlist will not be removed just the queue.
$res = $rpld->addqueue($playlist, $history[, $backend[, $mixer[, $role]]])
Add a queue to playlist $pl with the playlist $history as history. Optionally the server to connect to can be given as $backend and the mixer to connect to as $mixer. In addition the stream role can be set using $role.
$res = $rpld->addhistory($playlist, [$size])
Add a history to the playlist. The history size can be set using the optional argument $size. If not given the server's default will be used.
$res = $rpld->delhistory($playlist)
Delete a history from a playlist. The playlist will not be removed just the history.
$res = $rpld->delple($ple[, $playlist])
Delete the given playlist entry.
$res = $rpld->queueple($ple[, $playlist[, $pos]])
Queue the given playlist entry. This means it is copied over to the Main Queue. This function is recommended over $rpld->copyple() to queue songs.
The optional position is used to give the place in the playlist where to queue the song. It is counted as 'n entries after the first one'. This means if you pass a value of zero the song is placed as next song. If you pass a value of one it is placed as the song after the next song and so on. A value of -1 means that it is added before the first one. If you place a song before the first one in the Main Queue playback is stopped and restarted so this song becomes the currently played song.
If you omit the position or pass undef the default behavior is to add at the end of the playlist which should be the default in your applications, too.
$res = $rpld->copyple($ple, $playlist_from, $playlist_to[, $pos])
The given playlist entry is copied from the playlist $playlist_from to the playlist $playlist_to. If $playlist_from is undef the currently selected playlist is used as source.
For the meaning of the position parameter ($pos) see $rpld->queueple() above.
$res = $rpld->moveple($ple, $playlist_from, $playlist_to[, $pos])
The given playlist entry is moved from the playlist $playlist_from to the playlist $playlist_to. If $playlist_from is undef the currently selected playlist is used as source.
For the meaning of the position parameter ($pos) see $rpld->queueple() above.
$res = $rpld->listple($playlist)
List all playlist entries from the given playlist. The return value is an arrayref with elements as if they are returned by $rpld->showple(). See $rpld->showple() for more info about the return format.
Note: You should avoid calling this too often as it returns a large amount of data. You also should not store data for currently not used playlists (for example only store data for the playlist currently shown to the user).
$res = $rpld->searchple($needle, $op, $src, [$pli, [$opts]])
List playlist entries matching a given rule. The return value is the same as for $rpld->listple().
This function accepts the following arguments:
Currently the following options are defined. For negative versions see $opts.
This can be undef, a scalar value, $any or a arrayref.
$any matches any information within the PLE. If an arrayref is used the array must consist of one or two elements. The first element is the source. The second is the sub-source. Valid values depend on the server software. As of version 0.1.5 RoarAudio PlayList Daemon supports: ALBUM, TITLE, ARTIST, PERFORMER, VERSION, FILENAME, DISCID, UUID, GENRE, TRACKNUM[BER] and TAG:"Tagname". Not all of them can be used with all kinds of needles. If $src is a scalar value it is interpreted as ['TAG', $src] or [$src] depending on the needle. If this is undef the source is selected by the type of needle with string needles defaulting to $any.
$res = $rpld->showple($ple[, $playlist])
Return data of the given playlist entry. If no playlist is given the currently selected one is used.
The return value is a hashref with the following keys:
The following keys may be included. All are optional. Other keys may also be included.
$res = $rpld->like($ple[, $likeness])
Tells the server that the user likes this entry. Optionally tells the server how much. A value of +1.0 is the default if no value is given. This is added to the likeness value stored by the server. A value of zero has no effect. A negative value indicates dislikeness. See dislike() for more information about dislikeness.
$res = $rpld->dislike($ple[, $likeness])
This is the same as like() just marks a the given entry as disliked. Optionally tells the server how much. A value of +1.0 is the default if no value is given. The value is subtracted from server's value. A value of zero has no effect. A negative value indicates likeness. See like() for more information about likeness.
$res = $rpld->setpointer($pointer, $ple[, $playlist])
Set the given pointer to the given playlist entry. If no playlist is given the currently selected one is used.
$res = $rpld->unsetpointer($pointer)
Unset the given pointer.
$res = $rpld->showpointer([$pointer])
Returns information about the given or all pointers.
The return value is a hashref with keys of the pointer names. The values for those keys are a hashref containing information on the corresponding pointer. If the hashref for the pointer points to a empty hash (no keys defined) then the pointer is not defined.
If the pointer is defined the following keys are contained:
$res = $rpld->listclients()
Get a list of clients connected to the server. This returns a arrayref to a array containing a hashref for each client. This hash contains the following keys:
Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009-2012 This file is part of Audio::RPLD, a library to access the RoarAudio PlayList Daemon from Perl. See README for details. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation. Audio::RPLD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this software; see the file COPYING.gplv3. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2021-01-08 | perl v5.32.0 |