Return codes depicting success/failure (#164)

* Add error codes for fetch playlist failures

* Add return codes to README.md
This commit is contained in:
Ritiek Malhotra
2017-11-30 10:44:46 +05:30
committed by GitHub
parent d39272d6a2
commit 6075a829e5
2 changed files with 15 additions and 1 deletions

View File

@@ -337,13 +337,19 @@ def grab_playlist(playlist):
else:
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]
try:
write_playlist(username, playlist_id)
except spotipy.client.SpotifyException:
print('Unable to find playlist')
print('Make sure the playlist is set to publicly visible and then try again')
sys.exit(11)
def grab_album(album):