mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-26 23:00:22 +00:00
Replace long with int (see PEP 237)
This commit is contained in:
parent
3aeb78ea4e
commit
95649b3936
@ -108,7 +108,7 @@ class FileDownloader(object):
|
|||||||
if bytes == 0.0:
|
if bytes == 0.0:
|
||||||
exponent = 0
|
exponent = 0
|
||||||
else:
|
else:
|
||||||
exponent = long(math.log(bytes, 1024.0))
|
exponent = int(math.log(bytes, 1024.0))
|
||||||
suffix = 'bkMGTPEZY'[exponent]
|
suffix = 'bkMGTPEZY'[exponent]
|
||||||
converted = float(bytes) / float(1024 ** exponent)
|
converted = float(bytes) / float(1024 ** exponent)
|
||||||
return '%.2f%s' % (converted, suffix)
|
return '%.2f%s' % (converted, suffix)
|
||||||
@ -127,7 +127,7 @@ class FileDownloader(object):
|
|||||||
if current == 0 or dif < 0.001: # One millisecond
|
if current == 0 or dif < 0.001: # One millisecond
|
||||||
return '--:--'
|
return '--:--'
|
||||||
rate = float(current) / dif
|
rate = float(current) / dif
|
||||||
eta = long((float(total) - float(current)) / rate)
|
eta = int((float(total) - float(current)) / rate)
|
||||||
(eta_mins, eta_secs) = divmod(eta, 60)
|
(eta_mins, eta_secs) = divmod(eta, 60)
|
||||||
if eta_mins > 99:
|
if eta_mins > 99:
|
||||||
return '--:--'
|
return '--:--'
|
||||||
@ -617,7 +617,7 @@ class FileDownloader(object):
|
|||||||
else:
|
else:
|
||||||
# Examine the reported length
|
# Examine the reported length
|
||||||
if (content_length is not None and
|
if (content_length is not None and
|
||||||
(resume_len - 100 < long(content_length) < resume_len + 100)):
|
(resume_len - 100 < int(content_length) < resume_len + 100)):
|
||||||
# The file had already been fully downloaded.
|
# The file had already been fully downloaded.
|
||||||
# Explanation to the above condition: in issue #175 it was revealed that
|
# Explanation to the above condition: in issue #175 it was revealed that
|
||||||
# YouTube sometimes adds or removes a few bytes from the end of the file,
|
# YouTube sometimes adds or removes a few bytes from the end of the file,
|
||||||
@ -644,7 +644,7 @@ class FileDownloader(object):
|
|||||||
|
|
||||||
data_len = data.info().get('Content-length', None)
|
data_len = data.info().get('Content-length', None)
|
||||||
if data_len is not None:
|
if data_len is not None:
|
||||||
data_len = long(data_len) + resume_len
|
data_len = int(data_len) + resume_len
|
||||||
data_len_str = self.format_bytes(data_len)
|
data_len_str = self.format_bytes(data_len)
|
||||||
byte_counter = 0 + resume_len
|
byte_counter = 0 + resume_len
|
||||||
block_size = self.params.get('buffersize', 1024)
|
block_size = self.params.get('buffersize', 1024)
|
||||||
@ -694,7 +694,7 @@ class FileDownloader(object):
|
|||||||
stream.close()
|
stream.close()
|
||||||
self.report_finish()
|
self.report_finish()
|
||||||
if data_len is not None and byte_counter != data_len:
|
if data_len is not None and byte_counter != data_len:
|
||||||
raise ContentTooShortError(byte_counter, long(data_len))
|
raise ContentTooShortError(byte_counter, int(data_len))
|
||||||
self.try_rename(tmpfilename, filename)
|
self.try_rename(tmpfilename, filename)
|
||||||
|
|
||||||
# Update file modification time
|
# Update file modification time
|
||||||
|
@ -1456,7 +1456,7 @@ class YoutubeSearchIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
n = long(prefix)
|
n = int(prefix)
|
||||||
if n <= 0:
|
if n <= 0:
|
||||||
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
||||||
return
|
return
|
||||||
@ -1534,7 +1534,7 @@ class GoogleSearchIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
n = long(prefix)
|
n = int(prefix)
|
||||||
if n <= 0:
|
if n <= 0:
|
||||||
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
||||||
return
|
return
|
||||||
@ -1616,7 +1616,7 @@ class YahooSearchIE(InfoExtractor):
|
|||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
n = long(prefix)
|
n = int(prefix)
|
||||||
if n <= 0:
|
if n <= 0:
|
||||||
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
self._downloader.trouble(u'ERROR: invalid download number %s for query "%s"' % (n, query))
|
||||||
return
|
return
|
||||||
|
@ -449,7 +449,7 @@ def _real_main():
|
|||||||
opts.ratelimit = numeric_limit
|
opts.ratelimit = numeric_limit
|
||||||
if opts.retries is not None:
|
if opts.retries is not None:
|
||||||
try:
|
try:
|
||||||
opts.retries = long(opts.retries)
|
opts.retries = int(opts.retries)
|
||||||
except (TypeError, ValueError), err:
|
except (TypeError, ValueError), err:
|
||||||
parser.error(u'invalid retry count specified')
|
parser.error(u'invalid retry count specified')
|
||||||
if opts.buffersize is not None:
|
if opts.buffersize is not None:
|
||||||
|
Loading…
Reference in New Issue
Block a user