The configuration files ~/.empxformrc or /usr/share/empxform/empxformrc, /usr/local/share/empxform/empxformrc are read when the application starts. They contain some general configuration information and a list of default formats in the <options> section followed by a list of format specifiers. Each <format> section describes a set of actions to take based on the contents of the emp file.
The DTD describing the configuration file format is available from sourceforge.
The following variables are may be used anywhere text is accepted in the config file.
%P - provider name
%T - package title (The album name on emusic)
%A - the track artist (or 'Various Artists' if more than 1 was found)
The following variable modifiers can be used to make variables more shell friendly. Each of the following characters are considered as special: "\'<>[]()\/~!#$&|; and the space character.
%'X - remove quotes & / chars from %X
%\X - escape all special shell chars in %X
%_X - remove all special shell chars from X & change spaces to underscores
%-X - remove all special shell chars from X
%!X - convert all /'s to - in X
The options section specifies the working directory for the program (the application will change to this directory before doing any work) followed by a list of default formats to use if none are sepcified on the command line. The following example shows a valid options section that downloads albums & creates playlists by default.
<options working-dir="~/My Music">
<default-format name="playlist-m3u"/>
<default-format name="download-wget"/>
</options>
Each format defines a template to use when processing the rmp file. The template sepcifies the name of any other formats to run first, the name (if any) of the output file, the contents of the file and an optional program to run when processing is complete. Each <format> section contains one or more of the following tags:
<desc>- This is the only compulsory tag, it should contain a brief description of the format.
<run-format name="XXX"> - The name of a format to run before processing this format. There may be 0 or more other formats.
<filename> - The name of the output file to generate releative to the working directory. If this tag is omitted output will be written to standard out.
<begin> - Text to place at the begining of the ouput file.
<track> - Text to generate for each track in the emp file, this would normall contain 1 or more substitution variables based on the track information.
<end> - Text to place at the end of the output file.
<exec> - The shell command line to run after processing has been completed.
The shell pattern ~ is expanded to the current users home directory but ~useranme is not understood.
<format name="play-sound">
<desc>Play Some Music when finished</desc>
<exec>cat /music/finished.au > /dev/dsp</exec>
</format>
Add <default-format name="play-sound"/> as the last entry in the options section of the config file.
<empxform>
<options working-dir="~/My Music">
<default-format name="playlist-m3u"/>
</options>
<format name="playlist-m3u">
<desc>Create a m3u format playlist</desc>
<!-- assume we downloaded to 'Artist_Name/Album_Name' -->
<filename>%'A/%'T/%T.m3u</filename>
<begin>#EXTM3U</begin>
<!-- add extended info for the duration, artist & track name -->
<track>#EXTINF:%D,%a: %t</track>
<!-- assume we named the tracks like '01 - some_track.mp3' -->
<track>%n - %f</track>
</format>
</empxform>