mirror of
https://github.com/JohnDoee/deluge-streaming/
synced 2026-07-01 07:31:17 -07:00
ensuring torrent is added fully before streaming
This commit is contained in:
@@ -391,8 +391,7 @@ class TorrentHandler(object):
|
|||||||
|
|
||||||
def get_filesystem(self, infohash):
|
def get_filesystem(self, infohash):
|
||||||
torrent = get_torrent(infohash)
|
torrent = get_torrent(infohash)
|
||||||
status = torrent.get_status(['piece_length', 'files', 'file_progress', 'save_path'])
|
status = torrent.get_status(['files', 'file_progress', 'save_path'])
|
||||||
self.piece_length = status['piece_length']
|
|
||||||
save_path = status['save_path']
|
save_path = status['save_path']
|
||||||
|
|
||||||
found_rar = False
|
found_rar = False
|
||||||
@@ -456,9 +455,16 @@ class TorrentHandler(object):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def stream(self, infohash, path, wait_for_end_pieces=False):
|
def stream(self, infohash, path, wait_for_end_pieces=False):
|
||||||
logger.debug('Trying to get path:%s from infohash:%s' % (path, infohash))
|
logger.debug('Trying to get path:%s from infohash:%s' % (path, infohash))
|
||||||
local_torrent = self.get_torrent(infohash)
|
|
||||||
torrent = get_torrent(infohash)
|
torrent = get_torrent(infohash)
|
||||||
|
|
||||||
|
for _ in range(10):
|
||||||
|
status = torrent.get_status(['piece_length'])
|
||||||
|
if status['piece_length'] > 0:
|
||||||
|
break
|
||||||
|
yield sleep(0.2)
|
||||||
|
|
||||||
|
local_torrent = self.get_torrent(infohash)
|
||||||
|
|
||||||
filesystem = self.get_filesystem(infohash)
|
filesystem = self.get_filesystem(infohash)
|
||||||
if path:
|
if path:
|
||||||
stream_item = filesystem.get_item_from_path(path)
|
stream_item = filesystem.get_item_from_path(path)
|
||||||
|
|||||||
Reference in New Issue
Block a user