Track object Documentation¶
-
sima.lib.track.
SEPARATOR
= '\x1f'¶ str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
-
class
sima.lib.track.
Track
(file=None, duration=0, pos=- 1, **kwargs)[source]¶ Track object. Instantiate with Player replies.
- Parameters
-
property
Album
¶ Get the
sima.lib.meta.Album
associated to this track
-
property
Artist
¶ Get the
sima.lib.meta.Artist
associated to this track
-
property
file
¶ file is an immutable attribute that’s used for the hash method
-
property
genres
¶ Fetches Genres for the track Multivalue genre are dealt with:
when genre tag is multivalued
when single tag uses coma or semi-colon separator
-
property
length
¶ Get a fancy duration as
%H:%M:%S
(useduration
to get duration in second only)
Meta object Documentation¶
Generic class and helper function¶
-
class
sima.lib.meta.
Meta
(**kwargs)[source]¶ A generic Class to handle tracks metadata such as artist, album, albumartist names and their associated MusicBrainz’s ID.
Using generic kwargs in constructor for convenience but the actual signature is:
>>> Meta(name, mbid=None, **kwargs)
-
add_alias
(other)[source]¶ Add alternative name to aliases attibute.
other can be a
sima.lib.meta.Meta
object in which case aliases are merged.- Parameters
other (str) – Alias to add, could be any object with
__str__
method.
-
property
aliases
¶
-
property
aliases_sz
¶
-
property
mbid
¶
-
property
name
¶
-
property
name_sz
¶
-
property
names
¶ aliases + name
-
property
names_sz
¶
-
use_mbid
= True¶ Class attribute to disable use of MusicBrainz IDs
-
Derived objects¶
-
class
sima.lib.meta.
Artist
(name, mbid=None, musicbrainz_artistid=None, albumartist=None)[source]¶ Bases:
sima.lib.meta.Meta
Artist object deriving from
Meta
.- Parameters
- Example
>>> trk = {'artist':'Art Name', >>> 'albumartist': 'Alb Art Name', # optional >>> 'musicbrainz_artistid': '<UUID4>', # optional >>> } >>> artobj0 = Artist(**trk) >>> artobj1 = Artist(name='Tool')
-
class
sima.lib.meta.
Album
(**kwargs)[source]¶ Bases:
sima.lib.meta.Meta
Album object