mirror of
https://github.com/LBRYFoundation/lbry-sdk.git
synced 2025-08-29 08:21:24 +00:00
commit
0941a207f1
3 changed files with 50 additions and 22 deletions
|
@ -16,10 +16,15 @@ at anytime.
|
||||||
* Support resolution of multiple uris with `resolve`, all results are keyed by uri
|
* Support resolution of multiple uris with `resolve`, all results are keyed by uri
|
||||||
* Add `error` responses for failed resolves
|
* Add `error` responses for failed resolves
|
||||||
* Add `claim_list_by_channel`, supports multiple channel resolution
|
* Add `claim_list_by_channel`, supports multiple channel resolution
|
||||||
|
* Rename delete_target_file argument of delete API command to delete_from_download_dir
|
||||||
|
* Rename delete_all CLI flag -a to --delete_all
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
* Race condition from improper initialization and shutdown of the blob manager database
|
* Race condition from improper initialization and shutdown of the blob manager database
|
||||||
* Various fixes for GetStream class used in API command get
|
* Various fixes for GetStream class used in API command get
|
||||||
|
* Download analytics error
|
||||||
|
* Fixed flag options in file_delete API command
|
||||||
|
*
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
*
|
*
|
||||||
|
|
|
@ -1535,27 +1535,30 @@ class Daemon(AuthJSONRPCServer):
|
||||||
|
|
||||||
@AuthJSONRPCServer.auth_required
|
@AuthJSONRPCServer.auth_required
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
@AuthJSONRPCServer.flags(delete_target_file='-f', delete_all='-a')
|
@AuthJSONRPCServer.flags(delete_from_download_dir='-f', delete_all='--delete_all')
|
||||||
def jsonrpc_file_delete(self, delete_target_file=True, delete_all=False, **kwargs):
|
def jsonrpc_file_delete(self, delete_from_download_dir=False, delete_all=False, **kwargs):
|
||||||
"""
|
"""
|
||||||
Delete a LBRY file
|
Delete a LBRY file
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
file_delete [-a | -f] [--sd_hash=<sd_hash>] [--file_name=<file_name>]
|
file_delete [-f] [--delete_all] [--sd_hash=<sd_hash>] [--file_name=<file_name>]
|
||||||
[--stream_hash=<stream_hash>] [--claim_id=<claim_id>]
|
[--stream_hash=<stream_hash>] [--claim_id=<claim_id>]
|
||||||
[--outpoint=<outpoint>] [--rowid=<rowid>]
|
[--outpoint=<outpoint>] [--rowid=<rowid>]
|
||||||
[--name=<name>]
|
[--name=<name>]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
-a : delete file from downloads and delete stored blobs
|
-f, --delete_from_download_dir : delete file from download directory,
|
||||||
-f : delete only from downloads, do not delete blobs
|
instead of just deleting blobs
|
||||||
--sd_hash=<sd_hash> : delete by file sd hash
|
--delete_all : if there are multiple matching files,
|
||||||
--file_name<file_name> : delete by file name in downloads folder
|
allow the deletion of multiple files.
|
||||||
--stream_hash=<stream_hash> : delete by file stream hash
|
Otherwise do not delete anything.
|
||||||
--claim_id=<claim_id> : delete by file claim id
|
--sd_hash=<sd_hash> : delete by file sd hash
|
||||||
--outpoint=<outpoint> : delete by file claim outpoint
|
--file_name<file_name> : delete by file name in downloads folder
|
||||||
--rowid=<rowid> : delete by file row id
|
--stream_hash=<stream_hash> : delete by file stream hash
|
||||||
--name=<name> : delete by associated name claim of file
|
--claim_id=<claim_id> : delete by file claim id
|
||||||
|
--outpoint=<outpoint> : delete by file claim outpoint
|
||||||
|
--rowid=<rowid> : delete by file row id
|
||||||
|
--name=<name> : delete by associated name claim of file
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
(bool) true if deletion was successful
|
(bool) true if deletion was successful
|
||||||
|
@ -1567,7 +1570,8 @@ class Daemon(AuthJSONRPCServer):
|
||||||
if not delete_all:
|
if not delete_all:
|
||||||
log.warning("There are %i files to delete, use narrower filters to select one",
|
log.warning("There are %i files to delete, use narrower filters to select one",
|
||||||
len(lbry_files))
|
len(lbry_files))
|
||||||
result = False
|
response = yield self._render_response(False)
|
||||||
|
defer.returnValue(response)
|
||||||
else:
|
else:
|
||||||
log.warning("Deleting %i files",
|
log.warning("Deleting %i files",
|
||||||
len(lbry_files))
|
len(lbry_files))
|
||||||
|
@ -1581,9 +1585,10 @@ class Daemon(AuthJSONRPCServer):
|
||||||
if lbry_file.claim_id in self.streams:
|
if lbry_file.claim_id in self.streams:
|
||||||
del self.streams[lbry_file.claim_id]
|
del self.streams[lbry_file.claim_id]
|
||||||
yield self.lbry_file_manager.delete_lbry_file(lbry_file,
|
yield self.lbry_file_manager.delete_lbry_file(lbry_file,
|
||||||
delete_file=delete_target_file)
|
delete_file=delete_from_download_dir)
|
||||||
log.info("Deleted %s (%s)", file_name, utils.short_hash(stream_hash))
|
log.info("Deleted %s (%s)", file_name, utils.short_hash(stream_hash))
|
||||||
result = True
|
result = True
|
||||||
|
|
||||||
response = yield self._render_response(result)
|
response = yield self._render_response(result)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
|
@ -2498,22 +2503,25 @@ class Daemon(AuthJSONRPCServer):
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def jsonrpc_cli_test_command(self, pos_arg, pos_args=[], pos_arg2=None, pos_arg3=None):
|
@AuthJSONRPCServer.flags(a_arg='-a', b_arg='-b')
|
||||||
|
def jsonrpc_cli_test_command(self, pos_arg, pos_args=[], pos_arg2=None, pos_arg3=None,
|
||||||
|
a_arg=False, b_arg=False):
|
||||||
"""
|
"""
|
||||||
This command is only for testing the CLI argument parsing
|
This command is only for testing the CLI argument parsing
|
||||||
Usage:
|
Usage:
|
||||||
cli_test_command (<pos_arg> | --pos_arg=<pos_arg>)
|
cli_test_command [-a] [-b] (<pos_arg> | --pos_arg=<pos_arg>)
|
||||||
[<pos_args>...] [--pos_arg2=<pos_arg2>]
|
[<pos_args>...] [--pos_arg2=<pos_arg2>]
|
||||||
[--pos_arg3=<pos_arg3>]
|
[--pos_arg3=<pos_arg3>]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
-a, --a_arg : a arg
|
||||||
|
-b, --b_arg : b arg
|
||||||
<pos_arg2>, --pos_arg2=<pos_arg2> : pos arg 2
|
<pos_arg2>, --pos_arg2=<pos_arg2> : pos arg 2
|
||||||
<pos_arg3>, --pos_arg3=<pos_arg3> : pos arg 3
|
<pos_arg3>, --pos_arg3=<pos_arg3> : pos arg 3
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
pos args
|
pos args
|
||||||
"""
|
"""
|
||||||
out = (pos_arg, pos_args, pos_arg2, pos_arg3)
|
out = (pos_arg, pos_args, pos_arg2, pos_arg3, a_arg, b_arg)
|
||||||
response = yield self._render_response(out)
|
response = yield self._render_response(out)
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
|
||||||
|
|
|
@ -77,21 +77,36 @@ class TestIntegration(unittest.TestCase):
|
||||||
|
|
||||||
out,err = lbrynet_cli(['cli_test_command','1'])
|
out,err = lbrynet_cli(['cli_test_command','1'])
|
||||||
out = json.loads(out)
|
out = json.loads(out)
|
||||||
self.assertEqual([1,[],None,None], out)
|
self.assertEqual([1,[],None,None,False,False], out)
|
||||||
|
|
||||||
out,err = lbrynet_cli(['cli_test_command','1','--pos_arg2=1'])
|
out,err = lbrynet_cli(['cli_test_command','1','--pos_arg2=1'])
|
||||||
out = json.loads(out)
|
out = json.loads(out)
|
||||||
self.assertEqual([1,[],1,None], out)
|
self.assertEqual([1,[],1,None,False,False], out)
|
||||||
|
|
||||||
|
|
||||||
out,err = lbrynet_cli(['cli_test_command','1', '--pos_arg2=2','--pos_arg3=3'])
|
out,err = lbrynet_cli(['cli_test_command','1', '--pos_arg2=2','--pos_arg3=3'])
|
||||||
out = json.loads(out)
|
out = json.loads(out)
|
||||||
self.assertEqual([1,[],2,3], out)
|
self.assertEqual([1,[],2,3,False,False], out)
|
||||||
|
|
||||||
out,err = lbrynet_cli(['cli_test_command','1','2','3'])
|
out,err = lbrynet_cli(['cli_test_command','1','2','3'])
|
||||||
out = json.loads(out)
|
out = json.loads(out)
|
||||||
# TODO: variable length arguments don't have guess_type() on them
|
# TODO: variable length arguments don't have guess_type() on them
|
||||||
self.assertEqual([1,['2','3'],None,None], out)
|
self.assertEqual([1,['2','3'],None,None,False,False], out)
|
||||||
|
|
||||||
|
|
||||||
|
out,err = lbrynet_cli(['cli_test_command','1','-a'])
|
||||||
|
out = json.loads(out)
|
||||||
|
self.assertEqual([1,[],None,None,True,False], out)
|
||||||
|
|
||||||
|
out,err = lbrynet_cli(['cli_test_command','1','--a_arg'])
|
||||||
|
out = json.loads(out)
|
||||||
|
self.assertEqual([1,[],None,None,True,False], out)
|
||||||
|
|
||||||
|
|
||||||
|
out,err = lbrynet_cli(['cli_test_command','1','-a','-b'])
|
||||||
|
out = json.loads(out)
|
||||||
|
self.assertEqual([1,[],None,None,True,True], out)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_status(self):
|
def test_status(self):
|
||||||
|
|
Loading…
Add table
Reference in a new issue