About News Download

Native Playlist Generators

Playlist generators are programs that create a playlist on the fly in KMPlayer's native playlist format.

These processes are started when the user activates one of the menu items from the Playlist | Generators menu. This menu itself is created by reading all files in /usr/share/applications/kmplayer/generators/ and the generators/ sub-directory of the user's kmplayer settings directory (which defaults to /home/user/.kmplayer/generators/).

Generator Files

These files describe which program to start and which arguments to pass using XML. The format is like this example
<generator name="My Generator">
In order for KMPlayer to find the program (myscript.sh in the above example), it is either in the PATH environment variable, it is specified as full path or can be prepended by
      <predefined key="data"/>
The predefined tag is substituted by the user data directory (which defaults to /home/user/.kmplayer/). A key set to sysdata is always /usr/share/applications/kmplayer/.

The program should write a valid KMPlayer's native playlist format to stdout. This is read by KMPlayer and finally shown as the active list.

Because generators may want to read from a network stream, eg. reading a remote XML file, a process tag can be preceded by an input tag, like this example:

<generator name="My Generator">
KMPlayer will open the uri and write the contents to the process' stdin.

Finally in the generator XML file, parts of the literal text can be composed using user input using the ask tag, eg.

<ask key="mygenerator-keywords" default="abc">
    Search terms
    Please enter search terms
and will prompt the user to enter some text.
The key tag can be used to store previously entered text in the gconf database.The default tag can be used to give the user a sane default, which in case also key is set, will only be shown on the first invocation of this generator.
The ask tag can have an attribute type, which can be either dir or file to show a directory or file dialog resp. Eg
<ask type="dir" key="mygenerator-dir"/>
will prompt the user for a directory.
Note, since their is no limitation what kind of program is started, a program itself can present the user dialog for options.

See the generators files shipped with KMPlayer for some examples and some more supported tags.