forked from LBRYCommunity/lbry-sdk
status code for previously downloaded file
also fix return for files downloaded manually with stream_info
This commit is contained in:
parent
29d6d824fc
commit
b017b63745
1 changed files with 14 additions and 1 deletions
|
@ -1078,6 +1078,11 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
if search_by == "name":
|
if search_by == "name":
|
||||||
if val in self.streams.keys():
|
if val in self.streams.keys():
|
||||||
status = self.streams[val].code
|
status = self.streams[val].code
|
||||||
|
elif f in self.lbry_file_manager.lbry_files:
|
||||||
|
# if f.stopped:
|
||||||
|
# status = STREAM_STAGES[3]
|
||||||
|
# else:
|
||||||
|
status = STREAM_STAGES[2]
|
||||||
else:
|
else:
|
||||||
status = [False, False]
|
status = [False, False]
|
||||||
else:
|
else:
|
||||||
|
@ -1449,6 +1454,10 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
|
|
||||||
if 'stream_info' in p.keys():
|
if 'stream_info' in p.keys():
|
||||||
stream_info = p['stream_info']
|
stream_info = p['stream_info']
|
||||||
|
if 'sources' in stream_info.keys():
|
||||||
|
sd_hash = stream_info['sources']['lbry_sd_hash']
|
||||||
|
else:
|
||||||
|
sd_hash = stream_info['stream_hash']
|
||||||
else:
|
else:
|
||||||
stream_info = None
|
stream_info = None
|
||||||
|
|
||||||
|
@ -1457,7 +1466,11 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
||||||
if p['name'] not in self.waiting_on.keys():
|
if p['name'] not in self.waiting_on.keys():
|
||||||
d = self._download_name(name=name, timeout=timeout, download_directory=download_directory,
|
d = self._download_name(name=name, timeout=timeout, download_directory=download_directory,
|
||||||
stream_info=stream_info, file_name=file_name)
|
stream_info=stream_info, file_name=file_name)
|
||||||
d.addCallback(lambda l: {'stream_hash': l.sd_hash, 'path': os.path.join(self.download_directory, l.file_name)})
|
d.addCallback(lambda l: {'stream_hash': sd_hash,
|
||||||
|
'path': os.path.join(self.download_directory, l.file_name)}
|
||||||
|
if stream_info else
|
||||||
|
{'stream_hash': l.sd_hash,
|
||||||
|
'path': os.path.join(self.download_directory, l.file_name)})
|
||||||
d.addCallback(lambda message: self._render_response(message, OK_CODE))
|
d.addCallback(lambda message: self._render_response(message, OK_CODE))
|
||||||
else:
|
else:
|
||||||
d = server.failure
|
d = server.failure
|
||||||
|
|
Loading…
Reference in a new issue