add claim txid and uri to lbry_file
This commit is contained in:
parent
74250982d1
commit
42a3006f6e
3 changed files with 19 additions and 4 deletions
|
@ -530,8 +530,10 @@ class LBRYWallet(object):
|
|||
" sd_hash text)")
|
||||
|
||||
def _save_name_metadata(self, name, sd_hash, txid):
|
||||
d = self.db.runQuery("insert into name_metadata values (?, ?, ?)",
|
||||
(name, txid, sd_hash))
|
||||
d = self.db.runQuery("select * from name_metadata where txid=?", (txid,))
|
||||
d.addCallback(lambda r: self.db.runQuery("insert into name_metadata values (?, ?, ?)", (name, txid, sd_hash))
|
||||
if not len(r) else None)
|
||||
|
||||
return d
|
||||
|
||||
def _get_claim_metadata_for_sd_hash(self, sd_hash):
|
||||
|
|
|
@ -25,6 +25,8 @@ class ManagedLBRYFileDownloader(LBRYFileSaver):
|
|||
stream_info_manager, payment_rate_manager, wallet, download_directory,
|
||||
upload_allowed, file_name)
|
||||
self.sd_hash = None
|
||||
self.txid = None
|
||||
self.uri = None
|
||||
self.rowid = rowid
|
||||
self.lbry_file_manager = lbry_file_manager
|
||||
self.saving_status = False
|
||||
|
@ -35,10 +37,19 @@ class ManagedLBRYFileDownloader(LBRYFileSaver):
|
|||
def _save_sd_hash(sd_hash):
|
||||
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.lbry_file_manager.get_lbry_file_status(self))
|
||||
|
||||
def restore_status(status):
|
||||
|
|
|
@ -1101,6 +1101,7 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
'stream_name': f.stream_name,
|
||||
'suggested_file_name': f.suggested_file_name,
|
||||
'upload_allowed': f.upload_allowed, 'sd_hash': f.sd_hash,
|
||||
'lbry_uri': f.uri, 'txid': f.txid,
|
||||
'total_bytes': size,
|
||||
'written_bytes': written_bytes, 'code': status[0],
|
||||
'message': message})
|
||||
|
@ -1109,7 +1110,8 @@ class LBRYDaemon(jsonrpc.JSONRPC):
|
|||
'points_paid': f.points_paid, 'stopped': f.stopped, 'stream_hash': f.stream_hash,
|
||||
'stream_name': f.stream_name, 'suggested_file_name': f.suggested_file_name,
|
||||
'upload_allowed': f.upload_allowed, 'sd_hash': f.sd_hash, 'total_bytes': size,
|
||||
'written_bytes': written_bytes, 'code': status[0], 'message': status[1]})
|
||||
'written_bytes': written_bytes, 'lbry_uri': f.uri, 'txid': f.txid,
|
||||
'code': status[0], 'message': status[1]})
|
||||
|
||||
return d
|
||||
|
||||
|
|
Loading…
Reference in a new issue