patch from richard voigt to fix bad channel images

git-svn-id: svn://svn.berlios.de/gpodder/trunk@370 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2007-08-19 07:23:02 +00:00
parent 0712a26a37
commit 5647a0cd5d
2 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,10 @@
Sun, 19 Aug 2007 09:21:44 +0200 <thp@perli.net>
* src/gpodder/libpodcasts.py: Submit modified patch from Richard
Voigt (richardvoigt gmail com) to fix an error with invalid data
channel covers (e.g. a 404 HTML page at the URL of the real image)
Will now fall back to the "globe" icon when channel icon fails to
load
Sun, 19 Aug 2007 08:46:27 +0200 <thp@perli.net>
* src/gpodder/libipodsync.py: Fix error with empty episode title
detection, thanks to Wilfred van Rooijen (wvanrooijen yahoo.com)

View File

@ -42,6 +42,7 @@ import os.path
import os
import glob
import shutil
import sys
from urllib import unquote
from types import ListType
@ -706,9 +707,16 @@ def channelsToModel( channels, download_status_manager = None):
new_model.set( new_iter, 7, '%s\n<small>%s</small>' % ( saxutils.escape( channel.title), saxutils.escape( channel.description.split('\n')[0]), ))
channel_cover_found = False
if os.path.exists( channel.cover_file) and os.path.getsize(channel.cover_file) > 0:
new_model.set( new_iter, 8, gtk.gdk.pixbuf_new_from_file_at_size( channel.cover_file, 32, 32))
else:
try:
new_model.set( new_iter, 8, gtk.gdk.pixbuf_new_from_file_at_size( channel.cover_file, 32, 32))
channel_cover_found = True
except:
exctype, value = sys.exc_info()[:2]
log( 'Could not convert icon file "%s", error was "%s"', channel.cover_file, value )
if not channel_cover_found:
iconsize = gtk.icon_size_from_name('channel-icon')
if not iconsize:
iconsize = gtk.icon_size_register('channel-icon',32,32)