add save_file argument to get

This commit is contained in:
Jack Robison 2019-04-05 00:22:17 -04:00
parent 287b89db66
commit 2d314dce60
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -880,24 +880,26 @@ class Daemon(metaclass=JSONRPCServerType):
@requires(WALLET_COMPONENT, EXCHANGE_RATE_MANAGER_COMPONENT, BLOB_COMPONENT, DATABASE_COMPONENT,
STREAM_MANAGER_COMPONENT,
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.
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:
--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
--save_file : (bool) save the file to the downloads directory
Returns: {File}
"""
save_file = save_file if save_file is not None else not self.conf.streaming_only
try:
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:
raise DownloadSDTimeout(uri)