add save_file argument to get
This commit is contained in:
parent
287b89db66
commit
2d314dce60
1 changed files with 6 additions and 4 deletions
|
@ -880,24 +880,26 @@ class Daemon(metaclass=JSONRPCServerType):
|
||||||
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
|
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
|
||||||
STREAM_MANAGER_COMPONENT,
|
STREAM_MANAGER_COMPONENT,
|
||||||
conditions=[WALLET_IS_UNLOCKED])
|
conditions=[WALLET_IS_UNLOCKED])
|
||||||
async def jsonrpc_get(self, uri, file_name=None, timeout=None):
|
async def jsonrpc_get(self, uri, file_name=None, timeout=None, save_file=None):
|
||||||
"""
|
"""
|
||||||
Download stream from a LBRY name.
|
Download stream from a LBRY name.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>]
|
get <uri> [<file_name> | --file_name=<file_name>] [<timeout> | --timeout=<timeout>] [--save_file]
|
||||||
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--uri=<uri> : (str) uri of the content to download
|
--uri=<uri> : (str) uri of the content to download
|
||||||
--file_name=<file_name> : (str) specified name for the downloaded file
|
--file_name=<file_name> : (str) specified name for the downloaded file, overrides the stream file name
|
||||||
--timeout=<timeout> : (int) download timeout in number of seconds
|
--timeout=<timeout> : (int) download timeout in number of seconds
|
||||||
|
--save_file : (bool) save the file to the downloads directory
|
||||||
|
|
||||||
Returns: {File}
|
Returns: {File}
|
||||||
"""
|
"""
|
||||||
|
save_file = save_file if save_file is not None else not self.conf.streaming_only
|
||||||
try:
|
try:
|
||||||
stream = await self.stream_manager.download_stream_from_uri(
|
stream = await self.stream_manager.download_stream_from_uri(
|
||||||
uri, self.exchange_rate_manager, timeout, file_name
|
uri, self.exchange_rate_manager, timeout, file_name, save_file=save_file
|
||||||
)
|
)
|
||||||
if not stream:
|
if not stream:
|
||||||
raise DownloadSDTimeout(uri)
|
raise DownloadSDTimeout(uri)
|
||||||
|
|
Loading…
Reference in a new issue