DEV Community

No Name Pro
No Name Pro

Posted on

How to create a Playlist as File

Hello 👋

you want to create a playlist for a party to a file which runs on every PC?

The best way is a XSPF-File.
It's simply just a XML File. JSON?

I know it, it's nothing for development. But i think this article can for many people be helpfull

Create a file

First create a File named playlist.xspf with this content.

<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
    <trackList>
        <track><location>Song.mp3</location></track>
        <track><location>Directory/AnotherSong.mp3</location></track>
        <track><location>SongWith%20Space.mp3</location></track>
        <track><location>http://song.from/internet.mp3</location></track>
    </trackList>
</playlist>

Add some Metatags

If you want to add some metatags to the playlist, open the file and add in the <playlist>-Element:

<!-- title of the playlist -->
<title>My best tracks for the party</title>

<!-- name of the author -->
<creator>No Name Pro</creator>

<!-- website of the author -->
<info>https://dev.to/nonamepro0</info>

And add Meta-Tags (like Custom-Name) for the Tracks in the <track>-Element:

<!-- artist or band name -->
<creator>Led Zeppelin</creator>

<!-- album title -->
<album>Houses of the Holy</album>

<!-- name of the song -->
<title>No Quarter</title>

<!-- comment on the song -->
<annotation>I love this song</annotation>

<!-- song length, in milliseconds -->
<duration>271066</duration>

<!-- album art -->
<image>http://images.amazon.com/images/P/B000002J0B.01.MZZZZZZZ.jpg</image>

<!-- if this is a deep link, URL of the original web page -->
<info>http://example.com</info>

Check if playable

You can open this File with VLC to check if the File is readable and playable for the XSPF Format.

You can use another app, which is listed here: https://xspf.org/applications/

If you want a JSON (JSPF)

Check out: https://xspf.org/jspf/

If you have questions

Then write a comment or check the offical informations from XSPF out: https://xspf.org/

Another examples

Are here: https://xspf.org/quickstart/ :)

Top comments (0)