Added support for multiple-selection downloads in available podcasts tab

git-svn-id: svn://svn.berlios.de/gpodder/trunk@122 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2006-06-22 21:41:32 +00:00
parent cb7164673f
commit b2338df4a3
3 changed files with 42 additions and 24 deletions

View File

@ -1,3 +1,8 @@
Thu, 22 Jun 2006 23:37:50 +0200 <thp@perli.net>
* Added support for multiple-selection in available podcasts
tab and starting simultaneous downloads at once
* Updated TODO list
Tue, 13 Jun 2006 22:38:17 +0200 <thp@perli.net>
* Added libopmlreader, first cut of OPML input support -- you
can now select from a list of channels and add them to your

1
TODO
View File

@ -3,6 +3,7 @@
* select multiple podcasts (episodes) and execute one command (ex:
download) on all of these. (suggested by James Dorey and Haim Roitgrund)
--> DONE for available podcasts, TODO for downloading and downloaded!
* in libipodsync.py: use mime magic instead of extension-based
video detection? --> also, is mp4 always video or could it be

View File

@ -144,6 +144,9 @@ class Gpodder(SimpleGladeApp):
for itemcolumn in ( namecolumn, sizecolumn, releasecolumn ):
self.treeAvailable.append_column( itemcolumn)
# enable multiple selection support
self.treeAvailable.get_selection().set_mode( gtk.SELECTION_MULTIPLE)
# columns and renderers for the "downloaded" tab
# more information: see above..
@ -387,6 +390,27 @@ class Gpodder(SimpleGladeApp):
#self.labelStatus.set_text( "")
self.updateComboBox()
def download_podcast_by_url( self, url, want_message_dialog = True, widget = None):
self.active_item = self.channels[self.active_channel].getActiveByUrl( url)
current_channel = self.channels[self.active_channel]
current_podcast = current_channel[self.active_item]
filename = current_channel.getPodcastFilename( current_podcast.url)
if widget != None and widget.get_name() == "treeAvailable":
Gpodderepisode().set_episode( current_podcast, current_channel)
return
if os.path.exists( filename) == False and self.download_status_manager.is_download_in_progress( current_podcast.url) == False:
downloadThread( current_podcast.url, filename, None, self.download_status_manager, current_podcast.title, current_channel, current_podcast, self.ldb).download()
else:
if want_message_dialog:
self.showMessage( _("You have already downloaded this episode\nor you are currently downloading it."))
# if we're not downloading it, but it exists: add to localdb (if not already done so)
if os.path.exists( filename) == True:
if libgpodder.isDebugging():
print "already downloaded, trying to add to localDB if needed"
if current_channel.addDownloadedItem( current_podcast):
self.ldb.clear_cache()
#-- Gpodder custom methods }
#-- Gpodder.close_gpodder {
@ -589,32 +613,20 @@ class Gpodder(SimpleGladeApp):
if libgpodder.isDebugging():
print "on_treeAvailable_row_activated called with self.%s" % widget.get_name()
try:
selection_tuple = self.treeAvailable.get_selection().get_selected()
selection_iter = selection_tuple[1]
url = self.items_model.get_value( selection_iter, 0)
selection = self.treeAvailable.get_selection()
selection_tuple = selection.get_selected_rows()
if selection.count_selected_rows() > 1:
widget_to_send = None
show_message_dialog = False
else:
widget_to_send = widget
show_message_dialog = True
for apath in selection_tuple[1]:
selection_iter = self.items_model.get_iter( apath)
url = self.items_model.get_value( selection_iter, 0)
self.download_podcast_by_url( url, show_message_dialog, widget_to_send)
except:
self.showMessage( _("You have not selected an episode to download."))
return
self.active_item = self.channels[self.active_channel].getActiveByUrl( url)
current_channel = self.channels[self.active_channel]
current_podcast = current_channel[self.active_item]
filename = current_channel.getPodcastFilename( current_podcast.url)
if widget.get_name() == "treeAvailable":
Gpodderepisode().set_episode( current_podcast, current_channel)
return
if os.path.exists( filename) == False and self.download_status_manager.is_download_in_progress( current_podcast.url) == False:
downloadThread( current_podcast.url, filename, None, self.download_status_manager, current_podcast.title, current_channel, current_podcast, self.ldb).download()
else:
self.showMessage( _("You have already downloaded this episode\nor you are currently downloading it."))
# if we're not downloading it, but it exists: add to localdb (if not already done so)
if os.path.exists( filename) == True:
if libgpodder.isDebugging():
print "already downloaded, trying to add to localDB if needed"
if current_channel.addDownloadedItem( current_podcast):
self.ldb.clear_cache()
#-- Gpodder.on_treeAvailable_row_activated }
#-- Gpodder.on_btnDownload_clicked {