Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def list_videos(self) -> List[Video]:
"""Return a list of videos that match the filters set by the set_*_filter methods.
:return: A list of videos.
"""
if self.video_id_filter:
return self.database.session.query(Video) \
.join(Channel, Channel.yt_channelid == Video.publisher) \
.filter(Video.id.in_(self.video_id_filter)) \
.order_by(*self.config.order_by).all()
if not self.date_end_filter[1]:
date_end_filter = time.mktime(time.gmtime()) + 20
else:
date_end_filter = self.date_end_filter[0]
query = self.database.session.query(Video) \
.join(Channel, Channel.yt_channelid == Video.publisher) \
.filter(Video.publish_date > self.date_begin_filter) \
.filter(Video.publish_date < date_end_filter)
if self.channel_filter:
query = query.filter(Channel.displayname.in_(self.channel_filter))
if not self.include_watched_filter:
def resolve_video_ids(self, video_ids: Iterable[int]):
return self.session.query(Video).filter(Video.id.in_(video_ids))