Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
nathom committed Jan 22, 2022
2 parents 4cf2944 + 7b3aab1 commit 2418c4e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "streamrip"
version = "1.9.2"
version = "1.9.3"
description = "A fast, all-in-one music ripper for Qobuz, Deezer, Tidal, and SoundCloud"
authors = ["nathom <[email protected]>"]
license = "GPL-3.0-only"
Expand Down
Empty file removed rg
Empty file.
3 changes: 0 additions & 3 deletions rip/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ def handle_urls(self, urls):

for source, url_type, item_id in parsed:
if item_id in self.db:
logger.info(
f"ID {item_id} already downloaded, use --ignore-db to override."
)
secho(
f"ID {item_id} already downloaded, use --ignore-db to override.",
fg="magenta",
Expand Down
2 changes: 1 addition & 1 deletion streamrip/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""streamrip: the all in one music downloader."""

__version__ = "1.9.2"
__version__ = "1.9.3"

from . import clients, constants, converter, downloadtools, media
3 changes: 1 addition & 2 deletions streamrip/clients.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""The clients that interact with the service APIs."""
"""The clients that interact with the streaming service APIs."""

import base64
import binascii
Expand Down Expand Up @@ -116,7 +116,6 @@ def login(self, **kwargs):
:type pwd: str
:param kwargs: app_id: str, secrets: list, return_secrets: bool
"""
# TODO: make this faster
secho(f"Logging into {self.source}", fg="green")
email: str = kwargs["email"]
pwd: str = kwargs["pwd"]
Expand Down
8 changes: 6 additions & 2 deletions streamrip/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Constants that are kept in one place."""

import base64

import mutagen.id3 as id3

AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0"
Expand Down Expand Up @@ -174,8 +176,10 @@
COVER_SIZES = ("thumbnail", "small", "large", "original")

TIDAL_CLIENT_INFO = {
"id": "Pzd0ExNVHkyZLiYN",
"secret": "W7X6UvBaho+XOi1MUeCX6ewv2zTdSOV3Y7qC3p3675I=",
"id": base64.b64decode("OFNFWldhNEoxTlZDNVU1WQ==").decode("iso-8859-1"),
"secret": base64.b64decode(
"b3dVWURreGRkeis5RnB2R1gyNERseEVDTnRGRU1CeGlwVTBsQmZyYnE2MD0="
).decode("iso-8859-1"),
}

QOBUZ_BASE = "https://www.qobuz.com/api.json/0.2"
Expand Down
8 changes: 5 additions & 3 deletions streamrip/downloadtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,11 @@ async def _download_url(self, session, url):
filename = await self.getfn(url)
logger.debug("Downloading %s", url)
async with session.get(url) as response, aiofiles.open(filename, "wb") as f:
# without aiofiles 3.6632679780000004s
# with aiofiles 2.504482839s
await f.write(await response.content.read())
# without aiofiles 3.6632679780000004s
# with aiofiles 2.504482839s
content = await response.content.read()
print(content)
await f.write(content)

if self.callback:
self.callback()
Expand Down
10 changes: 7 additions & 3 deletions streamrip/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -1495,7 +1495,11 @@ def _prepare_download(self, **kwargs):
"""
# Generate the folder name
self.folder_format = kwargs.get("folder_format", FOLDER_FORMAT)
self.quality = min(kwargs.get("quality", 3), self.client.max_quality)
self.quality = min(
kwargs.get("quality", 3),
self.client.max_quality,
self.meta.get("quality", 5),
)

self.container = get_container(self.quality, self.client.source)
# necessary to format the folder
Expand All @@ -1521,8 +1525,8 @@ def _prepare_download(self, **kwargs):
self.folder,
kwargs.get("keep_hires_cover", True),
(
kwargs.get("max_artwork_width", 999999),
kwargs.get("max_artwork_height", 999999),
kwargs.get("max_artwork_width", 1e9),
kwargs.get("max_artwork_height", 1e9),
),
)

Expand Down

0 comments on commit 2418c4e

Please sign in to comment.