Skip to content

Commit 597f5db

Browse files
authored
release v3.9.4
2 parents 5a32848 + 4a06d5a commit 597f5db

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[metadata]
2-
version = 3.9.3
2+
version = 3.9.4
33

44
name = spotdl
55
url = https://github.com/spotDL/spotify-downloader

spotdl/search/song_gatherer.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pathlib import Path
44
from typing import Dict, List
5+
import platform
56

67
from spotdl.providers import (
78
metadata_provider,
@@ -58,6 +59,16 @@ def from_spotify_url(
5859
song_name, [artist["name"] for artist in raw_track_meta["artists"]]
5960
)
6061

62+
# Ensure file name doesnt contain forbidden characters
63+
filesystem_display_name = display_name # Create copy of display_name for filesystem use
64+
if platform.system() == 'Windows':
65+
for forbidden_letter in ['<', '>', ':', '"', '/', '\\', '|', '?', '*']:
66+
converted_file_name = converted_file_name.replace(forbidden_letter, '')
67+
filesystem_display_name = filesystem_display_name.replace(forbidden_letter, '')
68+
else: # Linux or MacOS
69+
converted_file_name = converted_file_name.replace('/', '')
70+
filesystem_display_name = filesystem_display_name.replace('/', '')
71+
6172
# If song name is too long use only first artist
6273
if len(converted_file_name) > 250:
6374
converted_file_name = SongObject.create_file_name(
@@ -67,7 +78,7 @@ def from_spotify_url(
6778
converted_file_path = Path(".", f"{converted_file_name}.{output_format}")
6879

6980
# Alternate file path.
70-
alternate_file_path = Path(".", f"{display_name}.{output_format}")
81+
alternate_file_path = Path(".", f"{filesystem_display_name}.{output_format}")
7182

7283
# if a song is already downloaded skip it
7384
if converted_file_path.is_file() or alternate_file_path.is_file():

0 commit comments

Comments
 (0)