misc changes

This commit is contained in:
nathom 2021-03-28 14:56:23 -07:00
parent ead14afbbe
commit afb76e530c
5 changed files with 17 additions and 11 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@ dist
build build
test.py test.py
/urls.txt /urls.txt
*.flac

View file

@ -1,5 +1,6 @@
import datetime
import base64 import base64
import json
import datetime
import hashlib import hashlib
import logging import logging
import os import os
@ -551,7 +552,7 @@ class TidalMQAClient:
} }
resp = self._api_post(f"{TIDAL_AUTH_URL}/device_authorization", data) resp = self._api_post(f"{TIDAL_AUTH_URL}/device_authorization", data)
if 'status' in resp and resp['status'] != 200: if "status" in resp and resp["status"] != 200:
raise Exception(f"Device authorization failed {resp}") raise Exception(f"Device authorization failed {resp}")
logger.debug(pformat(resp)) logger.debug(pformat(resp))
@ -650,8 +651,8 @@ class TidalMQAClient:
"assetpresentation": "FULL", "assetpresentation": "FULL",
} }
resp = self._api_request(f"tracks/{track_id}/playbackinfopostpaywall", params) resp = self._api_request(f"tracks/{track_id}/playbackinfopostpaywall", params)
manifest = json.loads(base64.b64decode(resp['manifest']).decode("utf-8")) manifest = json.loads(base64.b64decode(resp["manifest"]).decode("utf-8"))
codec = manifest['codecs'] codec = manifest["codecs"]
file_url = manifest["urls"][0] file_url = manifest["urls"][0]
enc_key = manifest.get("keyId", "") enc_key = manifest.get("keyId", "")
return resp return manifest

View file

@ -32,14 +32,18 @@ class Config:
defaults = { defaults = {
"qobuz": { "qobuz": {
"enabled": True,
"email": None, "email": None,
"password": None, "password": None,
"app_id": "", # Avoid NoneType error "app_id": "", # Avoid NoneType error
"secrets": [], "secrets": [],
}, },
"tidal": {"enabled": True, "email": None, "password": None}, "tidal": {
"deezer": {"enabled": True}, "user_id": None,
"country_code": None,
"access_token": None,
"refresh_token": None,
"expires_after": 0,
},
"database": {"enabled": True, "path": None}, "database": {"enabled": True, "path": None},
"conversion": { "conversion": {
"enabled": False, "enabled": False,

View file

@ -8,7 +8,7 @@ APPNAME = "streamrip"
CACHE_DIR = click.get_app_dir(APPNAME) CACHE_DIR = click.get_app_dir(APPNAME)
CONFIG_DIR = click.get_app_dir(APPNAME) CONFIG_DIR = click.get_app_dir(APPNAME)
CONFIG_PATH = os.path.join(CONFIG_DIR, "config.yaml") CONFIG_PATH = os.path.join(CONFIG_DIR, "configmqa.yaml")
LOG_DIR = click.get_app_dir(APPNAME) LOG_DIR = click.get_app_dir(APPNAME)
DB_PATH = os.path.join(LOG_DIR, "downloads.db") DB_PATH = os.path.join(LOG_DIR, "downloads.db")

View file

@ -5,10 +5,10 @@ from string import Formatter
from typing import Optional from typing import Optional
import requests import requests
from pathvalidate import sanitize_filename
from tqdm import tqdm
from Crypto.Cipher import AES from Crypto.Cipher import AES
from Crypto.Util import Counter from Crypto.Util import Counter
from pathvalidate import sanitize_filename
from tqdm import tqdm
from .constants import LOG_DIR, TIDAL_COVER_URL from .constants import LOG_DIR, TIDAL_COVER_URL
from .exceptions import NonStreamable from .exceptions import NonStreamable