Usage ===== Instalation ----------- To use xspf-lib, first install it by pip: .. code-block:: console pip install xspf-lib Generating new playlist ----------------------- To generate new playlist, use models of library. >>> import xspf_lib as xspf >>> killer_queen = xspf.Track( location="file:///home/music/killer_queen.mp3", title="Killer Queen", creator="Queen", album="Sheer Heart Attack", trackNum=2, duration=177000, annotation="#2 in GB 1975", info="https://ru.wikipedia.org/wiki/Killer_Queen", image="file:///home/images/killer_queen_cover.png" ) >>> anbtd = xspf.Track() >>> anbtd.location = ["https://freemusic.example.com/loc.ogg", "file:///home/music/anbtd.mp3"] >>> anbtd.title = "Another One Bites the Dust" >>> anbtd.creator = "Queen" >>> anbtd.identifier = ["id1.group"] >>> anbtd.link = [xspf.Link("link.namespace", "link.uri.info")] >>> anbtd.meta = [xspf.Meta("meta.namespace", "METADATA_INFO")] >>> playlist = xspf.Playlist(title="Some Tracks", creator="myself", annotation="I did this only for examples!.", trackList=[killer_queen, anbtd]) >>> print(playlist.xml_string()) Some TracksmyselfI did this only for examples!.2020-02-03T14:29:59.199202+03:00file:///home/music/killer_queen.mp3Killer QueenQueen#2 in GB 1975https://ru.wikipedia.org/wiki/Killer_Queenfile:///home/images/killer_queen_cover.pngSheer Heart Attack2177000https://freemusic.example.com/loc.oggfile:///home/music/anbtd.mp3id1.groupAnother One Bites the DustQueenlink.uri.infoMETADATA_INFO >>> playlist.write("some_tracks.xspf")