Skip to content

Commit

Permalink
youtube: skips songs without duration (closes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma67 committed May 28, 2021
1 parent d3bb315 commit 7308332
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion YouTube.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_best_fit_song_id(self, results, song):
continue

durationMatch = None
if res['duration']:
if 'duration' in res and res['duration']:
durationItems = res['duration'].split(':')
duration = int(durationItems[0]) * 60 + int(durationItems[1])
durationMatch = 1 - abs(duration - song['duration']) * 2 / song['duration']
Expand Down

0 comments on commit 7308332

Please sign in to comment.