Dedent by performing loop outside of this function.

master
voussoir 2020-11-09 16:29:59 -08:00
parent c2d10da6b6
commit 1263123a03
1 changed files with 13 additions and 10 deletions

View File

@ -182,18 +182,21 @@ class YCDLDBChannelMixin:
else: else:
raise raise
def assisted(): def assisted(channel):
for channel in self.get_channels(): try:
try: most_recent_video = channel.get_most_recent_video_id()
most_recent_video = channel.get_most_recent_video_id() new_ids = ytrss.get_user_videos_since(channel.id, most_recent_video)
new_ids = ytrss.get_user_videos_since(channel.id, most_recent_video)
except (exceptions.NoVideos, exceptions.RSSAssistFailed) as exc:
self.log.debug('RSS assist failed "%s", using traditional refresh.', exc.error_message)
traditional(channel)
continue
yield from new_ids yield from new_ids
except (exceptions.NoVideos, exceptions.RSSAssistFailed) as exc:
self.log.debug(
'RSS assist for %s failed "%s", using traditional refresh.',
channel.id,
exc.error_message
)
traditional(channel)
for video in self.youtube.get_videos(assisted()): new_ids = (id for channel in self.get_channels() for id in assisted(channel))
for video in self.youtube.get_videos(new_ids):
self.ingest_video(video, commit=False) self.ingest_video(video, commit=False)
if commit: if commit: