Sat, 19 Jul 2008 20:37:10 -0400 <me@nikosapi.org>

Request covers only when necessary (Patch from Justin Forest)
Closes bug #144 (http://bugs.gpodder.org/show_bug.cgi?id=144)

	* src/gpodder/gui.py: Don't update covers every time updateComboBox
	is called
	* src/gpodder/libpodcasts.py: update cover during an update()
	* src/gpodder/services.py: log when a cover is being requested



git-svn-id: svn://svn.berlios.de/gpodder/trunk@779 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Nick 2008-07-20 00:46:49 +00:00
parent a975d8240c
commit bc4b5cb15d
4 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,12 @@
Sat, 19 Jul 2008 20:37:10 -0400 <me@nikosapi.org>
Request covers only when necessary (Patch from Justin Forest)
Closes bug #144 (http://bugs.gpodder.org/show_bug.cgi?id=144)
* src/gpodder/gui.py: Don't update covers every time updateComboBox
is called
* src/gpodder/libpodcasts.py: update cover during an update()
* src/gpodder/services.py: log when a cover is being requested
Tue, 15 Jul 2008 15:15:42 -0400 <me@nikosapi.org>
Fix Device traceback when syncing (reported by: FriedBunny)

View File

@ -1133,9 +1133,6 @@ class gPodder(GladeWidget):
self.treeChannels.set_model(channels_to_model(self.channels, self.cover_cache, gl.config.podcast_list_icon_size, gl.config.podcast_list_icon_size))
util.idle_add(self.treeChannels.scroll_to_point, rect.x, rect.y)
for channel in self.channels:
services.cover_downloader.request_cover(channel)
try:
selected_path = (0,)
# Find the previously-selected URL in the new

View File

@ -111,6 +111,9 @@ class podcastChannel(object):
def update(self):
(updated, c) = self.fc.fetch(self.url, self)
# update the cover if it's not there
self.update_cover()
# If we have an old instance of this channel, and
# feedcache says the feed hasn't changed, return old
if not updated:
@ -140,7 +143,10 @@ class podcastChannel(object):
self.pubDate = time.time()
if hasattr( c.feed, 'image'):
if c.feed.image.href:
old = self.image
self.image = c.feed.image.href
if old != self.image:
self.update_cover(force=True)
# Marked as bulk because we commit after importing episodes.
db.save_channel(self, bulk=True)
@ -163,6 +169,11 @@ class podcastChannel(object):
# Now we can flush the updates.
db.commit()
def update_cover(self, force=False):
if self.cover_file is None or not os.path.exists(self.cover_file) or force:
if self.image is not None:
services.cover_downloader.request_cover(self)
def delete(self):
db.delete_channel(self)
@ -704,11 +715,11 @@ def channels_to_model(channels, cover_cache=None, max_width=0, max_height=0):
# Load the cover if we have it, but don't download
# it if it's not available (to avoid blocking here)
#pixbuf = services.cover_downloader.get_cover(channel, avoid_downloading=True)
#new_pixbuf = None
#if pixbuf is not None:
# new_pixbuf = util.resize_pixbuf_keep_ratio(pixbuf, max_width, max_height, channel.url, cover_cache)
#new_model.set(new_iter, 5, new_pixbuf or pixbuf)
pixbuf = services.cover_downloader.get_cover(channel, avoid_downloading=True)
new_pixbuf = None
if pixbuf is not None:
new_pixbuf = util.resize_pixbuf_keep_ratio(pixbuf, max_width, max_height, channel.url, cover_cache)
new_model.set(new_iter, 5, new_pixbuf or pixbuf)
return new_model

View File

@ -100,6 +100,7 @@ class CoverDownloader(ObservableService):
be downloaded from the specified URL and not
taken from the channel metadata.
"""
log('cover download request for %s', channel.url, sender=self)
args = [channel, custom_url, True]
threading.Thread(target=self.__get_cover, args=args).start()