@@ -187,6 +187,13 @@ def getChoice(SONG_INFO, type):
187187 return choice - 1 if (choice != - 1 and choice != - 2 ) else choice
188188
189189
190+ def get_song_name_to_save (name : str , format : str ) -> str :
191+ """
192+ Get the song name to save the song with.
193+ """
194+ return f"{ __replace_special_characters (name )} .{ format } "
195+
196+
190197def set_MP3_data (song , song_path ):
191198 """
192199 Set the meta data if the passed data is mp3.
@@ -228,8 +235,7 @@ def set_MP3_data(song, song_path):
228235
229236 data .save ()
230237
231- defaults .DEFAULT .SONG_NAME_TO_SAVE = __replace_special_characters (
232- song .track_name ) + '.mp3'
238+ defaults .DEFAULT .SONG_NAME_TO_SAVE = get_song_name_to_save (song .track_name , "mp3" )
233239
234240 # Rename the downloaded file
235241 to_save_as = os .path .join (
@@ -296,7 +302,7 @@ def set_M4A_data(song, song_path):
296302
297303 audio .save ()
298304
299- defaults .DEFAULT .SONG_NAME_TO_SAVE = song .track_name + '. m4a'
305+ defaults .DEFAULT .SONG_NAME_TO_SAVE = get_song_name_to_save ( song .track_name , " m4a" )
300306
301307 # Rename the downloaded file
302308 os .rename (SONG_PATH , os .path .join (
@@ -361,7 +367,7 @@ def set_OPUS_data(song, song_path):
361367
362368 mutagen_file .save ()
363369
364- defaults .DEFAULT .SONG_NAME_TO_SAVE = song .track_name + '. opus'
370+ defaults .DEFAULT .SONG_NAME_TO_SAVE = get_song_name_to_save ( song .track_name , " opus" )
365371
366372 # Rename the downloaded file
367373 os .rename (SONG_PATH , os .path .join (
0 commit comments