M3UtoXSPF

Overview

M3UtoXSPF is a Java based command line utility that converts M3U files to XSPF files. M3U and XSPF are playlist formats. Skip forward to the download section for instructions on downloading M3UtoXSPF if you'd rather not read this.

Additional documentation can be found in the README file found here and in the JAR file.

This certainly isn't the only utility that manipulates XSPF and or produces XSPF files. A list can be found here. Some highlights include:

  • fspiff - This utility is nice, but oddly I could not get it to write location elements to the XSPF.
  • m3u2xspf - I like how this utility is simple and standalone, but it does not populate per track elements other than the location

It's the author's hope that M3UtoXSPF will be useful by being simple, standalone and by populating both the location elements as well as other elements from user definable external tools.

Download

The latest JAR file may be downloaded by clicking here. The source code is included in the JAR file.

Install

Copy the downloaded JAR file to wherever you like to keep JAR files. Optionally rename the file to simply m3utoxspf.jar. Also, optionally make the JAR executable if your system supports executable JAR files. Finally, optionally make sure the executable JAR file is in your path.

Syntax

m3utoxspf.jar typically takes a list of M3U files that it then converts to XSPF files, but it can also be used as a pipe. Ideally the system should have executable JAR files in which case m3utoxspf.jar can simple be invoked as shown in the examples. If not m3utoxspf.jar should be replaced with java -jar m3utoxspf.jar. The usage, which can be seen by running m3utoxspf.jar without any arguments, is:

Usage: m3utoxspf.jar [options] m3u1 [m3u2 [...]]
Options:
  --                  The remaining arguments are non-option arguments.
  -f                  Fast mode - don't run external information commands.
  -h                  Help (this usage statement)
  -v                  Verbose
  -o xspf             Output XSPF filename
  -t title            Title to use.  Default is the M3U basename.
  -x external_icmd    Add or override an external information command.
                      Format: <type>,<command>[,<separator>]
                      Current external information commands (note trailing 
                      spaces):
    ogg,ogginfo,=
    mp3,eyeD3 --no-color,: 

Examples

The README file should be consulted for various examples. However, here is what the simplest possible example looks like:

m3utoxspf.jar example.m3u

The above reads from example.m3u and writes to example.xspf.

Here is a more complicated example:

find . -name '*.mp3' -o -name '*.ogg' > example.m3u
m3utoxspf.jar -x mp3,mp3show,^ -x ogg,oggshow,^ -t example-songs -v example.m3u */example.m3u

The above first creates (find command) example.m3u and then uses the fictional external information commands mp3show and oggshow to gather information to build example.xspf. The README file elaborates on these two external information commands. The title (-t) is set to example-songs. The verbose (-v) switch is used to provide additional information. The trailing */example.m3u means that the same thing is done for each example.m3u for in each child directory.

License

This utility is covered by the GPL license version 2 or later. A copy of the license is included in m3utoxspf.jar file. The GPL version 2 license can also be found at http://www.gnu.org/licenses/gpl-2.0.txt

Contact

Feedback may be given by posting comments here. The latest version of this code should always be here.