diff --git a/streamrip/bases.py b/streamrip/bases.py index c8519c2..ab9eb81 100644 --- a/streamrip/bases.py +++ b/streamrip/bases.py @@ -594,6 +594,8 @@ class Video: p = subprocess.Popen(command) p.wait() # remove this? + return False # so that it is not tagged + @classmethod def from_album_meta(cls, track: dict, client: Client): return cls( diff --git a/streamrip/config.py b/streamrip/config.py index 2288c0a..f3fab8b 100644 --- a/streamrip/config.py +++ b/streamrip/config.py @@ -48,6 +48,7 @@ class Config: defaults = { "qobuz": { "quality": 3, + "download_booklets": True, "email": None, "password": None, "app_id": "", @@ -55,6 +56,7 @@ class Config: }, "tidal": { "quality": 3, + "download_videos": True, "user_id": None, "country_code": None, "access_token": None, @@ -115,10 +117,11 @@ class Config: self.load() def update(self): + """Resets the config file except for credentials.""" self.reset() temp = copy.deepcopy(self.defaults) - temp["qobuz"] = self.file["qobuz"] - temp["tidal"] = self.file["tidal"] + temp["qobuz"].update(self.file["qobuz"]) + temp['tidal'].update(self.file['tidal']) self.dump(temp) def save(self): @@ -209,11 +212,13 @@ class ConfigDocumentation: """Documentation is stored in this docstring. qobuz: quality: 1: 320kbps MP3, 2: 16/44.1, 3: 24/<=96, 4: 24/>=96 + download_booklets: This will download booklet pdfs that are included with some albums password: This is an md5 hash of the plaintext password app_id: Do not change secrets: Do not change tidal: quality: 0, 1, 2, or 3 + download_videos: This will download videos included in Video Albums. user_id: Do not change any of the fields below token_expiry: Tokens last 1 week after refresh. This is the Unix timestamp of the expiration time. deezer: Deezer doesn't require login diff --git a/streamrip/core.py b/streamrip/core.py index 4d5e13b..d24ebaa 100644 --- a/streamrip/core.py +++ b/streamrip/core.py @@ -132,6 +132,8 @@ class MusicDL(list): "new_tracknumbers": self.config.session["metadata"][ "new_playlist_tracknumbers" ], + "download_videos": self.config.session['tidal']['download_videos'], + 'download_booklets': self.config.session['qobuz']['download_booklets'], } def download(self): diff --git a/streamrip/downloader.py b/streamrip/downloader.py index f3ea0f6..bc8e000 100644 --- a/streamrip/downloader.py +++ b/streamrip/downloader.py @@ -7,7 +7,7 @@ import logging import os import re from tempfile import gettempdir -from typing import Generator, Iterable +from typing import Generator, Iterable, Union import click from pathvalidate import sanitize_filename @@ -139,20 +139,20 @@ class Album(Tracklist): self.cover_obj = None # Download the booklet if applicable - if self.get("booklets"): + if self.get("booklets") and kwargs.get('download_booklets', True): click.secho("\nDownloading booklets", fg='blue') for item in self.booklets: Booklet(item).download(parent_folder=self.folder) def _download_item( self, - track: Track, + track: Union[Track, Video], quality: int = 3, database: MusicDB = None, **kwargs, ) -> bool: logger.debug("Downloading track to %s", self.folder) - if self.disctotal > 1: + if self.disctotal > 1 and isinstance(track, Track): disc_folder = os.path.join(self.folder, f"Disc {track.meta.discnumber}") kwargs["parent_folder"] = disc_folder else: