forked from LBRYCommunity/lbry-sdk
add get_host_downloaded_from
This commit is contained in:
parent
9de4657a4d
commit
af99edc764
1 changed files with 10 additions and 0 deletions
|
@ -128,6 +128,16 @@ class DiskBlobManager(DHTHashSupplier):
|
|||
d = self._add_blob_to_download_history(blob_hash, host, rate)
|
||||
return d
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def get_host_downloaded_from(self, blob_hash):
|
||||
query_str = "SELECT host FROM download WHERE blob=? ORDER BY ts DESC LIMIT 1"
|
||||
host = yield self.db_conn.runQuery(query_str, (blob_hash,))
|
||||
if host:
|
||||
result = host[0][0]
|
||||
else:
|
||||
result = None
|
||||
defer.returnValue(result)
|
||||
|
||||
def add_blob_to_upload_history(self, blob_hash, host, rate):
|
||||
d = self._add_blob_to_upload_history(blob_hash, host, rate)
|
||||
return d
|
||||
|
|
Loading…
Reference in a new issue