Skip to content

Commit

Permalink
Added error catching for skipped songs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpes707 committed Nov 11, 2020
1 parent f4346b7 commit d284374
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions itunes_dl.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,11 @@ def main(album_url=None):

track_filenames = ['{} {}.mp3'.format(str(idx+1).zfill(2), track.replace(':', '').replace('?', '').replace('!', '').replace('"', '')) for idx, track in enumerate(album_tracks)]
for track_filename in track_filenames:
print('{} is complete!'.format(track_filename))
os.replace(os.path.join(downloads_path, track_filename), os.path.join(itunes_add_path, track_filename))
try:
os.replace(os.path.join(downloads_path, track_filename), os.path.join(itunes_add_path, track_filename))
print('{} is complete!'.format(track_filename))
except:
print('{} was NOT downloaded.'.format(track_filename))
# sleep(5)
# album_folder_path = os.path.join(itunes_path, 'iTunes Media', 'Music', album_artist, album_name)
# for track_filename in track_filenames:
Expand Down

0 comments on commit d284374

Please sign in to comment.