From 23c4a346fd6b33fdd33d109ecbeee1bc5d55854d Mon Sep 17 00:00:00 2001 From: Nicholas Piper Date: Tue, 23 Jan 2007 14:10:40 +0000 Subject: Correction to how we fall back to using md5_hash entry from ext database if sha1_hash key isn't found. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1390 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- bindings/python/gtkpod.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bindings/python/gtkpod.py b/bindings/python/gtkpod.py index be3ebfc..09d222c 100644 --- a/bindings/python/gtkpod.py +++ b/bindings/python/gtkpod.py @@ -141,9 +141,15 @@ def parse(filename, db, itunesdb_file=None): tracks_by_sha[sha1_hash(track.ipod_filename())] = track for ext_block in ext_data.values(): try: - track = tracks_by_sha[ext_block['sha1_hash']] + if ext_block.has_key('sha1_hash'): + track = tracks_by_sha[ext_block['sha1_hash']] + elif ext_block.has_key('md5_hash'): + # recent gpod uses sha1_hash, older uses md5_hash + track = tracks_by_sha[ext_block['md5_hash']] except KeyError: - # recent gpod uses sha1_hash, older uses md5_hash - track = tracks_by_sha[ext_block['md5_hash']] + # what should we do about this? + print "Failed to match hash from extended information file with one that we just calculated:" + print ext_block + continue track['userdata'] = ext_block -- cgit