Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

audio::rpld(3pm) [debian man page]

Audio::RPLD(3pm)					User Contributed Perl Documentation					  Audio::RPLD(3pm)

NAME
Audio::RPLD - Module to communicate with RoarAudio PlayList Daemon SYNOPSIS
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]]); DESCRIPTION
This module is used to communicate with a RoarAudio PlayList Daemon (rpld). It includes support for nearly all of the protocol. METHODS
Common Arguments Here is a list of all the arguments used in this documentation so I do not need to explain later for each method again. $addr The Address of the server. This can be a filename or host or nodename. If the type is known to you, you should set the $type argument. 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. $type This is the type of the address of the server. Currently defined types are: UNIX Use a UNIX socket to connect to the server. DECnet Use a DECnet socket to connect to the server (currently not supported because there is no IO::Socket::DECnet yet). INET Use a INET (IPv4) socket to connect to the server. #SOCKET Use a already connected socket as connection to the server. This can for example be a object opened with a SSL/TLS or proxy module or any other bidirectional IO object. Object is passed as $addr parameter. a value of undef Use Autodetection. $port If using a INET socket this is the port number to connect to. Use undef (not include in arguments list) to use defaults. $playlist, $playlist_from, $playlist_to, $history A Playlist to use. This can be a integer to use the playlist ID (which is preferred), a string to use the playlist name or $any (return value of $rpld->any()) to search thru all playlists and use the first hint. $any is not supported by all commands as it does not make sense for all commands. $vol A volume. If this is an integer the volume is in range 0 to 65535 (recommended). If it's a string and suffixed by a '%' it is in range 0 to 100. A value of zero always means total silence. $size A history size. This is an integer or undef. If undef the server's default is used. $backend The address of a RoarAudio server as used as backend for a queue. If undef the default server will be used. $mixer The mixer ID of the mixer core which should be used by a queue. If undef the server's default mixer core will be used. This should normally be undef. $role The stream role as used by a queue. This is the name or undef to use rpld's or RoarAudio server's default. This is the name of the role not the ID. Common values include "music" and "background_music". $likeness A floating point describing how much the user likes a song. $name A string of a name of some object. $ple A Playlist entry (item) identifier. This is a string of one of the several types. Here is a quick overview: Long Global Track Number The long GTN is a hex string (with leading 0x) prefixed by 'long:' with a length of 64 bit (16 raw digits). It is used to identify a playlist entry within the runtime of the server process. This one is the one you normally use for all operations like queuing a track for playback. Short Global Track Number The short GTN is a shorter (only 32 bit) version of the GTN prefixed with 'short:'. It's use is exactly the same as for the long GTN. It exists to get the GTN passed thru things which do not support more than 32 bit. As this is normally not the case for Perl (you pass them around as strings anyway) you should not need to use it at all. It's not recommended to use this one. UUID The UUID is a string prefixed with 'uuid:' followed by the normal hex-dash notation (example: uuid:54ab0c5f-b058-4c9b-ab3b-dea11b608482). It is used to identify a song. In contrast to the GTN this is not changed by commands such like copy or move operations. The normal use for this is if you want to store something over multiple runtimes of the server process like favorites or something. 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. Pointer A pointer is a string (the pointer name) prefixed by 'pointer:' (example: pointer:default). Those are used to have symbolic pointers a playlist entry. The following pointers are currently known by rpld: default If the Main Queue runs out of songs and the current pointer reached the end of the current playlist the current pointer is set to this value and song lookup is done again. For details about the current pointer see below. current If the Main Queue run out of queued songs the song this pointer points to is automatically queued and this pointer is set to the next entry the the playlist. This is used for 'start here and just play the playlist' behavior. If this pointer reaches the end of the playlist it becomes undefined and if the default pointer is set redefined with it's value. See above for more information about the default pointer. startup If the startup pointer is set the song it points to is added once at startup of the daemon. This can for example be used to implement boot sounds. temp The temp pointer is a pointer for user defined jobs. It is the only pointer which is not global (shared with all clients) but a client local pointer. The application can use it for whatever it wants to use it for. 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. Numerical Index This is a numerical index of the entry. It's format is num:N where N is the index starting with zero. For example num:0 is the first entry in playlist, num:15 is the 16th entry. Likeness Index This is like the normal numerical index just uses the likeness values of the entrys. This is hardly of use to the user and mainly for internal use. Syntax is likeness:F with F the floating point index. Random Entry A Random entry can be selected by using random:[PLI]. PLI is a optional parameter. It musst be the ID of the playlist to select entry from. If no playlist is given the current one is used. Random liked Entry This is like normal random entry but prioritized by the value set with LIKE and DISLIKE commands. Syntax is: randomlike:[PLI]. $pointer A Pointer. This is a string of the pointer name. It is not prefixed with 'pointer:' as when used as PLE. Common return values The following return types are used by methods in this module: $rpld The instance of this module as returned by new(). $res A general return value. This is undef in case of failure or a defined value in case of no error. The value may be a string, hash- or arrayref depending on the method. See description of the method for details. $any The return value of any(). This can be used as wildcard for playlist names in some cases. Basic functions $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. Special values $any = $rpld->any() This function returns a value that can be used as playlist wildcard. Basic communication functions $res = $rpld->noop() Send a NOOP command to the server. This can be used to ping the server or for keep-alive. Storing and restoring $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. Playback control $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. Queue control $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): state A string of the current playback state in uppercase. Possible values include: STOPPED, PAUSE, RUNNING. longgtn The long GTN of the current ple. shortgtn The short GTN of the current ple. uuid The UUID of the current ple. time A hash containing keys for the current playback time in different units. The unit name is the key name. Units may include: samples, s. meta A hash containing keys for each meta data type provided by the server. Types may include: title, album, artist, performer, version. mduc The meta data update counter (MDUC) for current playback. rate The sample rate of the current playback. channels The number of channels of the current playback. bits The number of bits of the current playback. $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. Volume control $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: value The current playback volume in units of scale. scale The unit of value. pc The volume in percent. The current volume (as float) is value/scale. Controlling pause state $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. Playlist management $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: id The ID of the playlist. parent The ID of the parent playlist. name The name of the playlist. children A arrayref with the IDs of the children playlists. history_size (optional) The size of the history if this is a history. This is the number of PLEs this playlist will store before old entrys becomes deleted automatically. history (optional) The PLI of the playlist used as history if this is a queue. volume (optional) The playback volume if this is a queue. backend (optional) The backend used by this queue (if this is a queue). The backend is the name (server address) of the RoarAudio server. mixer (optional) The ID of the Mixer used on the RoarAudio server. -1 for default. Only set if this is a queue. role (optional) The Stream role used by this queue. Often "music" or "backround_music". Only if this is a queue. 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. Queue management $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 tp 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. History management $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. Playlist Entry management $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->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: codec (optional) The name of the used codec. length (optional) The playback length in sec. file The filename. This may be anything supported by RoarAudio's DSTR. Including local files, web radio streams and other types. meta The value for the meta key is a hashref of it's own to a list of provided meta data. The following keys may be included. All are optional. Other keys may also be included. album Name of the album. title Title of the song. artist Name of the Artist. performer Name of the performer for this record. version Version of this record. discid CDDB DiscID for this song. tracknumber Tracknumber of this song in the album. totaltracks Total number of tracks in this album. genre Genre of this song. genreid Genre ID of this song. longid The long GTN for the entry. shortid The short GTN for the entry. uuid (optional) The UUID for the entry. likeness (optional) The likeness value stored by the server. This is a float in rage from zero to infinity. The bigger the value is the more the song is liked. $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 indecates dislikeness. See dislike() for more information about dislikeness. $res = $rpld->dislike($ple[, $likeness]) This is the same as like() just markes 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 indecates likeness. See like() for more information about likeness. Pointers $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->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: raw The playlist entry the pointer points to in a raw format. longid (optional) If the pointer contains an information about the playlist entries long GTN this GTN. shortid (optional) If the pointer contains an information about the playlist entries short GTN this GTN. uuid (optional) If the pointer contains an information about the playlist entries UUID this UUID. random (optional) If the pointer points to a random song within a playlist this contains the corresponding search string. randomlike (optional) If the pointer points to a random song (respecting likeness) within a playlist this contains the corresponding search string. playlist (optional) If the pointer contains a playlist hint this contains the playlist ID. SEE ALSO
AUTHOR
Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org> LICENSE
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. perl v5.14.2 2012-05-13 Audio::RPLD(3pm)
Man Page