mirror of
https://github.com/Wojtek242/qobuz-dl.git
synced 2024-11-22 11:05:25 +01:00
This commit is contained in:
parent
bba6f3a71a
commit
b8e68e2bf3
@ -1,5 +1,5 @@
|
||||
import base64
|
||||
import configparser
|
||||
import hashlib
|
||||
import logging
|
||||
import glob
|
||||
import os
|
||||
@ -29,13 +29,10 @@ def reset_config(config_file):
|
||||
logging.info(f"{YELLOW}Creating config file: {config_file}")
|
||||
config = configparser.ConfigParser()
|
||||
config["DEFAULT"]["email"] = input("Enter your email:\n- ")
|
||||
config["DEFAULT"]["password"] = base64.b64encode(
|
||||
input("Enter your password\n- ").encode()
|
||||
).decode()
|
||||
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 empy for default 'Qobuz Downloads')\n- ")
|
||||
or "Qobuz Downloads"
|
||||
)
|
||||
config["DEFAULT"]["default_quality"] = (
|
||||
@ -89,7 +86,7 @@ def main():
|
||||
|
||||
try:
|
||||
email = config["DEFAULT"]["email"]
|
||||
password = base64.b64decode(config["DEFAULT"]["password"]).decode()
|
||||
password = config["DEFAULT"]["password"]
|
||||
default_folder = config["DEFAULT"]["default_folder"]
|
||||
default_limit = config["DEFAULT"]["default_limit"]
|
||||
default_quality = config["DEFAULT"]["default_quality"]
|
||||
@ -133,9 +130,8 @@ def main():
|
||||
quality_fallback=not arguments.no_fallback or not no_fallback,
|
||||
cover_og_quality=arguments.og_cover or og_cover,
|
||||
no_cover=arguments.no_cover or no_cover,
|
||||
downloads_db=None if no_database or arguments.no_db else QOBUZ_DB
|
||||
downloads_db=None if no_database or arguments.no_db else QOBUZ_DB,
|
||||
)
|
||||
|
||||
qobuz.initialize_client(email, password, app_id, secrets)
|
||||
|
||||
try:
|
||||
|
@ -184,12 +184,17 @@ class QobuzDL:
|
||||
def download_from_txt_file(self, txt_file):
|
||||
with open(txt_file, "r") as txt:
|
||||
try:
|
||||
urls = txt.read().strip().split()
|
||||
urls = [
|
||||
line.replace("\n", "")
|
||||
for line in txt.readlines()
|
||||
if not line.strip().startswith("#")
|
||||
]
|
||||
except Exception as e:
|
||||
logger.error(f"{RED}Invalid text file: {e}")
|
||||
return
|
||||
logger.info(
|
||||
f'{YELLOW}qobuz-dl will download {len(urls)} urls from file: "{txt_file}"'
|
||||
f"{YELLOW}qobuz-dl will download {len(urls)}"
|
||||
f" urls from file: {txt_file}"
|
||||
)
|
||||
self.download_list_of_urls(urls)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user