mirror of
				https://github.com/KevinMidboe/spotify-downloader.git
				synced 2025-10-29 18:00:15 +00:00 
			
		
		
		
	Merge pull request #724 from ritiek/handle-keyboardinterrupt-on-file-downloads
Don't remove track from file on KeyboardInterrupt
This commit is contained in:
		
							
								
								
									
										12
									
								
								CHANGES.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								CHANGES.md
									
									
									
									
									
								
							| @@ -7,24 +7,28 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |||||||
| The release dates mentioned follow the format `DD-MM-YYYY`. | The release dates mentioned follow the format `DD-MM-YYYY`. | ||||||
|  |  | ||||||
| ## [Unreleased] | ## [Unreleased] | ||||||
|  |  | ||||||
|  | ## [2.0.4] - 19-05-2020 | ||||||
| ### Fixed | ### Fixed | ||||||
|  | - Do not remove the currently downloading track from file on `KeyboardInterrupt` | ||||||
|  |   when `--list` is passed. ([@ritiek](https://github.com/ritiek/spotify-downloader)) (#722) | ||||||
| - Failure on invoking spotdl if FFmpeg isn't found. It should now warn about missing | - Failure on invoking spotdl if FFmpeg isn't found. It should now warn about missing | ||||||
|   FFmpeg and move ahead without encoding. [@ritiek](https://github.com/ritiek) |   FFmpeg and move ahead without encoding. ([@ritiek](https://github.com/ritiek)) | ||||||
|   (debe7ee9024e2ec65eed9935460c62f4eecd03ea) |   (debe7ee9024e2ec65eed9935460c62f4eecd03ea) | ||||||
|  |  | ||||||
| ## [2.0.3] (Hotfix Release) - 18-05-2020 | ## [2.0.3] (Hotfix Release) - 18-05-2020 | ||||||
| ### Fixed | ### Fixed | ||||||
| - Genius would sometimes return invalid lyrics. Retry a few times in such a case. | - Genius would sometimes return invalid lyrics. Retry a few times in such a case. | ||||||
|   [@ritiek](https://github.com/ritiek) (29b1f31a2622f749df83c3072c4cbb22615bff95) |   ([@ritiek](https://github.com/ritiek)) (29b1f31a2622f749df83c3072c4cbb22615bff95) | ||||||
|  |  | ||||||
| ## [2.0.2] (Hotfix Release) - 18-05-2020 | ## [2.0.2] (Hotfix Release) - 18-05-2020 | ||||||
| ### Fixed | ### Fixed | ||||||
| - Skipping tracks with `-m` would crash. [@ritiek](https://github.com/ritiek) | - Skipping tracks with `-m` would crash. ([@ritiek](https://github.com/ritiek)) | ||||||
|   (bbe43da191093302726ddc9a48f0fa0a55be6fb6) |   (bbe43da191093302726ddc9a48f0fa0a55be6fb6) | ||||||
|  |  | ||||||
| ## [2.0.1] (Hotfix Release) - 18-05-2020 | ## [2.0.1] (Hotfix Release) - 18-05-2020 | ||||||
| ### Fixed | ### Fixed | ||||||
| - `-o m4a` would always fail. [@ritiek](https://github.com/ritiek) | - `-o m4a` would always fail. ([@ritiek](https://github.com/ritiek)) | ||||||
|   (cd5f224e379f3feefc95e338ec50674f976e2e89) |   (cd5f224e379f3feefc95e338ec50674f976e2e89) | ||||||
|  |  | ||||||
| ## [2.0.0] - 18-05-2020 | ## [2.0.0] - 18-05-2020 | ||||||
|   | |||||||
| @@ -321,7 +321,7 @@ class Spotdl: | |||||||
|  |  | ||||||
|     def download_tracks_from_file(self, path): |     def download_tracks_from_file(self, path): | ||||||
|         logger.info( |         logger.info( | ||||||
|             "Checking and removing any duplicate tracks in {}.".format(path) |             'Checking and removing any duplicate tracks in "{}".'.format(path) | ||||||
|         ) |         ) | ||||||
|         tracks = spotdl.util.readlines_from_nonbinary_file(path) |         tracks = spotdl.util.readlines_from_nonbinary_file(path) | ||||||
|         tracks = self.strip_and_filter_duplicates(tracks) |         tracks = self.strip_and_filter_duplicates(tracks) | ||||||
| @@ -346,12 +346,12 @@ class Spotdl: | |||||||
|                 yt_search_format=self.arguments["search_format"], |                 yt_search_format=self.arguments["search_format"], | ||||||
|                 yt_manual=self.arguments["manual"] |                 yt_manual=self.arguments["manual"] | ||||||
|             ) |             ) | ||||||
|             try: |  | ||||||
|             log_track_query = '{position}. Downloading "{track}"'.format( |             log_track_query = '{position}. Downloading "{track}"'.format( | ||||||
|                 position=position, |                 position=position, | ||||||
|                 track=track |                 track=track | ||||||
|             ) |             ) | ||||||
|             logger.info(log_track_query) |             logger.info(log_track_query) | ||||||
|  |             try: | ||||||
|                 metadata = search_metadata.on_youtube_and_spotify() |                 metadata = search_metadata.on_youtube_and_spotify() | ||||||
|                 self.download_track_from_metadata(metadata) |                 self.download_track_from_metadata(metadata) | ||||||
|             except (urllib.request.URLError, TypeError, IOError) as e: |             except (urllib.request.URLError, TypeError, IOError) as e: | ||||||
| @@ -363,6 +363,11 @@ class Spotdl: | |||||||
|                 tracks.append(track) |                 tracks.append(track) | ||||||
|             except (NoYouTubeVideoFoundError, NoYouTubeVideoMatchError) as e: |             except (NoYouTubeVideoFoundError, NoYouTubeVideoMatchError) as e: | ||||||
|                 logger.error("{err}".format(err=e.args[0])) |                 logger.error("{err}".format(err=e.args[0])) | ||||||
|  |             except KeyboardInterrupt: | ||||||
|  |                 # The current track hasn't been downloaded completely. | ||||||
|  |                 # Make sure we continue from here the next the program runs. | ||||||
|  |                 tracks.insert(0, track) | ||||||
|  |                 raise | ||||||
|             else: |             else: | ||||||
|                 if self.arguments["write_successful_file"]: |                 if self.arguments["write_successful_file"]: | ||||||
|                     with open(self.arguments["write_successful_file"], "a") as fout: |                     with open(self.arguments["write_successful_file"], "a") as fout: | ||||||
|   | |||||||
| @@ -1,2 +1,2 @@ | |||||||
| __version__ = "2.0.3" | __version__ = "2.0.4" | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user