forked from LBRYCommunity/lbry-sdk
rename streaming_only setting -> save_files
This commit is contained in:
parent
a8e612773d
commit
1ffb99f9f9
5 changed files with 12 additions and 13 deletions
|
@ -13,7 +13,7 @@ data_dir: /home/lbry/.lbrynet
|
|||
download_directory: /home/lbry/downloads
|
||||
|
||||
save_blobs: true
|
||||
streaming_only: false
|
||||
save_files: false
|
||||
dht_node_port: 4444
|
||||
peer_port: 3333
|
||||
use_upnp: true
|
||||
|
|
|
@ -539,7 +539,7 @@ class Config(CLIConfig):
|
|||
cache_time = Integer("Time to cache resolved claims", 150) # TODO: use this
|
||||
|
||||
# daemon
|
||||
streaming_only = Toggle("Only stream downloaded files, do not write files to the downloads directory", False)
|
||||
save_files = Toggle("Save downloaded files when calling `get` by default", True)
|
||||
components_to_skip = Strings("components which will be skipped during start-up of daemon", [])
|
||||
share_usage_data = Toggle(
|
||||
"Whether to share usage stats and diagnostic info with LBRY.", True,
|
||||
|
|
|
@ -913,7 +913,7 @@ class Daemon(metaclass=JSONRPCServerType):
|
|||
|
||||
Returns: {File}
|
||||
"""
|
||||
save_file = save_file if save_file is not None else not self.conf.streaming_only
|
||||
save_file = save_file if save_file is not None else self.conf.save_files
|
||||
try:
|
||||
stream = await self.stream_manager.download_stream_from_uri(
|
||||
uri, self.exchange_rate_manager, timeout, file_name, save_file=save_file
|
||||
|
|
|
@ -92,7 +92,7 @@ class StreamManager:
|
|||
async def start_stream(self, stream: ManagedStream):
|
||||
stream.update_status(ManagedStream.STATUS_RUNNING)
|
||||
await self.storage.change_file_status(stream.stream_hash, ManagedStream.STATUS_RUNNING)
|
||||
await stream.setup(self.node, save_file=not self.config.streaming_only)
|
||||
await stream.setup(self.node, save_file=self.config.save_files)
|
||||
self.storage.content_claim_callbacks[stream.stream_hash] = lambda: self._update_content_claim(stream)
|
||||
|
||||
async def recover_streams(self, file_infos: typing.List[typing.Dict]):
|
||||
|
@ -149,7 +149,7 @@ class StreamManager:
|
|||
# log.info("Attempting to recover %i streams", len(to_recover))
|
||||
await self.recover_streams(to_recover)
|
||||
|
||||
if self.config.streaming_only:
|
||||
if not self.config.save_files:
|
||||
to_set_as_streaming = []
|
||||
for file_info in to_start:
|
||||
file_name = path_or_none(file_info['file_name'])
|
||||
|
@ -381,7 +381,7 @@ class StreamManager:
|
|||
log.info("paid fee of %s for %s", fee_amount, uri)
|
||||
|
||||
download_directory = download_directory or self.config.download_dir
|
||||
if not file_name and (self.config.streaming_only or not save_file):
|
||||
if not file_name and (not self.config.save_files or not save_file):
|
||||
download_dir, file_name = None, None
|
||||
stream = ManagedStream(
|
||||
self.loop, self.config, self.blob_manager, claim.stream.source.sd_hash, download_directory,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import hashlib
|
||||
import asyncio
|
||||
import aiohttp
|
||||
import aiohttp.web
|
||||
|
||||
|
@ -25,9 +24,9 @@ class RangeRequests(CommandTestCase):
|
|||
await self.daemon.stream_manager.start()
|
||||
return
|
||||
|
||||
async def _setup_stream(self, data: bytes, save_blobs: bool = True, streaming_only: bool = True):
|
||||
async def _setup_stream(self, data: bytes, save_blobs: bool = True, save_files: bool = False):
|
||||
self.daemon.conf.save_blobs = save_blobs
|
||||
self.daemon.conf.streaming_only = streaming_only
|
||||
self.daemon.conf.save_files = save_files
|
||||
self.data = data
|
||||
await self.stream_create('foo', '0.01', data=self.data)
|
||||
if save_blobs:
|
||||
|
@ -192,9 +191,9 @@ class RangeRequests(CommandTestCase):
|
|||
len(files_in_download_dir), len(current_files_in_download_dir)
|
||||
)
|
||||
|
||||
async def test_stream_and_save_with_blobs(self):
|
||||
async def test_stream_and_save_file_with_blobs(self):
|
||||
self.data = get_random_bytes((MAX_BLOB_SIZE - 1) * 4)
|
||||
await self._setup_stream(self.data, streaming_only=False)
|
||||
await self._setup_stream(self.data, save_files=True)
|
||||
|
||||
await self._test_range_requests()
|
||||
streams = self.daemon.jsonrpc_file_list()
|
||||
|
@ -246,9 +245,9 @@ class RangeRequests(CommandTestCase):
|
|||
with open(stream.full_path, 'rb') as f:
|
||||
self.assertEqual(self.data, f.read())
|
||||
|
||||
async def test_stream_and_save_without_blobs(self):
|
||||
async def test_stream_and_save_file_without_blobs(self):
|
||||
self.data = get_random_bytes((MAX_BLOB_SIZE - 1) * 4)
|
||||
await self._setup_stream(self.data, streaming_only=False)
|
||||
await self._setup_stream(self.data, save_files=True)
|
||||
self.daemon.conf.save_blobs = False
|
||||
|
||||
await self._test_range_requests()
|
||||
|
|
Loading…
Reference in a new issue