pyrekordbox.db6.smartlist#

class pyrekordbox.db6.smartlist.LogicalOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

ALL = 1#
ANY = 2#
class pyrekordbox.db6.smartlist.Property(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: str, Enum

ARTIST = 'artist'#
ALBUM = 'album'#
ALBUM_ARTIST = 'albumArtist'#
ORIGINAL_ARTIST = 'originalArtist'#
BPM = 'bpm'#
GROUPING = 'grouping'#
COMMENTS = 'comments'#
PRODUCER = 'producer'#
STOCK_DATE = 'stockDate'#
DATE_CREATED = 'dateCreated'#
COUNTER = 'counter'#
FILENAME = 'fileName'#
GENRE = 'genre'#
KEY = 'key'#
LABEL = 'label'#
MIX_NAME = 'mixName'#
MYTAG = 'myTag'#
RATING = 'rating'#
DATE_RELEASED = 'dateReleased'#
REMIXED_BY = 'remixedBy'#
DURATION = 'duration'#
NAME = 'name'#
YEAR = 'year'#
class pyrekordbox.db6.smartlist.Operator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: IntEnum

EQUAL = 1#
NOT_EQUAL = 2#
GREATER = 3#
LESS = 4#
IN_RANGE = 5#
IN_LAST = 6#
NOT_IN_LAST = 7#
CONTAINS = 8#
NOT_CONTAINS = 9#
STARTS_WITH = 10#
ENDS_WITH = 11#
class pyrekordbox.db6.smartlist.Condition(property, operator, unit, value_left, value_right)[source]#

Bases: object

Dataclass for a smart playlist condition.

property#
operator#
unit#
value_left#
value_right#
class pyrekordbox.db6.smartlist.SmartList(logical_operator=LogicalOperator.ALL, auto_update=0)[source]#

Bases: object

Rekordbox smart playlist XML handler.

parse(source)[source]#

Parse the XML source of a smart playlist.

to_xml()[source]#

Convert the smart playlist conditions to XML.

add_condition(prop, operator, value_left, value_right='', unit='')[source]#

Add a condition to the smart playlist.

Parameters:
propstr

The property to filter on.

operator{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} int

The operator to use. Must be in the range of 1-11

value_leftstr

The left value to use.

value_rightstr, optional

The right value to use, by default “”.

unitstr, optional

The unit to use, by default “”.

filter_clause()[source]#

Return a SQLAlchemy filter clause matching the content of the smart playlist.

Returns:
ColumnElement[bool]

A filter list macthing the contents of the smart playlist.