mirror of
https://github.com/nathom/streamrip.git
synced 2025-05-17 16:45:13 -04:00
Fix bug where mp3 and —quality doesn’t work
This commit is contained in:
parent
3d56defddf
commit
41c4ef4f79
4 changed files with 15 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,3 +9,4 @@ test.py
|
||||||
/Downloads
|
/Downloads
|
||||||
/Street Runner.mp3
|
/Street Runner.mp3
|
||||||
/StreamripDownloads
|
/StreamripDownloads
|
||||||
|
/ADDYS.wav
|
||||||
|
|
|
@ -58,13 +58,14 @@ def cli(ctx, **kwargs):
|
||||||
config.session["conversion"]["enabled"] = True
|
config.session["conversion"]["enabled"] = True
|
||||||
config.session["conversion"]["codec"] = kwargs["convert"]
|
config.session["conversion"]["codec"] = kwargs["convert"]
|
||||||
if kwargs["quality"] is not None:
|
if kwargs["quality"] is not None:
|
||||||
if kwargs["quality"] not in range(5):
|
quality = int(kwargs['quality'])
|
||||||
|
if quality not in range(5):
|
||||||
click.secho("Invalid quality", fg="red")
|
click.secho("Invalid quality", fg="red")
|
||||||
return
|
return
|
||||||
|
|
||||||
config.session["qobuz"]["quality"] = kwargs["quality"]
|
config.session["qobuz"]["quality"] = quality
|
||||||
config.session["tidal"]["quality"] = kwargs["quality"]
|
config.session["tidal"]["quality"] = quality
|
||||||
config.session["deezer"]["quality"] = kwargs["quality"]
|
config.session["deezer"]["quality"] = quality
|
||||||
|
|
||||||
core = MusicDL(config)
|
core = MusicDL(config)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import logging
|
import logging
|
||||||
|
from pprint import pprint
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -671,6 +672,7 @@ class Album(Tracklist):
|
||||||
def load_meta(self):
|
def load_meta(self):
|
||||||
assert hasattr(self, "id"), "id must be set to load metadata"
|
assert hasattr(self, "id"), "id must be set to load metadata"
|
||||||
self.meta = self.client.get(self.id, media_type="album")
|
self.meta = self.client.get(self.id, media_type="album")
|
||||||
|
pprint(self.meta)
|
||||||
|
|
||||||
# update attributes based on response
|
# update attributes based on response
|
||||||
for k, v in self._parse_get_resp(self.meta, self.client).items():
|
for k, v in self._parse_get_resp(self.meta, self.client).items():
|
||||||
|
@ -695,6 +697,11 @@ class Album(Tracklist):
|
||||||
:rtype: dict
|
:rtype: dict
|
||||||
"""
|
"""
|
||||||
if client.source == "qobuz":
|
if client.source == "qobuz":
|
||||||
|
if resp.get("maximum_sampling_rate", False):
|
||||||
|
sampling_rate = resp['maximum_sampling_rate'] * 1000
|
||||||
|
else:
|
||||||
|
sampling_rate = None
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"id": resp.get("id"),
|
"id": resp.get("id"),
|
||||||
"title": resp.get("title"),
|
"title": resp.get("title"),
|
||||||
|
@ -709,7 +716,7 @@ class Album(Tracklist):
|
||||||
resp.get("maximum_bit_depth"), resp.get("maximum_sampling_rate")
|
resp.get("maximum_bit_depth"), resp.get("maximum_sampling_rate")
|
||||||
),
|
),
|
||||||
"bit_depth": resp.get("maximum_bit_depth"),
|
"bit_depth": resp.get("maximum_bit_depth"),
|
||||||
"sampling_rate": resp.get("maximum_sampling_rate") * 1000,
|
"sampling_rate": sampling_rate,
|
||||||
"tracktotal": resp.get("tracks_count"),
|
"tracktotal": resp.get("tracks_count"),
|
||||||
}
|
}
|
||||||
elif client.source == "tidal":
|
elif client.source == "tidal":
|
||||||
|
|
|
@ -330,7 +330,7 @@ class TrackMetadata:
|
||||||
else:
|
else:
|
||||||
text = getattr(self, k)
|
text = getattr(self, k)
|
||||||
|
|
||||||
if text is not None:
|
if text is not None and v is not None:
|
||||||
yield (v.__name__, v(encoding=3, text=text))
|
yield (v.__name__, v(encoding=3, text=text))
|
||||||
|
|
||||||
def __mp4_tags(self) -> Tuple[str, str]:
|
def __mp4_tags(self) -> Tuple[str, str]:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue