The mediaplayer interface moduleInterface to various media players
|The mediaplayer module is an interface to various popular media players.
It allows controlling them remotely to a certain degree and retrieving
the informations about the currently played media (in order to implement the nice /playing
scripts). The module has replaced the old mediaplayer module which after
years of development had developed some design flaws and needed a complete rewrite.
At the moment of writing the supported players are: xmms (unix), audacious (unix), winamp (windows),
amarok (kde) and juk (kde). You choose the player interface by either setting
the option in the settings dialog, by manually setting option stringPreferredMediaPlayer
or by running mediaplayer.detect that will guess the media player interface for you.
If you're going to use the Winamp media player then you must install the "gen_kvirc.dll" plugin (included in the kvirc distribution) as a "general" winamp plugin. This is achieved by simpy copying the file gen_kvirc.dll to the winamp plugins directory and restarting winamp.
The commands and functions exported by this module serve mainly for two purposes: control the playback and get informations about the currently played media. Playback control is achieved by the means of mediaplayer.play, mediaplayer.stop, mediaplayer.pause, mediaplayer.next, mediaplayer.prev and $mediaplayer.status(). The informations about the currently played media can be retrieved with $mediaplayer.nowplaying() and $mediaplayer.mrl(). Several other informative function are available as well but they are not granted to work with all the supported media players or media types (e.g. with winamp you can play video files that probably have no album, genre or sampleRate information...).
If you intend to write portable code, you should check the return value of the functions like $mediaplayer.artist(), $mediaplayer.title() or $mediaplayer.channels() and be ready to discard it when it does not appear to be meaningful. The functions that are granted to work are $mediaplayer.nowplaying(), $mediaplayer.mrl() and $mediaplayer.localfile().