From 5cd391397691b7b2f9534220adf335b130409396 Mon Sep 17 00:00:00 2001 From: nathom Date: Fri, 9 Jul 2021 14:19:13 -0700 Subject: [PATCH] Add scrape option Signed-off-by: nathom --- rip/cli.py | 9 +++++++++ rip/core.py | 3 +++ 2 files changed, 12 insertions(+) diff --git a/rip/cli.py b/rip/cli.py index 65c57f4..9c1e19f 100644 --- a/rip/cli.py +++ b/rip/cli.py @@ -193,6 +193,9 @@ def search(ctx, **kwargs): @cli.command() @click.option("-l", "--list", default="ideal-discography") +@click.option( + "-s", "--scrape", is_flag=True, help="Download all of the items in a list." +) @click.pass_context def discover(ctx, **kwargs): """Search for albums in Qobuz's featured lists. @@ -228,6 +231,7 @@ def discover(ctx, **kwargs): * universal-jeunesse * universal-chanson + """ from streamrip.constants import QOBUZ_FEATURED_KEYS @@ -235,6 +239,11 @@ def discover(ctx, **kwargs): kwargs["list"] in QOBUZ_FEATURED_KEYS ), f"Invalid featured key {kwargs['list']}" + if kwargs["scrape"]: + core.scrape(kwargs["list"]) + core.download() + return + if core.interactive_search(kwargs["list"], "qobuz", "featured"): core.download() else: diff --git a/rip/core.py b/rip/core.py index f6b4480..6ea38f8 100644 --- a/rip/core.py +++ b/rip/core.py @@ -316,6 +316,9 @@ class MusicDL(list): if arguments["conversion"]["enabled"]: item.convert(**arguments["conversion"]) + def scrape(self, featured_list: str): + self.extend(self.search("qobuz", featured_list, "featured", limit=500)) + def get_client(self, source: str) -> Client: """Get a client given the source and log in.