@@ -191,17 +191,12 @@ def download_track(mode: str, track_id: str, extra_keys=None, disable_progressba
191191
192192 # a song with the same name is installed
193193 if not check_id and check_name :
194+ c = len ([file for file in Path (filedir ).iterdir () if re .search (f'^{ filename } _' , str (file ))]) + 1
194195
195- if Zotify .CONFIG .get_skip_existing ():
196- Printer .print (PrintChannel .SKIPS , '\n ### SKIPPING: ' + song_name + ' (SONG ALREADY EXISTS) ###' + "\n " )
197- return
198- else :
199- c = len ([file for file in Path (filedir ).iterdir () if re .search (f'^{ filename } _' , str (file ))]) + 1
200-
201- fname = PurePath (filename ).stem
202- ext = PurePath (PurePath (filename ).name ).suffix
196+ fname = PurePath (PurePath (filename ).name ).parent
197+ ext = PurePath (PurePath (filename ).name ).suffix
203198
204- filename = PurePath (filedir ).joinpath (f'{ fname } _{ c } { ext } ' )
199+ filename = PurePath (filedir ).joinpath (f'{ fname } _{ c } { ext } ' )
205200
206201 except Exception as e :
207202 Printer .print (PrintChannel .ERRORS , '### SKIPPING SONG - FAILED TO QUERY METADATA ###' )
@@ -294,24 +289,6 @@ def download_track(mode: str, track_id: str, extra_keys=None, disable_progressba
294289 Printer .print (PrintChannel .PROGRESS_INFO , f'Download successful. Waiting { wait_time } seconds.' )
295290 time .sleep (wait_time )
296291
297- # Verifica se o nome da playlist foi fornecido
298- # Checks if playlist name is provided
299- if extra_keys and 'playlist' in extra_keys :
300- playlist_file = PurePath (Zotify .CONFIG .get_root_path ()).joinpath (extra_keys ['playlist' ] + '.m3u8' )
301-
302- # Se for o primeiro item da playlist, realiza o truncamento
303- # If it is the first item in the playlist, truncate it
304- if extra_keys ['playlist_num' ].lstrip ('0' ) == '1' :
305- with open (playlist_file , 'w' , encoding = 'utf-8' ) as f :
306- f .write ("#EXTM3U\n " )
307-
308- # Adiciona o nome do arquivo da música baixada à playlist M3U8
309- # Adds the downloaded music file name to the M3U8 playlist
310- with open (playlist_file , "a" , encoding = 'utf-8' ) as f :
311- #f.write("#EXTINF:-1," + urlencode(song_name) + "\n")
312- #f.write(f"{filename}\n")
313- f .write (f"{ filename .relative_to (PurePath (Zotify .CONFIG .get_root_path ()))} \n " )
314-
315292 except Exception as e :
316293 Printer .print (PrintChannel .ERRORS , '### SKIPPING: ' + song_name + ' (GENERAL DOWNLOAD ERROR) ###' )
317294 Printer .print (PrintChannel .ERRORS , 'Track_ID: ' + str (track_id ))
0 commit comments