projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
PEP8 applied
[youtube-dl]
/
youtube_dl
/
downloader
/
common.py
diff --git
a/youtube_dl/downloader/common.py
b/youtube_dl/downloader/common.py
index 7c33004b17b1612942187cc80bedbe0fef985d68..c0af50c59182ad560a23264738d027d4ad3c8697 100644
(file)
--- a/
youtube_dl/downloader/common.py
+++ b/
youtube_dl/downloader/common.py
@@
-81,7
+81,7
@@
class FileDownloader(object):
if total is None:
return None
dif = now - start
if total is None:
return None
dif = now - start
- if current == 0 or dif < 0.001: # One millisecond
+ if current == 0 or dif < 0.001:
# One millisecond
return None
rate = float(current) / dif
return int((float(total) - float(current)) / rate)
return None
rate = float(current) / dif
return int((float(total) - float(current)) / rate)
@@
-95,7
+95,7
@@
class FileDownloader(object):
@staticmethod
def calc_speed(start, now, bytes):
dif = now - start
@staticmethod
def calc_speed(start, now, bytes):
dif = now - start
- if bytes == 0 or dif < 0.001: # One millisecond
+ if bytes == 0 or dif < 0.001:
# One millisecond
return None
return float(bytes) / dif
return None
return float(bytes) / dif
@@
-108,7
+108,7
@@
class FileDownloader(object):
@staticmethod
def best_block_size(elapsed_time, bytes):
new_min = max(bytes / 2.0, 1.0)
@staticmethod
def best_block_size(elapsed_time, bytes):
new_min = max(bytes / 2.0, 1.0)
- new_max = min(max(bytes * 2.0, 1.0), 4194304) # Do not surpass 4 MB
+ new_max = min(max(bytes * 2.0, 1.0), 4194304)
# Do not surpass 4 MB
if elapsed_time < 0.001:
return int(new_max)
rate = bytes / elapsed_time
if elapsed_time < 0.001:
return int(new_max)
rate = bytes / elapsed_time