calliope.import_

Convert playlists from different serialization formats.

See also: cpe import command.

Package Contents

Functions

guess_format(text)

Guess the format of the input playlist.

parse_pls(text)

Parse playlist in PLS format.

parse_xspf(text)

Parse playlist in XSPF format.

jspf_to_calliope(jspf_entry, calliope_entry, jspf_property, calliope_property)

process_jspf_listenbrainz_playlist_extension(extension, entry)

process_jspf_listenbrainz_track_extension(extension, entry)

parse_jspf(text)

Parse playlist in JSPF format.

process_jspf(doc)

import_(text)

Parse playlist data from a file.

Attributes

JSPF_EXTENSION_LISTENBRAINZ_PLAYLIST

JSPF_EXTENSION_LISTENBRAINZ_TRACK

exception calliope.import_.PlaylistReadError

Bases: Exception

Exception raised if playlist parsing fails.

Initialize self. See help(type(self)) for accurate signature.

calliope.import_.guess_format(text)

Guess the format of the input playlist.

This is a simple function which tries different parsers in succession until one succeeds. It’s not the most efficient way to load a playlist.

Parameters

text (str) –

Return type

calliope.playlist.PlaylistFormat

calliope.import_.parse_pls(text)

Parse playlist in PLS format.

Parameters

text (str) –

Return type

calliope.playlist.Playlist

calliope.import_.parse_xspf(text)

Parse playlist in XSPF format.

Parameters

text (str) –

Return type

calliope.playlist.Playlist

calliope.import_.jspf_to_calliope(jspf_entry, calliope_entry, jspf_property, calliope_property)
calliope.import_.JSPF_EXTENSION_LISTENBRAINZ_PLAYLIST = https://musicbrainz.org/doc/jspf#playlist
calliope.import_.JSPF_EXTENSION_LISTENBRAINZ_TRACK = https://musicbrainz.org/doc/jspf#track
calliope.import_.process_jspf_listenbrainz_playlist_extension(extension, entry)
calliope.import_.process_jspf_listenbrainz_track_extension(extension, entry)
calliope.import_.parse_jspf(text)

Parse playlist in JSPF format.

Parameters

text (str) –

Return type

calliope.playlist.Playlist

calliope.import_.process_jspf(doc)
Return type

calliope.playlist.Playlist

calliope.import_.import_(text)

Parse playlist data from a file.

The type of the input data will be autodetected. The supported formats are: PLS, XSPF, JSPF.

Parameters

text (str) – The file contents.

Returns

A playlist.

Return type

calliope.playlist.Playlist