diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index c9060eaa7..a6885957b 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -3030,6 +3030,19 @@ 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): """ diff --git a/lbry/extras/daemon/storage.py b/lbry/extras/daemon/storage.py index 6fc25313f..a9b83d447 100644 --- a/lbry/extras/daemon/storage.py +++ b/lbry/extras/daemon/storage.py @@ -553,7 +553,7 @@ class SQLiteStorage(SQLiteMixin): (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 subscriptions where channel_id=?", (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") diff --git a/tests/integration/datanetwork/test_file_commands.py b/tests/integration/datanetwork/test_file_commands.py index 4f8108163..51520b300 100644 --- a/tests/integration/datanetwork/test_file_commands.py +++ b/tests/integration/datanetwork/test_file_commands.py @@ -618,3 +618,7 @@ class TestProactiveDownloaderComponent(CommandTestCase): await proactive_downloader.start() await proactive_downloader.finished_iteration.wait() await self.assertFileList(content1, content2) + + 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())