download all new episodes item

git-svn-id: svn://svn.berlios.de/gpodder/trunk@223 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
Thomas Perl 2006-12-20 19:44:29 +00:00
parent 7c52ac40a8
commit 1a75275644
3 changed files with 91 additions and 25 deletions

View File

@ -1,3 +1,10 @@
Wed, 20 Dec 2006 20:43:02 +0100 <thp@perli.net>
* src/gpodder/gpodder.py: Added modified patch from Seth
Remington to add support for a "download new episodes from
all channels" menu item
* data/gpodder.glade: Added Ctrl+N menu item (Download all new
episodes from all channels) to gPodder's main menu
Wed, 20 Dec 2006 20:08:29 +0100 <thp@perli.net>
* TODO: Updated gPodder 0.9.0 release goals

View File

@ -42,7 +42,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2206">
<widget class="GtkImage" id="image2305">
<property name="visible">True</property>
<property name="stock">gtk-cdrom</property>
<property name="icon_size">1</property>
@ -65,7 +65,7 @@
<accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2207">
<widget class="GtkImage" id="image2306">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -78,6 +78,28 @@
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="itemDownloadAllNew">
<property name="visible">True</property>
<property name="label" translatable="yes">Download _all new pisodes</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_itemDownloadAllNew_activate" last_modification_time="Sat, 09 Dec 2006 18:13:48 GMT"/>
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2307">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkSeparatorMenuItem" id="trennlinie6">
<property name="visible">True</property>
@ -92,7 +114,7 @@
<signal name="activate" handler="on_itemAddChannel_activate" last_modification_time="Sat, 29 Oct 2005 11:33:59 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2208">
<widget class="GtkImage" id="image2308">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -113,7 +135,7 @@
<signal name="activate" handler="on_itemEditChannel_activate" last_modification_time="Sat, 29 Oct 2005 11:34:38 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2209">
<widget class="GtkImage" id="image2309">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
@ -134,7 +156,7 @@
<signal name="activate" handler="on_itemRemoveChannel_activate" last_modification_time="Sat, 29 Oct 2005 11:35:16 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2210">
<widget class="GtkImage" id="image2310">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -160,7 +182,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2211">
<widget class="GtkImage" id="image2311">
<property name="visible">True</property>
<property name="stock">gtk-connect</property>
<property name="icon_size">1</property>
@ -183,7 +205,7 @@
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2212">
<widget class="GtkImage" id="image2312">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -204,7 +226,7 @@
<signal name="activate" handler="on_cleanup_ipod_activate" last_modification_time="Wed, 05 Apr 2006 22:14:51 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2213">
<widget class="GtkImage" id="image2313">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -228,7 +250,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2214">
<widget class="GtkImage" id="image2314">
<property name="visible">True</property>
<property name="stock">gtk-justify-left</property>
<property name="icon_size">1</property>
@ -250,7 +272,7 @@
<signal name="activate" handler="on_itemExportChannels_activate" last_modification_time="Sat, 29 Oct 2005 11:37:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2215">
<widget class="GtkImage" id="image2315">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
@ -271,7 +293,7 @@
<signal name="activate" handler="on_itemImportChannels_activate" last_modification_time="Tue, 13 Jun 2006 19:39:42 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2216">
<widget class="GtkImage" id="image2316">
<property name="visible">True</property>
<property name="stock">gtk-redo</property>
<property name="icon_size">1</property>
@ -303,7 +325,7 @@
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2217">
<widget class="GtkImage" id="image2317">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@ -331,7 +353,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2218">
<widget class="GtkImage" id="image2318">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -355,7 +377,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2219">
<widget class="GtkImage" id="image2319">
<property name="visible">True</property>
<property name="stock">gtk-justify-left</property>
<property name="icon_size">1</property>
@ -378,7 +400,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2220">
<widget class="GtkImage" id="image2320">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>
@ -399,7 +421,7 @@
<signal name="activate" handler="on_btnSelectAllAvailable_clicked" last_modification_time="Fri, 08 Dec 2006 23:50:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2221">
<widget class="GtkImage" id="image2321">
<property name="visible">True</property>
<property name="stock">gtk-sort-ascending</property>
<property name="icon_size">1</property>
@ -420,7 +442,7 @@
<signal name="activate" handler="on_btnDownload_clicked" last_modification_time="Fri, 08 Dec 2006 23:50:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2222">
<widget class="GtkImage" id="image2322">
<property name="visible">True</property>
<property name="stock">gtk-goto-bottom</property>
<property name="icon_size">1</property>
@ -448,7 +470,7 @@
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2223">
<widget class="GtkImage" id="image2323">
<property name="visible">True</property>
<property name="stock">gtk-clear</property>
<property name="icon_size">1</property>
@ -470,7 +492,7 @@
<accelerator key="Delete" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image2224">
<widget class="GtkImage" id="image2324">
<property name="visible">True</property>
<property name="stock">gtk-delete</property>
<property name="icon_size">1</property>
@ -491,7 +513,7 @@
<signal name="activate" handler="on_btnDownloadedExecute_clicked" last_modification_time="Fri, 08 Dec 2006 23:50:54 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2225">
<widget class="GtkImage" id="image2325">
<property name="visible">True</property>
<property name="stock">gtk-media-play</property>
<property name="icon_size">1</property>
@ -515,7 +537,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image2226">
<widget class="GtkImage" id="image2326">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -537,7 +559,7 @@
<signal name="activate" handler="on_homepage_activate" last_modification_time="Mon, 04 Dec 2006 12:08:55 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2227">
<widget class="GtkImage" id="image2327">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@ -564,7 +586,7 @@
<signal name="activate" handler="on_wishlist_activate" last_modification_time="Mon, 04 Dec 2006 12:06:32 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2228">
<widget class="GtkImage" id="image2328">
<property name="visible">True</property>
<property name="stock">gtk-edit</property>
<property name="icon_size">1</property>
@ -585,7 +607,7 @@
<signal name="activate" handler="on_mailinglist_activate" last_modification_time="Mon, 04 Dec 2006 12:12:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2229">
<widget class="GtkImage" id="image2329">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -612,7 +634,7 @@
<signal name="activate" handler="on_itemAbout_activate" last_modification_time="Sat, 29 Oct 2005 11:40:19 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image2230">
<widget class="GtkImage" id="image2330">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>

