cleaned up isDownloaded() function and moved function calls

git-svn-id: svn://svn.berlios.de/gpodder@22 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2005-12-24 14:58:55 +00:00
parent 4861ec6056
commit 87a10dd316
2 changed files with 10 additions and 8 deletions

View File

@ -81,6 +81,9 @@ class gPodderLib( object):
filename = filename[:indexOfQuestionMark]
# end strip questionmark
return self.getChannelSaveDir( configChannel( channel.title).filename) + filename
def podcastFilenameExists( self, channel, url):
return exists( self.getPodcastFilename( channel, url))
def downloadRss( self, channel_url, channel_filename = "__unknown__", force_update = True):
if channel_filename == "":

View File

@ -40,12 +40,9 @@ class podcastChannel(object):
for item in self.items:
print "-- Item: \"" + item.title + "\""
def is_downloaded(self, item):
#TODO ist this the right place for this function? if yes move imports to head
import libgpodder
import os
filename = libgpodder.gPodderLib().getPodcastFilename(self, item.url)
return os.path.exists(filename)
def isDownloaded( self, item):
from libgpodder import gPodderLib
return gPodderLib().podcastFilenameExists( self, item.url)
def getItemsModel( self):
new_model = gtk.ListStore( gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_BOOLEAN, gobject.TYPE_STRING)
@ -53,8 +50,10 @@ class podcastChannel(object):
for item in self.items:
# Skip items with no download url
if item.url != "":
if self.is_downloaded(item): background_color = "#eeeeee"
else: background_color = "white"
if self.isDownloaded(item):
background_color = "#eeeeee"
else:
background_color = "white"
new_iter = new_model.append()
new_model.set( new_iter, 0, item.url)
new_model.set( new_iter, 1, item.title)