Add playlist database #39
2 Participants
Notifications
Due Date
No due date set.
Depends on
#38 add-pytest-infrastructure
TonBERRY/tonberry-pico
Reference: TonBERRY/tonberry-pico#39
Reference in New Issue
Block a user
Delete Branch "23-add-playlist-db"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add playlist database based on the micropython 'btree' module.
Supported features are:
Different playlist modes will be added in a followup for #24.
Implements #23.
The playlist data is stored in the btree database in a hierarchical
schema. The hierarchy levels are separated by the '/' character.
Currently, the schema is as follows: The top level for a playlist is the
'tag' id encoded as a hexadecimal string. Beneath this, the 'playlist'
key contains the elements in the playlist. The keys used for the
playlist entries should be decimal integers, prefixed with sufficient
zeros such that they are in the correct order when sorted lexicographically.
When writing a playlist using the playlistdb module, the keys are 00000, 00001,
etc. by default. The 'playlistpos' key is also located under the 'tag' key and
stores the key of the current playlist entry.
For example, a playlist with two entries 'a.mp3' and 'b.mp3' for a tag
with the id '00aa11bb22' would be stored in the following key/value
pairs in the btree db:
@@ -80,1 +70,3 @@self._play(self.playlist[self.playlist_pos])def _set_playlist(self, tag: bytes):self.playlist = self.playlist_db.getPlaylistForTag(tag)self._play(self.playlist.getCurrentPath())playlistmay be None if no playlist was found fortaga84d7d9c1atoe862019b20e862019b20to5d5526835c5d5526835cto6645c4443bApprove everything up until my commit. Than one might be reviewed by you ;)