Add remove_playlist_names to SyncExecutor and fix mhip playlist item parsing #44
Open
8bitgentleman wants to merge 1 commit intoTheRealSavi:mainfrom
Open
Conversation
…parsing - SyncExecutor.execute() now accepts remove_playlist_names: list[str] to delete playlists by name before merging user-created ones - Fix mhip_children playlist item parsing to extract track_id correctly instead of storing raw mhip dicts, which caused downstream key errors - Fix logger format string crash when playlist id is None (new playlists)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Been using iOpenPod in my app and it's been really good so far. Ran across a few minor playlist bugs, so here are two independent fixes
SyncExecutor.execute() now accepts remove_playlist_names: list[str]. Before merging user-created playlists, any
existing on-device playlist whose name matches (case-insensitive) is removed. This makes it possible for callers to
cleanly replace or delete playlists by name without needing to manipulate the raw playlist data themselves.
When reading playlists back from the iTunesDB, mhip_children entries were being stored as raw dicts with a nested
"data" key ({"data": {"track_id": N, ...}}). Downstream code that builds the write-back structure expected flat
{"track_id": N} dicts, so any sync that read existing playlists and wrote them back would lose all track references.
The fix normalises each item at parse time.
"id=0x%X" % pid raises TypeError when pid is None, which happens for newly created playlists that haven't been
assigned an ID yet. Fixed to emit "new" in that case.