GetFileHelper bug fixes

This commit is contained in:
Job Evers-Meltzer 2016-09-30 14:09:56 -05:00
parent 48a61605de
commit f5213fb77a

View file

@ -2801,7 +2801,7 @@ class _GetFileHelper(object):
self.return_json = return_json self.return_json = return_json
def retrieve_file(self): def retrieve_file(self):
d = self._search_for_file() d = self.search_for_file()
if self.return_json: if self.return_json:
d.addCallback(self._get_json) d.addCallback(self._get_json)
return d return d
@ -2830,7 +2830,7 @@ class _GetFileHelper(object):
if code == DOWNLOAD_RUNNING_CODE: if code == DOWNLOAD_RUNNING_CODE:
d = lbry_file.status() d = lbry_file.status()
d.addCallback(self._get_file_status) d.addCallback(self._get_msg_for_file_status)
d.addCallback( d.addCallback(
lambda msg: self._get_properties_dict(lbry_file, code, msg, written_bytes, size)) lambda msg: self._get_properties_dict(lbry_file, code, msg, written_bytes, size))
else: else:
@ -2838,7 +2838,7 @@ class _GetFileHelper(object):
self._get_properties_dict(lbry_file, code, message, written_bytes, size)) self._get_properties_dict(lbry_file, code, message, written_bytes, size))
return d return d
def _get_file_status(self, file_status): def _get_msg_for_file_status(self, file_status):
message = STREAM_STAGES[2][1] % ( message = STREAM_STAGES[2][1] % (
file_status.name, file_status.num_completed, file_status.num_known, file_status.name, file_status.num_completed, file_status.num_known,
file_status.running_status) file_status.running_status)
@ -2906,7 +2906,7 @@ class _GetFileHelper(object):
return defer.succeed(message) return defer.succeed(message)
if lbry_file.txid: if lbry_file.txid:
d = self._resolve_name(lbry_file.uri) d = self.daemon._resolve_name(lbry_file.uri)
d.addCallbacks(_add_to_dict, lambda _: _add_to_dict("Pending confirmation")) d.addCallbacks(_add_to_dict, lambda _: _add_to_dict("Pending confirmation"))
else: else:
d = defer.succeed(message) d = defer.succeed(message)