if bytes == 0.0:
exponent = 0
else:
- exponent = long(math.log(bytes, 1024.0))
+ exponent = int(math.log(bytes, 1024.0))
suffix = 'bkMGTPEZY'[exponent]
converted = float(bytes) / float(1024 ** exponent)
return '%.2f%s' % (converted, suffix)
if current == 0 or dif < 0.001: # One millisecond
return '--:--'
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)
if eta_mins > 99:
return '--:--'
else:
# Examine the reported length
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.
# 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,
data_len = data.info().get('Content-length', 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)
byte_counter = 0 + resume_len
block_size = self.params.get('buffersize', 1024)
stream.close()
self.report_finish()
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)
# Update file modification time
opts.ratelimit = numeric_limit
if opts.retries is not None:
try:
- opts.retries = long(opts.retries)
+ opts.retries = int(opts.retries)
except (TypeError, ValueError), err:
parser.error(u'invalid retry count specified')
if opts.buffersize is not None: