mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-12-22 15:24:40 +01:00
parent
e57cf32481
commit
f34975e54f
@ -32,14 +32,14 @@ def reset_config(config_file):
|
||||
password = input("Enter your password\n- ")
|
||||
config["DEFAULT"]["password"] = hashlib.md5(password.encode("utf-8")).hexdigest()
|
||||
config["DEFAULT"]["default_folder"] = (
|
||||
input("Folder for downloads (leave empy for default 'Qobuz Downloads')\n- ")
|
||||
input("Folder for downloads (leave empty for default 'Qobuz Downloads')\n- ")
|
||||
or "Qobuz Downloads"
|
||||
)
|
||||
config["DEFAULT"]["default_quality"] = (
|
||||
input(
|
||||
"Download quality (5, 6, 7, 27) "
|
||||
"[320, LOSSLESS, 24B <96KHZ, 24B >96KHZ]"
|
||||
"\n(leave empy for default '6')\n- "
|
||||
"\n(leave empty for default '6')\n- "
|
||||
)
|
||||
or "6"
|
||||
)
|
||||
|
@ -102,13 +102,17 @@ class QobuzDL:
|
||||
|
||||
def download_from_id(self, item_id, album=True, alt_path=None):
|
||||
if handle_download_id(self.downloads_db, item_id, add_id=False):
|
||||
logger.info(f"{OFF}This release ID ({item_id}) was already downloaded")
|
||||
logger.info(
|
||||
f"{OFF}This release ID ({item_id}) was already downloaded "
|
||||
"according to the local database.\nUse the '--no-db' flag "
|
||||
"to bypass this."
|
||||
)
|
||||
return
|
||||
try:
|
||||
downloader.download_id_by_type(
|
||||
self.client,
|
||||
item_id,
|
||||
self.directory if not alt_path else alt_path,
|
||||
alt_path or self.directory,
|
||||
str(self.quality),
|
||||
album,
|
||||
self.embed_art,
|
||||
|
@ -7,6 +7,7 @@ from tqdm import tqdm
|
||||
|
||||
import qobuz_dl.metadata as metadata
|
||||
from qobuz_dl.color import OFF, GREEN, RED, YELLOW, CYAN
|
||||
from qobuz_dl.exceptions import NonStreamable
|
||||
|
||||
QL_DOWNGRADE = "FormatRestrictedByFormatAvailability"
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -145,8 +146,8 @@ def download_and_tag(
|
||||
if version:
|
||||
new_track_title = f"{new_track_title} ({version})"
|
||||
|
||||
track_file = f'{track_metadata["track_number"]:02}. {new_track_title}{extension}'
|
||||
final_file = os.path.join(root_dir, sanitize_filename(track_file))
|
||||
track_file = f'{track_metadata["track_number"]:02}. {new_track_title}'
|
||||
final_file = os.path.join(root_dir, sanitize_filename(track_file))[:250] + extension
|
||||
|
||||
if os.path.isfile(final_file):
|
||||
logger.info(f"{OFF}{new_track_title} was already downloaded")
|
||||
@ -200,6 +201,9 @@ def download_id_by_type(
|
||||
if album:
|
||||
meta = client.get_album_meta(item_id)
|
||||
|
||||
if not meta.get("streamable"):
|
||||
raise NonStreamable("This release is not streamable")
|
||||
|
||||
if albums_only and (
|
||||
meta.get("release_type") != "album"
|
||||
or meta.get("artist").get("name") == "Various Artists"
|
||||
|
@ -16,3 +16,7 @@ class InvalidAppSecretError(Exception):
|
||||
|
||||
class InvalidQuality(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class NonStreamable(Exception):
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user