Skip to content

Commit

Permalink
Release v3.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xnetcat authored Feb 8, 2022
2 parents 6d4ae78 + e4bcb14 commit 110cd35
Show file tree
Hide file tree
Showing 14 changed files with 40,556 additions and 40,473 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[metadata]
version = 3.9.2
version = 3.9.3

name = spotdl
url = https://github.com/spotDL/spotify-downloader
Expand Down
1 change: 1 addition & 0 deletions spotdl/download/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ async def download_song(self, song_object: SongObject) -> None:
"outtmpl": f"{temp_folder}/%(id)s.%(ext)s",
"quiet": True,
"no_warnings": True,
"encoding": "UTF-8",
"logger": YTDLLogger(),
"progress_hooks": [display_progress_tracker.ytdl_progress_hook]
if display_progress_tracker
Expand Down
2 changes: 1 addition & 1 deletion spotdl/download/embed_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _embed_mp3_lyrics(audio_file, song_object):
if not lyrics:
return audio_file

USLTOutput = USLT(encoding=3, lang=u"eng", desc=u"desc", text=lyrics)
USLTOutput = USLT(encoding=3, lang="eng", desc="desc", text=lyrics)
audio_file["USLT::'eng'"] = USLTOutput

return audio_file
Expand Down
8 changes: 2 additions & 6 deletions spotdl/download/ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,8 @@ async def convert(
"mp3": ["-q:a", "0"],
"flac": [],
"ogg": ["-q:a", "5"],
"opus": []
if downloaded_file_path.endswith(".webm")
else ["-b:a", "160K"],
"m4a": []
if downloaded_file_path.endswith(".m4a")
else ["-b:a", "160K"],
"opus": [] if downloaded_file_path.endswith(".webm") else ["-b:a", "160K"],
"m4a": [] if downloaded_file_path.endswith(".m4a") else ["-b:a", "160K"],
"wav": [],
}

Expand Down
2 changes: 1 addition & 1 deletion spotdl/providers/yt_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def _order_yt_results(
# ! seconds, we need to amplify the delta if it is to have any meaningful impact
# ! wen we calculate the avg match value
delta = result.length - song_duration # ! check this
non_match_value = (delta ** 2) / song_duration * 100
non_match_value = (delta**2) / song_duration * 100

time_match = 100 - non_match_value

Expand Down
4 changes: 2 additions & 2 deletions spotdl/providers/ytm_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def search_and_get_best_match(
name_match = isrc_result["name"].lower() == song_name.lower()

delta = isrc_result["length"] - song_duration
non_match_value = (delta ** 2) / song_duration * 100
non_match_value = (delta**2) / song_duration * 100

time_match = 100 - non_match_value

Expand Down Expand Up @@ -228,7 +228,7 @@ def _order_ytm_results(
# ! seconds, we need to amplify the delta if it is to have any meaningful impact
# ! wen we calculate the avg match value
delta = result["length"] - song_duration
non_match_value = (delta ** 2) / song_duration * 100
non_match_value = (delta**2) / song_duration * 100

time_match = 100 - non_match_value

Expand Down
17 changes: 13 additions & 4 deletions spotdl/search/song_gatherer.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ def from_spotify_url(

converted_file_path = Path(".", f"{converted_file_name}.{output_format}")

# Alternate file path.
alternate_file_path = Path(".", f"{display_name}.{output_format}")

# if a song is already downloaded skip it
if converted_file_path.is_file():
if converted_file_path.is_file() or alternate_file_path.is_file():
print(f'Skipping "{converted_file_name}" as it\'s already downloaded')
raise OSError(f"{converted_file_name} already downloaded")

Expand All @@ -85,7 +88,9 @@ def from_spotify_url(

# Check if we found youtube url
if youtube_link is None:
print("Could not match any of the results on YouTube. Skipping")
print(
f'Could not match any of the results on YouTube for "{display_name}". Skipping'
)
raise LookupError("Could not match any of the results on YouTube for")
else:
print(" " * (len(display_name) + 25), end="\r")
Expand Down Expand Up @@ -206,7 +211,9 @@ def get_tracks(track):
if generate_m3u:
song_obj = SongObject(track, album_response, {}, None, "", None)
if path_template:
file_path = _parse_path_template(path_template, song_obj, output_format)
file_path = _parse_path_template(
path_template, song_obj, output_format
)
else:
file_path = _get_converted_file_path(song_obj, output_format)

Expand Down Expand Up @@ -324,7 +331,9 @@ def get_song(track):
track["track"], {}, {}, None, "", playlist_response
)
if path_template:
file_path = _parse_path_template(path_template, song_obj, output_format)
file_path = _parse_path_template(
path_template, song_obj, output_format
)
else:
file_path = _get_converted_file_path(song_obj, output_format)

Expand Down
Loading

0 comments on commit 110cd35

Please sign in to comment.