Skip to content

Add remove_playlist_names to SyncExecutor and fix mhip playlist item parsing #44

Open
8bitgentleman wants to merge 1 commit intoTheRealSavi:mainfrom
8bitgentleman:feat/remove-playlist-names-and-mhip-fix
Open

Add remove_playlist_names to SyncExecutor and fix mhip playlist item parsing #44
8bitgentleman wants to merge 1 commit intoTheRealSavi:mainfrom
8bitgentleman:feat/remove-playlist-names-and-mhip-fix

Conversation

@8bitgentleman
Copy link
Copy Markdown

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

  1. remove_playlist_names parameter (new feature)

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.

  1. mhip_children playlist item parsing (bug fix)

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.

  1. Logger crash on new playlists (bug fix)

"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.

…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant