Skip to content

Empty Smart Playlists #110

Answered by dylanljones
elvinos asked this question in Q&A
Dec 13, 2023 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

I added a handler for the smart playlists. You can parse the XML as follows:

from pyrekordbox.db6 import Rekordbox6Database, SmartList

db = Rekordbox6Database()
pl = db.get_playlist(ID=<id of smart playlist>)
smartlist = SmartList()
smartlist.parse(pl.SmartList)
for cond in smartlist.conditions:
    print(cond)

You can create a SQLAlchemy filter clause for queries:

from pyrekordbox.db6 import DjmdContent

filter_clause = smartlist.filter_clause()
for content in db.query(DjmdContent).filter(filter_clause):
    print(content)

You don't have to do the querying manually, I also implemented a new method to return the contents of a playlist directly,
supporting both regular and smart playlists:

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@dylanljones
Comment options

@dylanljones
Comment options

@elvinos
Comment options

@dylanljones
Comment options

@elvinos
Comment options

Answer selected by dylanljones
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
enhancement New feature or request RBv6 database Related to the Rekordbox v6 database
2 participants