Update podcast list after download status changes (bug 433)

The podcast list is now updated correctly when the
status of a download changes, the same as with the
episodes list.
This commit is contained in:
Thomas Perl 2009-05-12 11:03:59 +02:00
parent 1c9db7f527
commit d81109d080
2 changed files with 18 additions and 4 deletions

View File

@ -369,7 +369,9 @@ class DownloadTask(object):
task.speed # in bytes per second
str(task) # name of the episode
task.status # current status
task.status_changed # True if the status has been changed
task.status_changed # True if the status has been changed (see below)
task.url # URL of the episode being downloaded
task.podcast_url # URL of the podcast this download belongs to
You can cancel a running download task by setting its status:
@ -447,6 +449,11 @@ class DownloadTask(object):
url = property(fget=__get_url)
def __get_podcast_url(self):
return self.__episode.channel.url
podcast_url = property(fget=__get_podcast_url)
def __get_episode(self):
return self.__episode

View File

@ -875,8 +875,14 @@ class gPodder(BuilderWidget, dbus.service.Object):
title = [self.default_title]
# We have to update all episode icons for which the status has changed
episode_urls = [task.url for task in self.download_tasks_seen if task.status_changed]
# We have to update all episodes/channels for which the status has
# changed. Accessing task.status_changed has the side effect of
# re-setting the changed flag, so we need to get the "changed" list
# of tuples first and split it into two lists afterwards
changed = [(task.url, task.podcast_url) for task in \
self.download_tasks_seen if task.status_changed]
episode_urls = [episode_url for episode_url, channel_url in changed]
channel_urls = [channel_url for episode_url, channel_url in changed]
count = downloading + queued
if count > 0:
@ -915,7 +921,8 @@ class gPodder(BuilderWidget, dbus.service.Object):
self.gpodder_episode_window.download_status_changed(episode_urls)
self.gpodder_episode_window.download_status_progress(episode_window_progress, episode_window_speed)
self.play_or_download()
#self.updateComboBox(only_these_urls=channel_urls)
if channel_urls:
self.updateComboBox(only_these_urls=channel_urls)
return True
def on_tree_channels_resize(self, widget, allocation):