Compare commits

..

No commits in common. "72531f0bee9eafe7f8cf259b8f8a54afc723ab3f" and "6226ae4a139169da33d2cfcfb468b004148f820c" have entirely different histories.

3 changed files with 6 additions and 16 deletions

View File

@ -68,11 +68,9 @@ def write_metadata_to_target(metadata: Metadata, target: Target, song: Song):
LOGGER.info(str(metadata))
if song.artwork.best_variant is not None:
best_variant = song.artwork.best_variant
r = artwork_connection.get(
url=best_variant["url"],
name=song.artwork.get_variant_name(best_variant, song.option_string),
url=song.artwork.best_variant["url"],
disable_cache=False,
)
temp_target: Target = Target.temp()

View File

@ -8,7 +8,7 @@ from .metadata import (
ID3Timestamp,
Metadata
)
from ..utils.string_processing import unify, hash_url, hash_url
from ..utils.string_processing import unify, hash_url
from .parents import OuterProxy as Base
@ -50,9 +50,6 @@ class Artwork:
return None
return min(self._variant_mapping.values(), key=lambda x: x["deviation"])
def get_variant_name(self, variant: ArtworkVariant, option_string: str) -> str:
return f"artwork_{variant['width']}x{variant['height']}_{option_string}"
def __merge__(self, other: Artwork, override: bool = False) -> None:
for key, value in other._variant_mapping.items():
if key not in self._variant_mapping or override:

View File

@ -552,12 +552,7 @@ class YoutubeMusic(SuperYouTube):
return self.download_values_by_url[source.url]
if ydl_res is None:
try:
ydl_res = self.ydl.extract_info(url=source.url, download=False)
except DownloadError as e:
self.not_download[source.hash_url] = e
self.LOGGER.error(f"Couldn't fetch song from {source.url}. {e}")
return {"error": e}
_best_format = _get_best_format(ydl_res.get("formats", [{}]))
self.download_values_by_url[source.url] = {
@ -572,7 +567,7 @@ class YoutubeMusic(SuperYouTube):
def download_song_to_target(self, source: Source, target: Target, desc: str = None) -> DownloadResult:
media = self.fetch_media_url(source)
if source.hash_url not in self.not_download and "error" not in media:
if source.hash_url not in self.not_download:
result = self.download_connection.stream_into(
media["url"],
target,
@ -585,7 +580,7 @@ class YoutubeMusic(SuperYouTube):
method="GET",
)
else:
result = DownloadResult(error_message=str(media.get("error") or self.not_download[source.hash_url]))
result = DownloadResult(error_message=str(self.not_download[source.hash_url]))
if result.is_fatal_error:
result.merge(super().download_song_to_target(source=source, target=target, desc=desc))