Skip to content

Commit

Permalink
WIP to fix issue #22
Browse files Browse the repository at this point in the history
  • Loading branch information
flesniak committed Feb 21, 2020
1 parent dd1a3ef commit 4861675
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion prodj/pdblib/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"u5" / Int8ul, # strange pages: 0x44, 0x64; otherwise seen: 0x24, 0x34
"free_size" / Int16ul, # excluding data at page end
"payload_size" / Int16ul,
"u7" / Int16ul, # (0->1: 2)
"overridden_entries" / Int16ul, # number of additional entries which override rows of previous blocks (ignore if 8191)
"entry_count_large" / Int16ul, # usually <= entry_count except for playlist_map?
"u9" / Int16ul, # 1004 for strange blocks, 0 otherwise
"u10" / Int16ul, # always 0 except 1 for synchistory, entry count for strange pages?
Expand Down
4 changes: 2 additions & 2 deletions prodj/pdblib/pdbdatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ def get_playlist(self, playlist_id):
pms = filter(lambda pm: pm.playlist_id == playlist_id, self["playlist_map"])
sorted_pms = sorted(pms, key=lambda pm: pm.entry_index)
tracks = filter(lambda t: any(t.id == pm.track_id for pm in sorted_pms), self["tracks"])
return tracks
return list(tracks)

def collect_entries(self, page_type, target):
for page in filter(lambda x: x.page_type == page_type, self.parsed.pages):
#logging.debug("parsing page %s %d", page.page_type, page.index)
for entry_block in page.entry_list:
for entry,enabled in zip(reversed(entry_block["entries"]), reversed(entry_block["entry_enabled"])):
for entry,enabled in zip(reversed(entry_block.entries), reversed(entry_block.entry_enabled)):
if not enabled:
continue
self[target] += [entry]
Expand Down

0 comments on commit 4861675

Please sign in to comment.