xspf_lib.Playlist

class xspf_lib.Playlist(title: ~typing.Optional[str] = None, creator: ~typing.Optional[str] = None, annotation: ~typing.Optional[str] = None, info: ~typing.Optional[str] = None, location: ~typing.Optional[str] = None, identifier: ~typing.Optional[str] = None, image: ~typing.Optional[str] = None, date: ~datetime.datetime = <factory>, license: ~typing.Optional[str] = None, attribution: ~typing.List[~typing.Union[~xspf_lib.elements.Playlist, ~xspf_lib.elements.Attribution]] = <factory>, link: ~typing.List[~xspf_lib.elements.Link] = <factory>, meta: ~typing.List[~xspf_lib.elements.Meta] = <factory>, extension: ~typing.List[~xspf_lib.elements.Extension] = <factory>, trackList: ~typing.List[~xspf_lib.elements.Track] = <factory>)

Playlist info class.

Parameters:
  • title (str | None) – Name of playlist.

  • creator (str | None) – Name of the entity that authored playlist.

  • annotation – Comment of the playlist.

  • info (URI | None) – URI of a web page to find out more about playlist.

  • location (URI | None) – Source URI for the playlist.

  • identifier (URI | None) – Canonical URI for the playlist.

  • image (URI | None) – URI of image to display in the absence of track image.

  • date (datetime | None) – Datetime of creation of playlist.

  • license (URI | None) – URI of resource that describes the licence of playlist.

  • attribution (list[xspf_lib.Playlist | xspf_lib.Attribution] | None) – List of attributed playlists or Attribution entities.

  • 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 element

  • trackList (list[xspf_lib.Track] | None) – Ordered list of track elements.

>>> import xspf_lib as xspf
>>> playlist = xspf.Playlist(
>>>     title="Some Tracks",
>>>     creator="myself",
>>>     annotation="I did this only for examples!.",
>>>     trackList=[killer_queen, anbtd]
>>> )
__init__(title: ~typing.Optional[str] = None, creator: ~typing.Optional[str] = None, annotation: ~typing.Optional[str] = None, info: ~typing.Optional[str] = None, location: ~typing.Optional[str] = None, identifier: ~typing.Optional[str] = None, image: ~typing.Optional[str] = None, date: ~datetime.datetime = <factory>, license: ~typing.Optional[str] = None, attribution: ~typing.List[~typing.Union[~xspf_lib.elements.Playlist, ~xspf_lib.elements.Attribution]] = <factory>, link: ~typing.List[~xspf_lib.elements.Link] = <factory>, meta: ~typing.List[~xspf_lib.elements.Meta] = <factory>, extension: ~typing.List[~xspf_lib.elements.Extension] = <factory>, trackList: ~typing.List[~xspf_lib.elements.Track] = <factory>) None

Methods

__init__([title, creator, annotation, info, ...])

append(item)

S.append(value) -- append value to the end of the sequence

clear()

copy()

count(value)

extend(other)

S.extend(iterable) -- extend sequence by appending elements from the iterable

index(value, [start, [stop]])

Raises ValueError if the value is not present.

insert(i, item)

S.insert(index, value) -- insert value before index

parse(filename)

Parse XSPF file into xspf_lib.Playlist entity.

parse_from_xml_element(root)

Parse xml.etree.ElementTree.Element to data model

pop([index])

Raise IndexError if list is empty or index is out of range.

remove(item)

S.remove(value) -- remove first occurrence of value.

reverse()

S.reverse() -- reverse IN PLACE

sort(*args, **kwds)

to_xml_element()

Return xml.ElementTree.Element of the playlist.

write(file_or_filename[, encoding])

Write playlist into file.

xml_string()

Return XML representation of playlist.

Attributes

annotation

Comment of the playlist.

creator

Name of the entity that authored playlist.

data

self.data member required by collections.UserList class.

identifier

Canonical URI for the playlist.

image

URI of image to display in the absence of track image.

info

URI of a web page to find out more about playlist.

license

URI of resource that describes the licence of playlist.

location

Source URI for the playlist.

title

Name of playlist.

xml_eltree

Return xml.etree.ElementTree.ElementTree object of playlist.

date

Datetime of creation of playlist.

attribution

List of attributed playlists or Attribution entities.

link

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

meta

Metadata fields of playlist.

extension

Extension of non-XSPF XML element.

trackList

Ordered list of track elements.