Skip to content

Commit

Permalink
handle string _percent_str value 'Unknown' in youtube-dl callback
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Aug 6, 2017
1 parent d46f08f commit f0a797e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ def download_progress_hook(progress):
return
elif status == 'downloading':
p = lambda field: progress.get(field) or ''
percent = float(p('_percent_str').strip('%') or '0')
try:
percent = float(p('_percent_str').strip('%') or '0')
except ValueError:
percent = 0
msg = ('<span><progress max="100" value="%s"></progress><br /> '
'%s of %s at %s in %s...</span>\n' % (
percent, p('_downloaded_bytes_str'),
Expand Down

0 comments on commit f0a797e

Please sign in to comment.