@@ -321,7 +321,7 @@ def filter_against_skip_file(self, items, skip_file):
321
321
322
322
def download_tracks_from_file (self , path ):
323
323
logger .info (
324
- " Checking and removing any duplicate tracks in {}." .format (path )
324
+ ' Checking and removing any duplicate tracks in "{}".' .format (path )
325
325
)
326
326
tracks = spotdl .util .readlines_from_nonbinary_file (path )
327
327
tracks = self .strip_and_filter_duplicates (tracks )
@@ -346,12 +346,12 @@ def download_tracks_from_file(self, path):
346
346
yt_search_format = self .arguments ["search_format" ],
347
347
yt_manual = self .arguments ["manual" ]
348
348
)
349
+ log_track_query = '{position}. Downloading "{track}"' .format (
350
+ position = position ,
351
+ track = track
352
+ )
353
+ logger .info (log_track_query )
349
354
try :
350
- log_track_query = '{position}. Downloading "{track}"' .format (
351
- position = position ,
352
- track = track
353
- )
354
- logger .info (log_track_query )
355
355
metadata = search_metadata .on_youtube_and_spotify ()
356
356
self .download_track_from_metadata (metadata )
357
357
except (urllib .request .URLError , TypeError , IOError ) as e :
@@ -363,6 +363,11 @@ def download_tracks_from_file(self, path):
363
363
tracks .append (track )
364
364
except (NoYouTubeVideoFoundError , NoYouTubeVideoMatchError ) as e :
365
365
logger .error ("{err}" .format (err = e .args [0 ]))
366
+ except KeyboardInterrupt :
367
+ # The current track hasn't been downloaded completely.
368
+ # Make sure we continue from here the next the program runs.
369
+ tracks .insert (0 , track )
370
+ raise
366
371
else :
367
372
if self .arguments ["write_successful_file" ]:
368
373
with open (self .arguments ["write_successful_file" ], "a" ) as fout :
0 commit comments