https://github.com/dem214/xspf-lib
Library to work with xspf format
https://github.com/dem214/xspf-lib
library playlist python xspf
Last synced: 2 months ago
JSON representation
Library to work with xspf format
- Host: GitHub
- URL: https://github.com/dem214/xspf-lib
- Owner: dem214
- License: mit
- Created: 2020-01-21T18:55:30.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-03T22:24:02.000Z (almost 2 years ago)
- Last Synced: 2025-11-29T01:41:56.950Z (7 months ago)
- Topics: library, playlist, python, xspf
- Language: Python
- Homepage: https://pypi.org/project/xspf-lib/
- Size: 204 KB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
========
xspf-lib
========
.. image:: https://github.com/dem214/xspf-lib/workflows/Python%20package/badge.svg?branch=master
:target: https://github.com/dem214/xspf-lib/actions
:alt: Python package
.. image:: https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336
:target: https://pycqa.github.io/isort/
:alt: isort
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: black
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit
Library to work with xspf.
Requirements
------------
* `Python 3.8 or higher `_
Installing
----------
Install and update via `pip`_:
.. code-block:: text
pip install -U xspf-lib
Example
-------
1. Generating new playlist.
>>> 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")
2. Parsing from file.
>>> from xspf_lib import Playlist
>>> playlist = Playlist.parse("some_tracks.xspf")
License
-------
The license of the project is MIT License - see LICENSE_ file for details.
.. _LICENSE: https://github.com/dem214/xspf-lib/blob/master/LICENSE
.. _pip: https://pip.pypa.io/en/stable/quickstart