Skip to content

Commit b13f12f

Browse files
authored
Merge pull request #724 from ritiek/handle-keyboardinterrupt-on-file-downloads
Don't remove track from file on KeyboardInterrupt
2 parents 89735c2 + 19ae8fd commit b13f12f

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

CHANGES.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
The release dates mentioned follow the format `DD-MM-YYYY`.
88

99
## [Unreleased]
10+
11+
## [2.0.4] - 19-05-2020
1012
### Fixed
13+
- Do not remove the currently downloading track from file on `KeyboardInterrupt`
14+
when `--list` is passed. ([@ritiek](https://github.com/ritiek/spotify-downloader)) (#722)
1115
- Failure on invoking spotdl if FFmpeg isn't found. It should now warn about missing
12-
FFmpeg and move ahead without encoding. [@ritiek](https://github.com/ritiek)
16+
FFmpeg and move ahead without encoding. ([@ritiek](https://github.com/ritiek))
1317
(debe7ee9024e2ec65eed9935460c62f4eecd03ea)
1418

1519
## [2.0.3] (Hotfix Release) - 18-05-2020
1620
### Fixed
1721
- Genius would sometimes return invalid lyrics. Retry a few times in such a case.
18-
[@ritiek](https://github.com/ritiek) (29b1f31a2622f749df83c3072c4cbb22615bff95)
22+
([@ritiek](https://github.com/ritiek)) (29b1f31a2622f749df83c3072c4cbb22615bff95)
1923

2024
## [2.0.2] (Hotfix Release) - 18-05-2020
2125
### Fixed
22-
- Skipping tracks with `-m` would crash. [@ritiek](https://github.com/ritiek)
26+
- Skipping tracks with `-m` would crash. ([@ritiek](https://github.com/ritiek))
2327
(bbe43da191093302726ddc9a48f0fa0a55be6fb6)
2428

2529
## [2.0.1] (Hotfix Release) - 18-05-2020
2630
### Fixed
27-
- `-o m4a` would always fail. [@ritiek](https://github.com/ritiek)
31+
- `-o m4a` would always fail. ([@ritiek](https://github.com/ritiek))
2832
(cd5f224e379f3feefc95e338ec50674f976e2e89)
2933

3034
## [2.0.0] - 18-05-2020

spotdl/command_line/core.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def filter_against_skip_file(self, items, skip_file):
321321

322322
def download_tracks_from_file(self, path):
323323
logger.info(
324-
"Checking and removing any duplicate tracks in {}.".format(path)
324+
'Checking and removing any duplicate tracks in "{}".'.format(path)
325325
)
326326
tracks = spotdl.util.readlines_from_nonbinary_file(path)
327327
tracks = self.strip_and_filter_duplicates(tracks)
@@ -346,12 +346,12 @@ def download_tracks_from_file(self, path):
346346
yt_search_format=self.arguments["search_format"],
347347
yt_manual=self.arguments["manual"]
348348
)
349+
log_track_query = '{position}. Downloading "{track}"'.format(
350+
position=position,
351+
track=track
352+
)
353+
logger.info(log_track_query)
349354
try:
350-
log_track_query = '{position}. Downloading "{track}"'.format(
351-
position=position,
352-
track=track
353-
)
354-
logger.info(log_track_query)
355355
metadata = search_metadata.on_youtube_and_spotify()
356356
self.download_track_from_metadata(metadata)
357357
except (urllib.request.URLError, TypeError, IOError) as e:
@@ -363,6 +363,11 @@ def download_tracks_from_file(self, path):
363363
tracks.append(track)
364364
except (NoYouTubeVideoFoundError, NoYouTubeVideoMatchError) as e:
365365
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
366371
else:
367372
if self.arguments["write_successful_file"]:
368373
with open(self.arguments["write_successful_file"], "a") as fout:

spotdl/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = "2.0.3"
1+
__version__ = "2.0.4"
22

0 commit comments

Comments
 (0)