Merge pull request #287 from lbryio/version-add-lbry-id
get_lbry_session_info
This commit is contained in:
commit
48b137fe4c
1 changed files with 28 additions and 2 deletions
|
@ -96,7 +96,7 @@ NOT_FOUND = 404
|
||||||
OK_CODE = 200
|
OK_CODE = 200
|
||||||
|
|
||||||
PENDING_LBRY_ID = "not set"
|
PENDING_LBRY_ID = "not set"
|
||||||
|
SHORT_LBRY_ID_LEN = 20
|
||||||
|
|
||||||
class Checker:
|
class Checker:
|
||||||
"""The looping calls the daemon runs"""
|
"""The looping calls the daemon runs"""
|
||||||
|
@ -592,7 +592,7 @@ class Daemon(AuthJSONRPCServer):
|
||||||
def _upload_log(self, log_type=None, exclude_previous=False, force=False):
|
def _upload_log(self, log_type=None, exclude_previous=False, force=False):
|
||||||
if self.upload_log or force:
|
if self.upload_log or force:
|
||||||
if self.lbryid is not PENDING_LBRY_ID:
|
if self.lbryid is not PENDING_LBRY_ID:
|
||||||
id_hash = base58.b58encode(self.lbryid)[:20]
|
id_hash = base58.b58encode(self.lbryid)[:SHORT_LBRY_ID_LEN]
|
||||||
else:
|
else:
|
||||||
id_hash = self.lbryid
|
id_hash = self.lbryid
|
||||||
try:
|
try:
|
||||||
|
@ -1182,6 +1182,32 @@ class Daemon(AuthJSONRPCServer):
|
||||||
log.info("Get version info: " + json.dumps(msg))
|
log.info("Get version info: " + json.dumps(msg))
|
||||||
return self._render_response(msg, OK_CODE)
|
return self._render_response(msg, OK_CODE)
|
||||||
|
|
||||||
|
def jsonrpc_get_lbry_session_info(self):
|
||||||
|
"""
|
||||||
|
Get information about the current lbrynet session
|
||||||
|
|
||||||
|
Args:
|
||||||
|
None
|
||||||
|
Returns:
|
||||||
|
'lbry_id': string,
|
||||||
|
'managed_blobs': int, number of completed blobs in the blob manager,
|
||||||
|
'managed_streams': int, number of lbry files in the file manager
|
||||||
|
"""
|
||||||
|
|
||||||
|
d = self.session.blob_manager.get_all_verified_blobs()
|
||||||
|
|
||||||
|
def _prepare_message(blobs):
|
||||||
|
msg = {
|
||||||
|
'lbry_id': base58.b58encode(self.lbryid)[:SHORT_LBRY_ID_LEN],
|
||||||
|
'managed_blobs': len(blobs),
|
||||||
|
'managed_streams': len(self.lbry_file_manager.lbry_files),
|
||||||
|
}
|
||||||
|
return msg
|
||||||
|
|
||||||
|
d.addCallback(_prepare_message)
|
||||||
|
d.addCallback(lambda r: self._render_response(r, OK_CODE))
|
||||||
|
return d
|
||||||
|
|
||||||
def jsonrpc_get_settings(self):
|
def jsonrpc_get_settings(self):
|
||||||
"""
|
"""
|
||||||
Get lbrynet daemon settings
|
Get lbrynet daemon settings
|
||||||
|
|
Loading…
Reference in a new issue