From afbb612b485982bca823edca91e43997aa810cc6 Mon Sep 17 00:00:00 2001 From: Nicholas Piper Date: Sun, 14 Jan 2007 22:25:25 +0000 Subject: Correction to 1.4 - sha1/md5_hash handling in ext db. Also, don't write filename_ipod if we don't have a value for it. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1369 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- bindings/python/gtkpod.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/bindings/python/gtkpod.py b/bindings/python/gtkpod.py index 83f460b..3a1260b 100644 --- a/bindings/python/gtkpod.py +++ b/bindings/python/gtkpod.py @@ -53,14 +53,19 @@ def write(filename, db, itunesdb_file): write_pair("id", track['id']) if not track['userdata']: track['userdata'] = {} - track['userdata']['filename_ipod'] = track['ipod_path'] + if track['ipod_path']: + track['userdata']['filename_ipod'] = track['ipod_path'] + hash_name = 'sha1_hash' try: - hash_name = 'sha1_hash' del track['userdata'][hash_name] except KeyError: # recent gpod uses sha1_hash, older uses md5_hash - hash_name = 'md5_hash' - del track['userdata'][hash_name] + try: + del track['userdata'][hash_name] + hash_name = 'md5_hash' + except KeyError: + # we'll just write a sha1_hash then + pass if track['userdata'].has_key('filename_locale') and not track['userdata'].has_key(hash_name): if os.path.exists(track['userdata']['filename_locale']): track['userdata'][hash_name] = sha1_hash( -- cgit