fix stop condition
This commit is contained in:
parent
c9ae251d60
commit
fa83a4f671
1 changed files with 1 additions and 4 deletions
|
@ -10,7 +10,6 @@ from lbrynet.core.Error import DownloadDataTimeout, DownloadCanceledError
|
||||||
from lbrynet.core.utils import safe_start_looping_call, safe_stop_looping_call
|
from lbrynet.core.utils import safe_start_looping_call, safe_stop_looping_call
|
||||||
from lbrynet.core.StreamDescriptor import download_sd_blob
|
from lbrynet.core.StreamDescriptor import download_sd_blob
|
||||||
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloaderFactory
|
||||||
from lbrynet.file_manager.EncryptedFileDownloader import ManagedEncryptedFileDownloader
|
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
|
||||||
INITIALIZING_CODE = 'initializing'
|
INITIALIZING_CODE = 'initializing'
|
||||||
|
@ -62,9 +61,7 @@ class GetStream(object):
|
||||||
return os.path.join(self.download_directory, self.downloader.file_name)
|
return os.path.join(self.download_directory, self.downloader.file_name)
|
||||||
|
|
||||||
def _check_status(self, status):
|
def _check_status(self, status):
|
||||||
stop_condition = (status.num_completed > 0 or
|
if status.num_completed > 0 and not self.data_downloading_deferred.called:
|
||||||
status.running_status == ManagedEncryptedFileDownloader.STATUS_STOPPED)
|
|
||||||
if stop_condition and not self.data_downloading_deferred.called:
|
|
||||||
self.data_downloading_deferred.callback(True)
|
self.data_downloading_deferred.callback(True)
|
||||||
if self.data_downloading_deferred.called:
|
if self.data_downloading_deferred.called:
|
||||||
safe_stop_looping_call(self.checker)
|
safe_stop_looping_call(self.checker)
|
||||||
|
|
Loading…
Reference in a new issue