mirror of
https://github.com/JohnDoee/deluge-streaming/
synced 2026-07-01 07:31:17 -07:00
added buffer buster and some wrong math
This commit is contained in:
@@ -182,7 +182,7 @@ class Torrent(object):
|
||||
logger.debug('Calling read again to get the real number')
|
||||
return self.can_read(from_byte)
|
||||
else:
|
||||
return ((last_available_piece - needed_piece) * self.piece_length) + rest + self.piece_length
|
||||
return ((last_available_piece - needed_piece) * self.piece_length) + self.piece_length - rest
|
||||
|
||||
def is_idle(self):
|
||||
return not self.readers and self.last_activity + TORRENT_CLEANUP_INTERVAL < datetime.now()
|
||||
|
||||
@@ -50,6 +50,9 @@ class DelugeTorrentInput(InputBase.find_plugin('file')):
|
||||
if self.can_read_to <= tell or self.can_read_to is None:
|
||||
self.can_read_to = self.torrent.can_read(self.offset + tell) + tell
|
||||
|
||||
if self._open_file:
|
||||
self._open_file.seek(tell)
|
||||
|
||||
real_num = min(num, self.can_read_to - tell)
|
||||
if num != real_num:
|
||||
logger.info('The real number we can read to is %s and not %s at position %s' % (real_num, num, tell))
|
||||
|
||||
Reference in New Issue
Block a user