Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ETA misreported when time exceeds 0:59:59 #1397

Closed
jwaved opened this issue Sep 9, 2013 · 2 comments
Closed

bug: ETA misreported when time exceeds 0:59:59 #1397

jwaved opened this issue Sep 9, 2013 · 2 comments
Labels
bug

Comments

@jwaved
Copy link

@jwaved jwaved commented Sep 9, 2013

ETA misreported when time exceeds 0:59:59

current code reports ETA like:

[download]  14.1% of 674.2MiB at 59.80KiB/s ETA 02:165:11

(please note ETA reads as 2hr, 165min, 11sec)

...in FileDownloader.py...

  • I suspect that line 75 should use "eta_mins" (from line 69)

    ...instead of "mins" (from line 68)
66    @staticmethod
67    def format_seconds(seconds):
68        (mins, secs) = divmod(seconds, 60)
69        (hours, eta_mins) = divmod(mins, 60)
70        if hours > 99:
71            return '--:--:--'
72        if hours == 0:
73            return '%02d:%02d' % (mins, secs)
74        else:
75            return '%02d:%02d:%02d' % (hours, mins, secs)

...and as a matter of coding style (no offense intended)... I probably would have written the code's variables (in lines 68 & 69) as:

66    @staticmethod
67    def format_seconds(seconds):
68        (calc_mins, secs) = divmod(seconds, 60)
69        (hours, mins) = divmod(calc_mins, 60)
70        if hours > 99:
71            return '--:--:--'
72        if hours == 0:
73            return '%02d:%02d' % (mins, secs)
74        else:
75            return '%02d:%02d:%02d' % (hours, mins, secs)

...that way, lines 73 & 75 can remain pure and elegant with mins being consistent in the return (as I suspect you intended).


### Obligatory version info:
exact command line
youtube-dl "ytsearch:casiokeyboards privia pro px-5s clinic"
youtube-dl "ytsearch:allen toussaint documentary"
youtube-dl --version
2013.09.07
(but I noticed this a week or two ago, i.e. previous versions)
I habitually update youtube-dl any time I use it, because you are so vigilant about keeping it up-to-date. All it takes is "#sudo youtube-dl -U" and I'm good to go. (thanks, BTW)
python --version
Python 2.7.2 on Debian & Mac
Python 2.6.5 on Ubuntu
operating system (bug occurs on ALL these platforms)
Debian: wheezy/sid kernel 3.2.0-2-486 on i686
Ubuntu: 10.04 LTS (Lucid Lynx) kernel 2.6.32-41-generic on i686
MacOS X: 10.8.4 (Mountain Lion) kernel 12.4.0 Darwin

### THANK YOU FOR ALL YOUR HARD WORK ON THIS NEVER ENDING PROJECT!!!

Sincerely,
jwaved

@jaimeMF jaimeMF closed this in 061b288 Sep 9, 2013
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Sep 9, 2013

Thanks for the report!, it's fixed in the repo.
And thanks for doing all the work for us.

@jwaved
Copy link
Author

@jwaved jwaved commented Sep 9, 2013

Thank you!
You guys are great!
(glad I could help, in even a small way)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.