Login
RemiXspf
Login

RemiXspf

RemiXspf is a small library for reading and writing playlists in the XSPF (XML Sharable Playlist Format) format and the related JSPF format. It is written entirely in Crystal and has no dependencies outside of the standard library.

Wanna support Remilia? Buy me a coffee on Ko-Fi, or support me through Liberapay.

Buy Me a Coffee at ko-fi.com Donate using Liberapay

How do I get set up?

You will need Fossil installed to clone this repo. You will also need Shards v0.17.1 or later. If you have an earlier version of Shards, you will need to to build the latest version manually.

Add this to your shard.yml file:

dependencies:
  remixspf:
    fossil: https://chiselapp.com/user/MistressRemilia/repository/remixspf

Usage

require "remixspf"

# Open an XSPF file.
playlist = File.open("/path/to/file.xspf", "r") do |file|
  RemiXspf::Playlist.read(file)
end

# Print the locations for every track
playlist.each do |trk|
  puts trk.locations
end

# Change some information
playlist.title = "Neat Playlist"
playlist.annotate = "This is just an example playlist."

# Add a new track
playlist.add(title: "Rabio", creator: "Partition 36", "/path/to/file/03 - Rabio.mp3")

# Write the playlist to disk in XML format
playlist.write("/path/to/dest.xspf")

# Also display it to standard output as JSON
puts playlist.write(format: RemiXspf::Playlist::Format::Json)

Development

Known Limitations

The current version does not support the <extension> tag and simply ignores it.

Style info

I use a somewhat non-standard style for my code.

How do I contribute?

  1. Go to https://chiselapp.com/user/MistressRemilia/repository/remixspf and clone the Fossil repository.
  2. Create a new branch for your feature.
  3. Push locally to the new branch.
  4. Create a bundle with Fossil that contains your changes.
  5. Get in contact with me.

Contributors

Links and Licenses

RemiXspf is under the GNU Affero General Public License version 3.