Hi, I wrote a quick patch against the stable branch to sync cover art to Rockbox iPods (with the UMS config). However, right now gpodder doesn't determine if the player is a rockbox player and the size of the BMP file generated is non-configurable.
If this was to make it upstream, what would be the prefered way of dealing with this? Should I make a new player-class for rockbox players and have cover-size be configurable (I believe that different player ports of rockbox use different resolutions for album art)? Or should that just be an option for the general UMS class? Let me know what you think. I am happy to provide a patch against trunk too. Right now I'd just like some feedback. Best, David
--- src/gpodder/sync.py-old 2008-05-28 11:40:42.000000000 -0700 +++ src/gpodder/sync.py 2008-05-28 11:28:37.000000000 -0700 @@ -46,6 +46,10 @@ try: except: log( '(gpodder.sync) Could not find eyeD3') +try: + import Image +except: + log( '(gpodder.sync) Could not find Python Image Library') import os import os.path @@ -513,6 +517,10 @@ class MP3PlayerDevice(Device): log('Marking "%s" from "%s" as played', episode.title, episode.channel.title, sender=self) gl.history_mark_played(episode.url) + if not os.path.exists(os.path.join(folder, 'cover.bmp')): + log('Creating Rockbox album art for "%s"', episode.channel.title, sender=self) + self.set_cover_art(folder, from_file) + if not os.path.exists(to_file): log('Copying %s => %s', os.path.basename(from_file), to_file.decode(self.enc), sender=self) return self.copy_file_progress(from_file, to_file) @@ -614,6 +622,27 @@ class MP3PlayerDevice(Device): # No scrobbler log on that device return None + def set_cover_art(self, destination, local_filename): + try: + cover_loc = os.path.join(os.path.dirname(local_filename), 'cover') + cover_dst = os.path.join(destination, 'cover.bmp') + if os.path.isfile(cover_loc): + size = (100, 100) + try: + cover = Image.open(cover_loc) + cover.thumbnail(size) + cover.save(cover_dst, 'BMP') + except IOError: + log('Cannot create %s (PIL?)', cover_dst, sender=self) + return True + else: + log('No rockbox cover available', sender=self) + return True + except: + log('Error getting cover using channel cover', sender=self) + return False + + def load_audioscrobbler_log(self, log_file): """ Retrive track title and artist info for all the entries in an audioscrobbler portable player format logfile
signature.asc
Description: OpenPGP digital signature
_______________________________________________ gpodder-devel mailing list gpodder-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/gpodder-devel