rssVideos: Fix binge mode
This commit is contained in:
parent
8ae5c00f53
commit
75d7b9fc6d
|
@ -464,22 +464,22 @@ class RVDatabase:
|
|||
return yt_dlp.YoutubeDL(self.ytdl_dry_opts)
|
||||
|
||||
def filter(self, args: configargparse.Namespace) -> typing.Iterable[RVElement]:
|
||||
elements_src = self.elements.copy()
|
||||
elements: typing.Iterable[RVElement]
|
||||
# Inexpensive sort
|
||||
if args.order == "new":
|
||||
elements = reversed(self.elements)
|
||||
elements = reversed(elements_src)
|
||||
elif args.order == "title":
|
||||
elements = sorted(self.elements, key=lambda el: el.title)
|
||||
elements = sorted(elements_src, key=lambda el: el.title)
|
||||
elif args.order == "creator":
|
||||
elements = sorted(self.elements, key=lambda el: el.creator or "")
|
||||
elements = sorted(elements_src, key=lambda el: el.creator or "")
|
||||
elif args.order == "link":
|
||||
elements = sorted(self.elements, key=lambda el: el.link)
|
||||
elements = sorted(elements_src, key=lambda el: el.link)
|
||||
elif args.order == "random":
|
||||
elements_random = self.elements.copy()
|
||||
random.shuffle(elements_random)
|
||||
elements = elements_random
|
||||
elements = elements_src
|
||||
random.shuffle(elements)
|
||||
else:
|
||||
elements = self.elements
|
||||
elements = elements_src
|
||||
|
||||
# Possibly expensive filtering
|
||||
elements = filter(lambda el: el.matches_filter(args), elements)
|
||||
|
|
Loading…
Reference in a new issue