GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - martlin2cz/xspf-playlist: A Java library implementing the XSPF playlist file format

BranchesTags
Open more actions menu

Latest commit

 

History

60 Commits
60 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
.gitignore
.gitignore
 
 
.project
.project
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
pom.xml
pom.xml
 
 

Repository files navigation

xspf-playlist

An simple Java library implementing the manipulation (reading, but also creating and modifing) of the XSPF playlist files. The implementation is valid agains the XSPF file format specification, version 1: https://xspf.org/.

Hello world

The basic usage (create empty playlist, add one track, save to file) can be acchieved by following code snippet:

    XSPFFile file = XSPFFile.create();
    XSPFTracks tracks = file.playlist().tracks();
       
    XSPFTrack track = tracks.createTrack(URI.create("file://hello-world.mp3"));
    tracks.add(track);
    
    file.save(f);

More complex sample

    // Load the playlist
    File f = /* ... */ ;
    XSPFFile file = XSPFFile.load(f);
    XSPFPlaylist playlist = file.playlist();
    
    // Get playlist data
    if (!"me".equals(playlist.getCreator())) {
        throw new IllegalArgumentException("It's not me!");
    }

    // Set playlist data
    playlist.setTitle("Not the best music ever");
    playlist.setInfo(URI.create("https://github.com/martlin2cz/xspf-playlist/wiki"));
    
    XSPFMetas metas = playlist.metas();
    metas.add(metas.createMeta(URI.create("author"), "martlin2cz"));
    
    // Pick some track
    XSPFTrack lorem = playlist.tracks().createTrack();
    
    // Get some track data
    System.out.println("Track " + lorem.getTitle() + " links:");
    for (XSPFLink link: lorem.links().iterate()) {
        System.out.println(link.getRel() + " -> " + link.getContent());
    }
    
    // Set some track data
    lorem.setTrackNum(1);
    lorem.setAlbum("The foobar");
    lorem.setDuration(Duration.ofSeconds(42));
    
    // Save the playlist
    file.save(f);

Further usage can be found in the Wiki: Usage

Examples

There are some sample programs in the cz.martlin.xspf.examples package in src/test/java. Like the TracksFinder:

$ TracksFinder "Kraftwerk - Computer World.xspf" "Compute"
Computer World
Computer World..2
Computer Love
Home Computer
It's More Fun To Compute

Changelog

Moved to Wiki: Changelog

About

A Java library implementing the XSPF playlist file format

Topics

javalibraryxspf-playlist

Resources

Readme
GPL-3.0 license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.