Add scrape option

Signed-off-by: nathom <nathanthomas707@gmail.com>
This commit is contained in:
nathom 2021-07-09 14:19:13 -07:00
parent e6dfc3f507
commit 5cd3913976
2 changed files with 12 additions and 0 deletions

View file

@ -193,6 +193,9 @@ def search(ctx, **kwargs):
@cli.command() @cli.command()
@click.option("-l", "--list", default="ideal-discography") @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 @click.pass_context
def discover(ctx, **kwargs): def discover(ctx, **kwargs):
"""Search for albums in Qobuz's featured lists. """Search for albums in Qobuz's featured lists.
@ -228,6 +231,7 @@ def discover(ctx, **kwargs):
* universal-jeunesse * universal-jeunesse
* universal-chanson * universal-chanson
""" """
from streamrip.constants import QOBUZ_FEATURED_KEYS from streamrip.constants import QOBUZ_FEATURED_KEYS
@ -235,6 +239,11 @@ def discover(ctx, **kwargs):
kwargs["list"] in QOBUZ_FEATURED_KEYS kwargs["list"] in QOBUZ_FEATURED_KEYS
), f"Invalid featured key {kwargs['list']}" ), f"Invalid featured key {kwargs['list']}"
if kwargs["scrape"]:
core.scrape(kwargs["list"])
core.download()
return
if core.interactive_search(kwargs["list"], "qobuz", "featured"): if core.interactive_search(kwargs["list"], "qobuz", "featured"):
core.download() core.download()
else: else:

View file

@ -316,6 +316,9 @@ class MusicDL(list):
if arguments["conversion"]["enabled"]: if arguments["conversion"]["enabled"]:
item.convert(**arguments["conversion"]) 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: def get_client(self, source: str) -> Client:
"""Get a client given the source and log in. """Get a client given the source and log in.