From 67b9ea9deb71c396d5bf85045a2bbbc334afc51d Mon Sep 17 00:00:00 2001 From: Victor Shyba Date: Mon, 18 Oct 2021 04:04:02 -0300 Subject: [PATCH] no api yet --- lbry/extras/daemon/daemon.py | 53 ------------------- lbry/extras/daemon/storage.py | 19 ------- lbry/stream/managed_stream.py | 4 -- .../datanetwork/test_file_commands.py | 19 ------- 4 files changed, 95 deletions(-) diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index ff07db219..89e56dd8f 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -3030,59 +3030,6 @@ class Daemon(metaclass=JSONRPCServerType): } return base58.b58encode(json.dumps(export, separators=(',', ':'))) - @requires(WALLET_COMPONENT) - def jsonrpc_channel_subscription_list(self): - """ - List subscribed channels and modes. - - Usage: - channel_subscription_list - - Returns: - (list) [(channel_id, download_latest, download_all)] - """ - return self.storage.get_subscriptions() - - @requires(WALLET_COMPONENT) - def jsonrpc_channel_subscribe(self, channel_id, download_latest=None, download_all=False): - """ - Subscribe to a channel and optionally start downloading streams proactively. - - Usage: - channel_subscribe ( | --channel_id=) [--download_latest=] - [--download_all] - - Options: - --channel_id= : (str) claim id of channel to subscribe. - --download_latest= : (int) amount of newest streams to ensure download. - --download_all : (bool) download all streams from the channel. - - Returns: - (bool) Subscription successful? (False only if channel doesn't exist) - """ - if download_all and download_latest is not None: - raise ConflictingInputValueError("download_latest", "download_all") - return self.storage.add_subscription(channel_id, download_latest, download_all) - - @requires(WALLET_COMPONENT) - def jsonrpc_channel_unsubscribe(self, channel_id): - """ - Subscribe to a channel and optionally start downloading streams proactively. - - Usage: - channel_subscribe ( | --channel_id=) [--download=] - - Options: - --channel_id= : (str) claim id of channel to subscribe - --download= : (str) which strategy to use for downloads: 'all' for everything. - 'latest-X' for the latest X streams. None (default) for nothing. - - Returns: - (bool) Subscription successful? (False only if channel doesn't exist) - """ - return self.storage.remove_subscription(channel_id) - - @requires(WALLET_COMPONENT) async def jsonrpc_channel_import(self, channel_data, wallet_id=None): """ diff --git a/lbry/extras/daemon/storage.py b/lbry/extras/daemon/storage.py index a9b83d447..758c25970 100644 --- a/lbry/extras/daemon/storage.py +++ b/lbry/extras/daemon/storage.py @@ -235,12 +235,6 @@ class SQLiteStorage(SQLiteMixin): pragma foreign_keys=on; pragma journal_mode=WAL; - create table if not exists subscription ( - channel_id char(40) primary key not null, - download_latest integer not null default 0, - download_all integer not null default 0 - ); - create table if not exists blob ( blob_hash char(96) primary key not null, blob_length integer not null, @@ -545,19 +539,6 @@ class SQLiteStorage(SQLiteMixin): async def delete_torrent(self, bt_infohash: str): return await self.db.run(delete_torrent, bt_infohash) - # # # # # # # # # subscriptions # # # # # # # # # - - def add_subscription(self, channel_id, download_latest=None, download_all=None): - return self.db.execute_fetchall( - "insert or replace into subscription(channel_id, download_latest, download_all) values (?, ?, ?)", - (channel_id, download_latest or 0, 1 if download_all else 0)) - - def remove_subscription(self, channel_id): - return self.db.execute_fetchall("delete from subscription where channel_id=?", (channel_id,)) - - def get_subscriptions(self): - return self.db.execute_fetchall("select channel_id, download_latest, download_all from subscription") - # # # # # # # # # file stuff # # # # # # # # # def save_downloaded_file(self, stream_hash: str, file_name: typing.Optional[str], diff --git a/lbry/stream/managed_stream.py b/lbry/stream/managed_stream.py index aee4bbc72..2a85da66e 100644 --- a/lbry/stream/managed_stream.py +++ b/lbry/stream/managed_stream.py @@ -246,10 +246,6 @@ class ManagedStream(ManagedDownloadSource): handle.write(data) handle.flush() - async def save_blobs(self): - async for _ in self._aiter_read_stream(0, connection_id=self.STREAMING_ID): - pass - async def _save_file(self, output_path: str): log.info("save file for lbry://%s#%s (sd hash %s...) -> %s", self.claim_name, self.claim_id, self.sd_hash[:6], output_path) diff --git a/tests/integration/datanetwork/test_file_commands.py b/tests/integration/datanetwork/test_file_commands.py index 54b917f89..83490b90e 100644 --- a/tests/integration/datanetwork/test_file_commands.py +++ b/tests/integration/datanetwork/test_file_commands.py @@ -616,22 +616,3 @@ class TestProactiveDownloaderComponent(CommandTestCase): self.assertEqual(0, len(await self.file_list())) await self.daemon.blob_manager.delete_blobs(list(self.daemon.blob_manager.completed_blob_hashes), True) self.assertEqual(0, len((await self.daemon.jsonrpc_blob_list())['items'])) - - await proactive_downloader.stop() - await self.daemon.jsonrpc_channel_subscribe(channel_id, 1) - await proactive_downloader.start() - await proactive_downloader.finished_iteration.wait() - await self.assertBlobs(content1) - await self.daemon.jsonrpc_file_delete(delete_all=True) - - await self.daemon.jsonrpc_channel_subscribe(channel_id, download_all=True) - await proactive_downloader.stop() - await proactive_downloader.start() - await proactive_downloader.finished_iteration.wait() - await self.assertBlobs(content1, content2) - - self.assertEqual(0, len(await self.file_list())) - - self.assertEqual([(channel_id, 0, 1)], await self.daemon.jsonrpc_channel_subscription_list()) - await self.daemon.jsonrpc_channel_unsubscribe(channel_id) - self.assertEqual([], await self.daemon.jsonrpc_channel_subscription_list())