mirror of
https://github.com/KevinMidboe/spotify-downloader.git
synced 2025-10-29 18:00:15 +00:00
Return codes depicting success/failure (#164)
* Add error codes for fetch playlist failures * Add return codes to README.md
This commit is contained in:
@@ -204,6 +204,14 @@ Beside some other characters, spaces will be replaced by underscores. There's no
|
|||||||
|
|
||||||
Just make sure your working directory is the one you have the music files in.
|
Just make sure your working directory is the one you have the music files in.
|
||||||
|
|
||||||
|
## Return codes
|
||||||
|
|
||||||
|
- `0` - Success
|
||||||
|
- `1` - Unknown error
|
||||||
|
- `2` - Command line error (e.g. invalid args)
|
||||||
|
- `10` - Invalid playlist URL
|
||||||
|
- `11` - Playlist not found
|
||||||
|
|
||||||
## Running tests
|
## Running tests
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -337,13 +337,19 @@ def grab_playlist(playlist):
|
|||||||
else:
|
else:
|
||||||
splits = playlist.split(':')
|
splits = playlist.split(':')
|
||||||
|
|
||||||
username = splits[-3]
|
try:
|
||||||
|
username = splits[-3]
|
||||||
|
except IndexError:
|
||||||
|
# Wrong format, in either case
|
||||||
|
print('The provided playlist URL is not in a recognized format!')
|
||||||
|
sys.exit(10)
|
||||||
playlist_id = splits[-1]
|
playlist_id = splits[-1]
|
||||||
try:
|
try:
|
||||||
write_playlist(username, playlist_id)
|
write_playlist(username, playlist_id)
|
||||||
except spotipy.client.SpotifyException:
|
except spotipy.client.SpotifyException:
|
||||||
print('Unable to find playlist')
|
print('Unable to find playlist')
|
||||||
print('Make sure the playlist is set to publicly visible and then try again')
|
print('Make sure the playlist is set to publicly visible and then try again')
|
||||||
|
sys.exit(11)
|
||||||
|
|
||||||
|
|
||||||
def grab_album(album):
|
def grab_album(album):
|
||||||
|
|||||||
Reference in New Issue
Block a user