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
test.py
/urls.txt
*.flac

View File

@ -1,5 +1,6 @@
import datetime
import base64
import json
import datetime
import hashlib
import logging
import os
@ -551,7 +552,7 @@ class TidalMQAClient:
}
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}")
logger.debug(pformat(resp))
@ -650,8 +651,8 @@ class TidalMQAClient:
"assetpresentation": "FULL",
}
resp = self._api_request(f"tracks/{track_id}/playbackinfopostpaywall", params)
manifest = json.loads(base64.b64decode(resp['manifest']).decode("utf-8"))
codec = manifest['codecs']
manifest = json.loads(base64.b64decode(resp["manifest"]).decode("utf-8"))
codec = manifest["codecs"]
file_url = manifest["urls"][0]
enc_key = manifest.get("keyId", "")
return resp
return manifest

View File

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

View File

@ -8,7 +8,7 @@ APPNAME = "streamrip"
CACHE_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)
DB_PATH = os.path.join(LOG_DIR, "downloads.db")

View File

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