From 080ff5974dca3c9de0f71de005eeae7e996a0656 Mon Sep 17 00:00:00 2001 From: Martijn Voncken Date: Fri, 15 Aug 2008 21:00:28 +0000 Subject: [PATCH] basic get_status() --- deluge/core/core.py | 11 +++++++++++ deluge/tests/test_filters.py | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/deluge/core/core.py b/deluge/core/core.py index e95490781..73e60bde3 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -507,6 +507,17 @@ class Core( status.update(self.plugins.get_status(torrent_id, leftover_fields)) return status + + def export_get_status(self, keys, filter_dict = None): + """ + returns all torrents , optionally filtered by filter_dict. + """ + if filter_dict: + raise NotImplementedError("not yet") + + torrent_ids = self.torrents.get_torrent_list() + return self.export_get_torrents_status(torrent_ids, keys) + def export_get_torrents_status(self, torrent_ids, keys): status_dict = {}.fromkeys(torrent_ids) diff --git a/deluge/tests/test_filters.py b/deluge/tests/test_filters.py index e9cde54b6..718e4fc47 100644 --- a/deluge/tests/test_filters.py +++ b/deluge/tests/test_filters.py @@ -17,6 +17,10 @@ print sorted(sclient.get_torrent_status(torrent_id,[]).keys()) print sorted(sclient.get_status_keys()) +#default, no filter argument. +print sclient.get_status(["name","state"]) + +print "HI! , after this the errors start" #filters on default state fields print sclient.get_status(["name","state"], {"state":"Paused"}) print sclient.get_status(["name","state"], {"tracker_host":"aelitis.com"})