aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-04-16 10:42:16 +0800
committerAaron LI <aaronly.me@outlook.com>2016-04-16 10:42:16 +0800
commit2bacc105e03231940b87c3f6ddba6ec3675b60fc (patch)
treea45b29e10b07c9e28994113ba387aa834ada5d85
parentf95d79d8fe8e4d697a5e6ddfe7c926b5f3700355 (diff)
downloadatoolbox-2bacc105e03231940b87c3f6ddba6ec3675b60fc.tar.bz2
rebuild_ipod_db.py: improve db entry build
-rwxr-xr-xpython/rebuild_ipod_db.py11
1 files 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