Hello, iPod users of gPodder!

I've written a patch to add extended gtkpod database write support, so
gtkpod will not complain about wrong checksums when adding files.

You need the current SVN trunk head and the attached patch.

How to get SVN running:
  http://wiki.gpodder.org/running-from-svn

Apply the patch:
  patch -p0 < /path/to/gpodder_r605_gtkpod_extendeddb.patch

Test: Sync to the iPod, start gtkpod - it should not complain about a
wrong sha1sum.

Please test and tell me if it works. If it does, I'll commit it to
trunk.

Thanks,
Thomas
Index: src/gpodder/config.py
===================================================================
--- src/gpodder/config.py	(revision 605)
+++ src/gpodder/config.py	(working copy)
@@ -67,6 +67,7 @@
     'auto_update_frequency': (int, 20),
     'episode_list_descriptions': (bool, True),
     'show_toolbar': (bool, True),
+    'ipod_write_gtkpod_extended': (bool, True),
     
     # Tray icon and notification settings
     'display_tray_icon': (bool, False),
Index: src/gpodder/sync.py
===================================================================
--- src/gpodder/sync.py	(revision 605)
+++ src/gpodder/sync.py	(working copy)
@@ -199,6 +199,25 @@
             self.notify('status', _('Saving iPod database'))
             gpod.itdb_write(self.itdb, None)
             self.itdb = None
+
+            if gl.config.ipod_write_gtkpod_extended:
+                # Fix up iTunesDB.ext (gtkpod extended database),
+                # so gtkpod will not complain about a wrong sha1sum
+                ext_filename = os.path.join(self.mountpoint, 'iPod_Control', 'iTunes', 'iTunesDB.ext')
+                idb_filename = os.path.join(self.mountpoint, 'iPod_Control', 'iTunes', 'iTunesDB')
+                if os.path.exists(ext_filename) and os.path.exists(idb_filename):
+                    try:
+                        db = gpod.ipod.Database(self.mountpoint)
+                        gpod.gtkpod.parse(ext_filename, db, idb_filename)
+                        gpod.gtkpod.write(ext_filename, db, idb_filename)
+                        db.close()
+                    except:
+                        log('Error when writing iTunesDB.ext', sender=self, traceback=True)
+                else:
+                    log('I could not find %s or %s. Will not update extended gtkpod DB.', ext_filename, idb_filename, sender=self)
+            else:
+                log('Not writing extended gtkpod DB. Set "ipod_write_gpod_extended" to True if I should write it.', sender=self)
+            
         Device.close(self)
         return True
 
_______________________________________________
gpodder-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/gpodder-devel

Reply via email to