xspf_lib.Track

class xspf_lib.Track(location: Optional[Union[Iterable[str], str]] = None, identifier: Optional[Union[Iterable[str], str]] = None, title: Optional[str] = None, creator: Optional[str] = None, annotation: Optional[str] = None, info: Optional[str] = None, image: Optional[str] = None, album: Optional[str] = None, trackNum: Optional[int] = None, duration: Optional[int] = None, link: Optional[Iterable[Link]] = None, meta: Optional[Iterable[Meta]] = None, extension: Optional[Iterable[Extension]] = None)

Track info class.

__init__(location: Optional[Union[Iterable[str], str]] = None, identifier: Optional[Union[Iterable[str], str]] = None, title: Optional[str] = None, creator: Optional[str] = None, annotation: Optional[str] = None, info: Optional[str] = None, image: Optional[str] = None, album: Optional[str] = None, trackNum: Optional[int] = None, duration: Optional[int] = None, link: Optional[Iterable[Link]] = None, meta: Optional[Iterable[Meta]] = None, extension: Optional[Iterable[Extension]] = None) None

Generate instances of tracks, ready to be put in xspf_lib.Playlist class.

Parameters:
  • location (list[URI] | URI | None) – URI or list of URI of resource to be rendered.

  • identifier (list[URI] | URI | None) – Canonical ID or list of ID for this resource.

  • title (str | None) – Name of the track.

  • creator (str | None) – Name of creator of resource.

  • annotation (str | None) – Comment on the track.

  • info (URI | None) – IRI of a place where info of this resource can be founded.

  • image (URL | None) – URI of an image to display for the duration of the track.

  • album (str | None) – Name of the collection from which this resource comes.

  • trackNum (int | None) – Integer giving the ordinal position of the media on the album. Must be gte 0

  • duration (int | None) – The time to render a resource in milliseconds.

  • link (list[xspf_lib.Link] | None) – The link elements allows playlist extended without the use of XML namespace.

  • meta (list[xspf_lib.Meta] | None) – Metadata fields of playlist.

  • extension (list[xspf_lib.Extension] | None) – Extension of non-XSPF XML elements.

Methods

__init__([location, identifier, title, ...])

Generate instances of tracks, ready to be put in xspf_lib.Playlist class.

parse_from_xml_element(element)

Parse xml.etree.ElementTree.Element to data model

to_xml_element()

Create xml.ElementTree.Element of the track.

xml_string()

Return XML representation of track.

Attributes

location

URI or list of URI of resource to be rendered.

identifier

Canonical ID or list of ID for this resource.

title

Name of the track.

creator

Name of creator of resource.

annotation

Comment on the track.

info

URI of an image to display for the duration of the track.

image

URI of an image to display for the duration of the track.

album

Name of the collection from which this resource comes.

link

The link elements allows playlist extended without the use of XML namespace.

meta

Extension of non-XSPF XML elements.

extension

Extension of non-XSPF XML elements.

duration

The time to render a resource in milliseconds.

trackNum

Integer giving the ordinal position of the media on the album.