Skip to content

Commit

Permalink
update cassettes
Browse files Browse the repository at this point in the history
test

test
  • Loading branch information
xnetcat committed Apr 14, 2022
1 parent 3181eed commit 859aaee
Show file tree
Hide file tree
Showing 11 changed files with 42,275 additions and 43,896 deletions.
1 change: 1 addition & 0 deletions spotdl/download/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ async def download_song(self, song_object: SongObject) -> None:
f'by "{song_object.contributing_artists[0]}" '
f'from video "{song_object.youtube_link}"'
)

return None

if downloaded_file_path_string is None:
Expand Down
17 changes: 11 additions & 6 deletions spotdl/providers/yt_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def _order_yt_results(
if _match_percentage(
str(unidecode(artist.lower())), str(unidecode(result.title).lower()), 85
) or _match_percentage(
str(unidecode(artist.lower())), str(unidecode(result.author).lower()), 85
str(unidecode(artist.lower())),
str(unidecode(result.author).lower()),
85,
):
artist_match_number += 1

Expand All @@ -133,13 +135,16 @@ def _order_yt_results(
max(
# case where artist is included in title
_match_percentage(
str(unidecode(song_title.lower())), str(unidecode(result.title.lower())), 60
str(unidecode(song_title.lower())),
str(unidecode(result.title.lower())),
60,
),

# case where artist is author and video title is only the track name
_match_percentage(
str(unidecode(song_name.lower())), str(unidecode(result.title.lower())), 60
)
str(unidecode(song_name.lower())),
str(unidecode(result.title.lower())),
60,
),
),
ndigits=3,
)
Expand All @@ -156,7 +161,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
18 changes: 11 additions & 7 deletions spotdl/search/song_gatherer.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ def from_spotify_url(
)

# Ensure file name doesnt contain forbidden characters
filesystem_display_name = display_name # Create copy of display_name for filesystem use
if platform.system() == 'Windows':
for forbidden_letter in ['<', '>', ':', '"', '/', '\\', '|', '?', '*']:
converted_file_name = converted_file_name.replace(forbidden_letter, '')
filesystem_display_name = filesystem_display_name.replace(forbidden_letter, '')
filesystem_display_name = (
display_name # Create copy of display_name for filesystem use
)
if platform.system() == "Windows":
for forbidden_letter in ["<", ">", ":", '"', "/", "\\", "|", "?", "*"]:
converted_file_name = converted_file_name.replace(forbidden_letter, "")
filesystem_display_name = filesystem_display_name.replace(
forbidden_letter, ""
)
else: # Linux or MacOS
converted_file_name = converted_file_name.replace('/', '')
filesystem_display_name = filesystem_display_name.replace('/', '')
converted_file_name = converted_file_name.replace("/", "")
filesystem_display_name = filesystem_display_name.replace("/", "")

# If song name is too long use only first artist
if len(converted_file_name) > 250:
Expand Down
5 changes: 4 additions & 1 deletion spotdl/search/spotify_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ def init(cls, client_id: str, client_secret: str, user_auth: bool) -> "Singleton
)

# Create instance
cls._instance = super().__call__(auth_manager=credential_manager, status_forcelist=(429, 500, 502, 503, 504, 404))
cls._instance = super().__call__(
auth_manager=credential_manager,
status_forcelist=(429, 500, 502, 503, 504, 404),
)

# Return instance
return cls._instance
Expand Down
34,428 changes: 17,219 additions & 17,209 deletions tests/cassettes/test_download_a_playlist.yaml

Large diffs are not rendered by default.

2,282 changes: 1,214 additions & 1,068 deletions tests/cassettes/test_download_a_single_song.yaml

Large diffs are not rendered by default.

38,115 changes: 18,406 additions & 19,709 deletions tests/cassettes/test_download_an_album.yaml

Large diffs are not rendered by default.

3,336 changes: 1,542 additions & 1,794 deletions tests/cassettes/test_download_long_artists_song.yaml

Large diffs are not rendered by default.

3,353 changes: 1,579 additions & 1,774 deletions tests/cassettes/test_download_single_song.yaml

Large diffs are not rendered by default.

4,610 changes: 2,285 additions & 2,325 deletions tests/cassettes/test_multiple_elements.yaml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/cassettes/test_search_and_download.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ interactions:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
- gzip, deflate, br
Authorization:
- Bearer BQB1gZrZ0TxRf2frYIlKOntPTFTpnQvwhQztgs6Uw4FtLliR73iLHY6Huqq_JMuOkpdWOlyuNgp9b1ELhoU
- Bearer BQBsPxGhEDptm5mNPjcO7_XSAY_Z9G8_dYmSSWS-mtvVRsHLZNsPYchwvV5dyANKPJ8HrZJPv51XFNSfmmc
Connection:
- keep-alive
Content-Type:
Expand Down Expand Up @@ -48,7 +48,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Tue, 08 Feb 2022 12:22:44 GMT
- Thu, 14 Apr 2022 14:13:31 GMT
server:
- envoy
strict-transport-security:
Expand Down

0 comments on commit 859aaee

Please sign in to comment.