Replace / and \ in filenames
This commit is contained in:
parent
065f1efc6f
commit
a6e17d1fa7
1 changed files with 8 additions and 2 deletions
|
@ -161,7 +161,11 @@ class Qobuz:
|
|||
print(f"Downloading album: {artist} - {album_title}")
|
||||
for nr, track in enumerate(tracks):
|
||||
print(f"Downloading track #{nr + 1:02d} {track.title}...")
|
||||
filename = f"{artist} - {album_title} - {nr + 1:02d} {track.title}.flac"
|
||||
filename = (
|
||||
f"{artist} - {album_title} - {nr + 1:02d} {track.title}.flac".replace(
|
||||
"/", "-"
|
||||
).replace("\\", "-")
|
||||
)
|
||||
self.download_track(track, filename, dest)
|
||||
|
||||
def search_album(self, query: str) -> Album:
|
||||
|
@ -175,7 +179,9 @@ class Qobuz:
|
|||
|
||||
def search_and_download(self, query: str) -> None:
|
||||
album = self.search_album(query)
|
||||
self.download_album(album, f"{album.artist} - {album.title}")
|
||||
safe_title = album.title.replace("/", "-").replace("\\", "-")
|
||||
safe_artist = album.artist.replace("/", "-").replace("\\", "-")
|
||||
self.download_album(album, f"{safe_artist} - {safe_title}")
|
||||
|
||||
|
||||
def get_config() -> ConfigParser:
|
||||
|
|
Loading…
Add table
Reference in a new issue