load uri and txid when stream is started

This commit is contained in:
Jack 2016-05-10 20:47:35 -04:00
parent 42a3006f6e
commit b04cfdc091
2 changed files with 13 additions and 2 deletions

View file

@ -111,11 +111,21 @@ class ManagedLBRYFileDownloader(LBRYFileSaver):
d.addCallback(lambda _: self.stream_info_manager._get_sd_blob_hashes_for_stream(self.stream_hash))
def _save_sd_hash(sd_hash):
self.sd_hash = sd_hash[0]
if len(sd_hash):
self.sd_hash = sd_hash[0]
d = self.wallet._get_claim_metadata_for_sd_hash(self.sd_hash)
else:
d = defer.succeed(None)
return d
def _save_claim(name, txid):
self.uri = name
self.txid = txid
return defer.succeed(None)
d.addCallback(_save_sd_hash)
d.addCallback(lambda r: _save_claim(r[0], r[1]) if r else None)
d.addCallback(lambda _: self._save_status())
return d

View file

@ -593,6 +593,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
d = self._upload_log(name_prefix="close", exclude_previous=False if self.first_run else True)
d.addCallback(lambda _: self._stop_server())
d.addCallback(lambda _: self.lbry_file_manager.stop())
d.addErrback(lambda err: log.info("Bad server shutdown: " + err.getTraceback()))
if self.session is not None:
d.addCallback(lambda _: self.session.shut_down())