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 elementtrackList (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.Playlistentity.parse_from_xml_element(root)Parse
xml.etree.ElementTree.Elementto data modelpop([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.
Return XML representation of playlist.
Attributes
annotationComment of the playlist.
creatorName of the entity that authored playlist.
dataself.data member required by collections.UserList class.
identifierCanonical URI for the playlist.
imageURI of image to display in the absence of track image.
infoURI of a web page to find out more about playlist.
licenseURI of resource that describes the licence of playlist.
locationSource URI for the playlist.
titleName of playlist.
xml_eltreeReturn xml.etree.ElementTree.ElementTree object of playlist.
dateDatetime of creation of playlist.
attributionList of attributed playlists or Attribution entities.
linkThe link elements allows playlist extended without the use of XML namespace.
metaMetadata fields of playlist.
extensionExtension of non-XSPF XML element.
trackListOrdered list of track elements.