1
0
mirror of https://codeberg.org/polarisfm/youtube-dl synced 2024-11-22 16:44:32 +01:00

Remove integer casts and replace them with long integer casts

This commit is contained in:
Ricardo Garcia 2009-05-27 23:03:56 +02:00
parent 6a0015a7e0
commit e1f18b8a84

View File

@ -182,13 +182,13 @@ class FileDownloader(object):
new_min = max(bytes / 2.0, 1.0) 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: if elapsed_time < 0.001:
return int(new_max) return long(new_max)
rate = bytes / elapsed_time rate = bytes / elapsed_time
if rate > new_max: if rate > new_max:
return int(new_max) return long(new_max)
if rate < new_min: if rate < new_min:
return int(new_min) return long(new_min)
return int(rate) return long(rate)
@staticmethod @staticmethod
def parse_bytes(bytestr): def parse_bytes(bytestr):
@ -895,7 +895,7 @@ class YoutubeSearchIE(InfoExtractor):
return return
else: else:
try: try:
n = int(prefix) n = long(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
@ -904,7 +904,7 @@ class YoutubeSearchIE(InfoExtractor):
n = self._max_youtube_results n = self._max_youtube_results
self._download_n_results(query, n) self._download_n_results(query, n)
return return
except ValueError: # parsing prefix as int fails except ValueError: # parsing prefix as integer fails
self._download_n_results(query, 1) self._download_n_results(query, 1)
return return