Implement "pause subscription" in "gpo"

This commit is contained in:
Thomas Perl 2010-09-27 00:22:13 +02:00
parent b785d1113f
commit 276d3cd060
2 changed files with 25 additions and 5 deletions

20
bin/gpo
View file

@ -37,6 +37,7 @@
info URL Show information about feed at URL
list List all subscribed podcasts
update Refresh all feeds (check for new episodes)
update URL Refresh the feed at URL
Episode management
------------------
@ -180,11 +181,20 @@ class gPodderCli(object):
return True
def update(self):
for podcast in self.client.get_podcasts():
print 'Updating', podcast.title
podcast.update()
print 'Done.'
def update(self, url=None):
if url is None:
for podcast in self.client.get_podcasts():
if podcast.update_enabled():
print 'Updating', podcast.title
podcast.update()
print 'Done.'
else:
for podcast in self.client.get_podcasts():
if podcast.url == url:
# Don't need to check for update_enabled()
print 'Updating', podcast.title
podcast.update()
print 'Done.'
return True

View file

@ -74,6 +74,16 @@ class Podcast(object):
self._podcast.delete()
self._podcast = None
def update_enabled(self):
"""Check if this feed has updates enabled
This function will return True if the podcast has feed
updates enabled. If the user pauses a subscription, the
feed updates are disabled, and the podcast should be
excluded from automatic updates.
"""
return self._podcast.feed_update_enabled
def update(self):
"""Updates this podcast by downloading the feed