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)
|
return yt_dlp.YoutubeDL(self.ytdl_dry_opts)
|
||||||
|
|
||||||
def filter(self, args: configargparse.Namespace) -> typing.Iterable[RVElement]:
|
def filter(self, args: configargparse.Namespace) -> typing.Iterable[RVElement]:
|
||||||
|
elements_src = self.elements.copy()
|
||||||
elements: typing.Iterable[RVElement]
|
elements: typing.Iterable[RVElement]
|
||||||
# Inexpensive sort
|
# Inexpensive sort
|
||||||
if args.order == "new":
|
if args.order == "new":
|
||||||
elements = reversed(self.elements)
|
elements = reversed(elements_src)
|
||||||
elif args.order == "title":
|
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":
|
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":
|
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":
|
elif args.order == "random":
|
||||||
elements_random = self.elements.copy()
|
elements = elements_src
|
||||||
random.shuffle(elements_random)
|
random.shuffle(elements)
|
||||||
elements = elements_random
|
|
||||||
else:
|
else:
|
||||||
elements = self.elements
|
elements = elements_src
|
||||||
|
|
||||||
# Possibly expensive filtering
|
# Possibly expensive filtering
|
||||||
elements = filter(lambda el: el.matches_filter(args), elements)
|
elements = filter(lambda el: el.matches_filter(args), elements)
|
||||||
|
|
Loading…
Reference in a new issue