Always use safe filenames for downloads

This commit is contained in:
Manuel Cortez 2020-07-19 10:41:23 -05:00
parent 884bcfadca
commit 4c2d696ee6
2 changed files with 8 additions and 2 deletions

View File

@ -2,12 +2,14 @@
## Version 0.7 ## Version 0.7
* Application improvements:
* MusicDL no longer adds invalid characters when attempting to download a file.
* Tidal: * Tidal:
* Added a new search mode for the service to retrieve the top rated tracks of a provided artist. The sintax is top://artist. * Added a new search mode for the service to retrieve the top rated tracks of a provided artist. The sintax is top://artist.
* In the settings dialog, you can control wether Albums, compilations and singles will be added when searching by artist (by using artist://...). * In the settings dialog, you can control wether Albums, compilations and singles will be added when searching by artist (by using artist://...).
* When searching by artists, results that belong to an album will be numbered. * When searching by artists, results that belong to an album will be numbered.
* Downloads will be tagged with title, album, artist and track number provided by tidal. * Downloads will be tagged with title, album, artist and track number provided by tidal.
* It is possible to download an original version in high and low quality. Before, those versions were encoded to mp3 from an m4a file. Now the M4a file can be retrieved by ticking the checkbox in the tidal settings page. * It is possible to download an original version in high and low quality. Before, those versions were encoded to mp3 from an m4a file. Now the M4a file can be retrieved by using the checkbox in the tidal settings page.
* YouTube: * YouTube:
* Fixed search algorithm for Youtube videos. * Fixed search algorithm for Youtube videos.
* Updated Youtube-Dl to version 2020.6.16.1 * Updated Youtube-Dl to version 2020.6.16.1

View File

@ -103,3 +103,7 @@ def apply_metadata(local_filename, metadata):
audio["\xa9alb"] = metadata["album"] audio["\xa9alb"] = metadata["album"]
audio["\xa9ART"] = metadata["artist"] audio["\xa9ART"] = metadata["artist"]
audio.save() audio.save()
def safe_filename(filename):
allowed_symbols = ["_", ".", ",", "-", "(", ")"]
return "".join([c for c in filename if c.isalpha() or c.isdigit() or c==' ' or c in allowed_symbols]).rstrip()