From cb9b36ba39f36fc3357bcc448478cf068f516d55 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Sun, 14 Jun 2020 08:44:18 -0400 Subject: [PATCH 1/2] Upgrade getargs to getfullargs Fixes gpodder/gpodder-core/issues/36 --- bin/gpo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/gpo b/bin/gpo index 4509d37..d8f4c92 100755 --- a/bin/gpo +++ b/bin/gpo @@ -1136,7 +1136,7 @@ class gPodderCli(object): out(*args) def _checkargs(self, func, command_line): - args, varargs, keywords, defaults = inspect.getargspec(func) + args, varargs, keywords, defaults, _, _, _ = inspect.getfullargspec(func) args.pop(0) # Remove "self" from args defaults = defaults or () minarg, maxarg = len(args)-len(defaults), len(args) From 7f07f337c9df193cf4cd9780292de56aebadbb86 Mon Sep 17 00:00:00 2001 From: Mike Crowe Date: Sun, 14 Jun 2020 08:59:43 -0400 Subject: [PATCH 2/2] Add support to cap max number of downloads --- bin/gpo | 9 +++++++++ src/gpodder/config.py | 1 + 2 files changed, 10 insertions(+) diff --git a/bin/gpo b/bin/gpo index d8f4c92..0b33bdf 100755 --- a/bin/gpo +++ b/bin/gpo @@ -898,15 +898,24 @@ class gPodderCli(object): Use {pending} to see a list of episodes that would be downloaded. """ count = 0 + max = self._config.get_field('limit.downloads.podcast_max_new') for podcast in self._get_podcasts(url): podcast_printed = False + current = 0 for episode in podcast.episodes: + if episode.state == gpodder.STATE_DOWNLOADED: + current += 1 + if current >= max: + break if self._is_episode_new(episode): if not podcast_printed: out(inblue(podcast.title)) podcast_printed = True self._download_episode(episode) count += 1 + current += 1 + if current >= max: + break self._download_summary(count) return True diff --git a/src/gpodder/config.py b/src/gpodder/config.py index 5c1cae5..1387ced 100644 --- a/src/gpodder/config.py +++ b/src/gpodder/config.py @@ -43,6 +43,7 @@ 'downloads': { 'enabled': True, 'concurrent': 1, + 'podcast_max_new': 200, # per podcast download limit same as episode limit }, 'episodes': 200, # max episodes per feed },