View File

@ -454,6 +454,43 @@ class Gpodder(SimpleGladeApp):
self.showMessage( _('Subscribe to some channels first.'))
#-- Gpodder.on_itemUpdate_activate }
#-- Gpodder.on_itemDownloadAllNew_activate {
def on_itemDownloadAllNew_activate(self, widget, *args):
gl = gPodderLib()
to_download = []
message_part = ''
for channel in self.channels:
s = 0
last_pubdate = channel.newest_pubdate_downloaded()
if not last_pubdate:
log( 'Downloading newest three episodes.')
for episode in channel[0:min(len(channel),3)]:
to_download.append( ( channel, episode ))
s = s + 1
else:
for episode in channel:
if episode.compare_pubdate( last_pubdate) >= 0 and not channel.is_downloaded( episode) and not gl.history_is_downloaded( episode.url):
log( 'Episode "%s" is newer.', episode.title)
to_download.append( ( channel, episode ))
s = s + 1
if s:
message_part = message_part + (_('%d new in %s') % ( s, channel.title, )) + "\n"
if to_download:
if self.showConfirmation( _("New episodes:\n\n%s\nDo you want to download them now?") % ( message_part, )):
for channel, episode in to_download:
filename = channel.getPodcastFilename( episode.url)
if not os.path.exists( filename) and not self.download_status_manager.is_download_in_progress( episode.url):
downloadThread( episode.url, filename, None, self.download_status_manager, episode.title, channel, episode, self.ldb).download()
else:
self.showMessage( _('No new episodes.'))
self.updateTreeView()
#-- Gpodder.on_itemDownloadAllNew_activate }
#-- Gpodder.on_sync_to_ipod_activate {
def on_sync_to_ipod_activate(self, widget, *args):
gl = gPodderLib()