Message on unavailable local tracks

This commit is contained in:
Ritiek
2017-06-18 02:16:25 +05:30
parent 9236affd0e
commit c270aa8365
2 changed files with 13 additions and 12 deletions

View File

@@ -64,6 +64,17 @@ def is_spotify(raw_song):
else:
return False
# write tracks into list file
def feed_tracks(file, tracks):
with open(file, 'a') as fout:
for item in tracks['items']:
track = item['track']
try:
fout.write(track['external_urls']['spotify'] + '\n')
except KeyError:
title = track['name'] + ' by '+ track['artists'][0]['name']
print('Skipping track ' + title + ' (local only?)')
# generate filename of the song to be downloaded
def generate_filename(title):
raw_title = title.replace(' ', '_')