From 2bacc105e03231940b87c3f6ddba6ec3675b60fc Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 16 Apr 2016 10:42:16 +0800 Subject: rebuild_ipod_db.py: improve db entry build --- python/rebuild_ipod_db.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/python/rebuild_ipod_db.py b/python/rebuild_ipod_db.py index 8599c65..20c5454 100755 --- a/python/rebuild_ipod_db.py +++ b/python/rebuild_ipod_db.py @@ -27,8 +27,8 @@ from __future__ import print_function __title__ = "iPod Shuffle Database Builder" __author__ = "Aaron LI" -__version__ = "2.0.1" -__date__ = "2016-04-14" +__version__ = "2.0.2" +__date__ = "2016-04-16" import sys @@ -351,12 +351,13 @@ class iTunesSD: else: # build new entry self.header_entry[29] = props["type"] + entry_data = "".join([ c+"\0" for c in fn[:261] ]) + \ + "\0"*(558 - len(self.header_entry) - 2*len(fn)) entry = self.header_entry.tostring() + \ - "".join([ c+"\0" for c in fn[:261] ]).encode("utf-8") + \ - ("\0"*(525 - 2*len(fn))).encode("utf-8") + entry_data.encode("utf-8") # modify the shuffle and bookmark flags entry = entry[:555] + chr(props["shuffle"]).encode("utf-8") + \ - chr(props["bookmark"]).encode("utf-8") + entry[557:] + chr(props["bookmark"]).encode("utf-8") + entry[557] # self.entries[fn] = entry -- cgit v1.2.2