From 2d314dce60d42485ac088db15d227ec5ba3747cd Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Fri, 5 Apr 2019 00:22:17 -0400 Subject: [PATCH] add save_file argument to `get` --- lbrynet/extras/daemon/Daemon.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 35492ecf9..addffec4a 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -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 [ | --file_name=] [ | --timeout=] + get [ | --file_name=] [ | --timeout=] [--save_file] Options: --uri= : (str) uri of the content to download - --file_name= : (str) specified name for the downloaded file + --file_name= : (str) specified name for the downloaded file, overrides the stream file name --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)