diff options
Diffstat (limited to 'deluge/plugins')
17 files changed, 46 insertions, 28 deletions
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/core.py b/deluge/plugins/AutoAdd/deluge_autoadd/core.py index 07ad53a..271d5f0 100644 --- a/deluge/plugins/AutoAdd/deluge_autoadd/core.py +++ b/deluge/plugins/AutoAdd/deluge_autoadd/core.py @@ -80,7 +80,6 @@ def check_input(cond, message): class Core(CorePluginBase): def enable(self): - # reduce typing, assigning some values to self... self.config = deluge.configmanager.ConfigManager('autoadd.conf', DEFAULT_PREFS) self.config.run_converter((0, 1), 2, self.__migrate_config_1_to_2) @@ -271,7 +270,7 @@ class Core(CorePluginBase): try: filedump = self.load_torrent(filepath, magnet) - except (OSError, EOFError, InvalidTorrentError) as ex: + except (OSError, EOFError, RuntimeError, InvalidTorrentError) as ex: # If torrent is invalid, keep track of it so can try again on the next pass. # This catches torrent files that may not be fully saved to disk at load time. log.debug('Torrent is invalid: %s', ex) diff --git a/deluge/plugins/Blocklist/deluge_blocklist/webui.py b/deluge/plugins/Blocklist/deluge_blocklist/webui.py index b8a0ca2..8ba4911 100644 --- a/deluge/plugins/Blocklist/deluge_blocklist/webui.py +++ b/deluge/plugins/Blocklist/deluge_blocklist/webui.py @@ -23,6 +23,5 @@ FORMAT_LIST = [ class WebUI(WebPluginBase): - scripts = [get_resource('blocklist.js')] debug_scripts = scripts diff --git a/deluge/plugins/Execute/deluge_execute/webui.py b/deluge/plugins/Execute/deluge_execute/webui.py index 26a4445..3586371 100644 --- a/deluge/plugins/Execute/deluge_execute/webui.py +++ b/deluge/plugins/Execute/deluge_execute/webui.py @@ -16,6 +16,5 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('execute.js')] debug_scripts = scripts diff --git a/deluge/plugins/Extractor/deluge_extractor/webui.py b/deluge/plugins/Extractor/deluge_extractor/webui.py index 715733c..0f58658 100644 --- a/deluge/plugins/Extractor/deluge_extractor/webui.py +++ b/deluge/plugins/Extractor/deluge_extractor/webui.py @@ -20,6 +20,5 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('extractor.js')] debug_scripts = scripts diff --git a/deluge/plugins/Label/deluge_label/core.py b/deluge/plugins/Label/deluge_label/core.py index a91275f..c28490b 100644 --- a/deluge/plugins/Label/deluge_label/core.py +++ b/deluge/plugins/Label/deluge_label/core.py @@ -137,6 +137,7 @@ class Core(CorePluginBase): log.debug('post_torrent_remove') if torrent_id in self.torrent_labels: del self.torrent_labels[torrent_id] + self.config.save() # Utils # def clean_config(self): @@ -191,8 +192,7 @@ class Core(CorePluginBase): """remove a label""" check_input(label_id in self.labels, _('Unknown Label')) del self.labels[label_id] - self.clean_config() - self.config.save() + self.save_config() def _set_torrent_options(self, torrent_id, label_id): options = self.labels[label_id] diff --git a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py index da18302..9d164b2 100644 --- a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py +++ b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py @@ -31,7 +31,6 @@ NO_LABEL = 'No Label' # menu class LabelSidebarMenu: def __init__(self): - self.treeview = component.get('FilterTreeView') self.menu = self.treeview.menu self.items = [] diff --git a/deluge/plugins/Label/deluge_label/gtkui/submenu.py b/deluge/plugins/Label/deluge_label/gtkui/submenu.py index ba9324b..54b6594 100644 --- a/deluge/plugins/Label/deluge_label/gtkui/submenu.py +++ b/deluge/plugins/Label/deluge_label/gtkui/submenu.py @@ -51,7 +51,7 @@ class LabelMenu(MenuItem): if label == NO_LABEL: item = MenuItem(_(NO_LABEL)) # noqa: F821 else: - item = MenuItem(label.replace('_', '__')) + item = MenuItem(label) item.connect('activate', self.on_select_label, label) self.sub_menu.append(item) self.show_all() diff --git a/deluge/plugins/Notifications/create_dev_link.sh b/deluge/plugins/Notifications/create_dev_link.sh new file mode 100755 index 0000000..5e04057 --- /dev/null +++ b/deluge/plugins/Notifications/create_dev_link.sh @@ -0,0 +1,11 @@ +#!/bin/bash +BASEDIR=$(cd `dirname $0` && pwd) +CONFIG_DIR=$( test -z $1 && echo "" || echo "$1") +[ -d "$CONFIG_DIR/plugins" ] || echo "Config dir "$CONFIG_DIR" is either not a directory or is not a proper deluge config directory. Exiting" +[ -d "$CONFIG_DIR/plugins" ] || exit 1 +cd $BASEDIR +test -d $BASEDIR/temp || mkdir $BASEDIR/temp +export PYTHONPATH=$BASEDIR/temp +python setup.py build develop --install-dir $BASEDIR/temp +cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins +rm -fr $BASEDIR/temp diff --git a/deluge/plugins/Notifications/deluge_notifications/webui.py b/deluge/plugins/Notifications/deluge_notifications/webui.py index ad090f5..bf3e829 100644 --- a/deluge/plugins/Notifications/deluge_notifications/webui.py +++ b/deluge/plugins/Notifications/deluge_notifications/webui.py @@ -21,7 +21,6 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('notifications.js')] debug_scripts = scripts diff --git a/deluge/plugins/Scheduler/deluge_scheduler/webui.py b/deluge/plugins/Scheduler/deluge_scheduler/webui.py index 4f5418b..e417916 100644 --- a/deluge/plugins/Scheduler/deluge_scheduler/webui.py +++ b/deluge/plugins/Scheduler/deluge_scheduler/webui.py @@ -19,6 +19,5 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('scheduler.js')] debug_scripts = scripts diff --git a/deluge/plugins/Stats/create_dev_link.sh b/deluge/plugins/Stats/create_dev_link.sh new file mode 100755 index 0000000..5e04057 --- /dev/null +++ b/deluge/plugins/Stats/create_dev_link.sh @@ -0,0 +1,11 @@ +#!/bin/bash +BASEDIR=$(cd `dirname $0` && pwd) +CONFIG_DIR=$( test -z $1 && echo "" || echo "$1") +[ -d "$CONFIG_DIR/plugins" ] || echo "Config dir "$CONFIG_DIR" is either not a directory or is not a proper deluge config directory. Exiting" +[ -d "$CONFIG_DIR/plugins" ] || exit 1 +cd $BASEDIR +test -d $BASEDIR/temp || mkdir $BASEDIR/temp +export PYTHONPATH=$BASEDIR/temp +python setup.py build develop --install-dir $BASEDIR/temp +cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins +rm -fr $BASEDIR/temp diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py index 9c66ee1..4aefc50 100644 --- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py +++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py @@ -7,7 +7,6 @@ import pytest import pytest_twisted from twisted.internet import defer -import deluge.component as component from deluge.common import fsize, fspeed from deluge.ui.client import client @@ -21,17 +20,15 @@ def print_totals(totals): print('down:', fsize(totals['total_download'] - totals['total_payload_download'])) -@pytest.mark.usefixtures('component') class TestStatsPlugin: @pytest_twisted.async_yield_fixture(autouse=True) - async def set_up(self): + async def set_up(self, component): defer.setDebugging(True) client.start_standalone() client.core.enable_plugin('Stats') await component.start() yield client.stop_standalone() - await component.shutdown() @defer.inlineCallbacks def test_client_totals(self): diff --git a/deluge/plugins/Stats/deluge_stats/webui.py b/deluge/plugins/Stats/deluge_stats/webui.py index f38daeb..2c2ed46 100644 --- a/deluge/plugins/Stats/deluge_stats/webui.py +++ b/deluge/plugins/Stats/deluge_stats/webui.py @@ -20,7 +20,6 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('stats.js')] # The enable and disable methods are not scrictly required on the WebUI diff --git a/deluge/plugins/Toggle/deluge_toggle/webui.py b/deluge/plugins/Toggle/deluge_toggle/webui.py index d16d29f..637365c 100644 --- a/deluge/plugins/Toggle/deluge_toggle/webui.py +++ b/deluge/plugins/Toggle/deluge_toggle/webui.py @@ -21,7 +21,6 @@ log = logging.getLogger(__name__) class WebUI(WebPluginBase): - scripts = [get_resource('toggle.js')] def enable(self): diff --git a/deluge/plugins/WebUi/create_dev_link.sh b/deluge/plugins/WebUi/create_dev_link.sh new file mode 100755 index 0000000..f4d60d2 --- /dev/null +++ b/deluge/plugins/WebUi/create_dev_link.sh @@ -0,0 +1,11 @@ +#!/bin/bash +BASEDIR=$(cd `dirname $0` && pwd) +CONFIG_DIR=$( test -z $1 && echo "/home/damien/.config/deluge/" || echo "$1") +[ -d "$CONFIG_DIR/plugins" ] || echo "Config dir "$CONFIG_DIR" is either not a directory or is not a proper deluge config directory. Exiting" +[ -d "$CONFIG_DIR/plugins" ] || exit 1 +cd $BASEDIR +test -d $BASEDIR/temp || mkdir $BASEDIR/temp +export PYTHONPATH=$BASEDIR/temp +python setup.py build develop --install-dir $BASEDIR/temp +cp $BASEDIR/temp/*.egg-link $CONFIG_DIR/plugins +rm -fr $BASEDIR/temp diff --git a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py index 1badedc..413d259 100644 --- a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py +++ b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py @@ -8,7 +8,6 @@ import pytest import pytest_twisted -import deluge.component as component from deluge.core.core import Core from deluge.core.rpcserver import RPCServer from deluge.tests import common @@ -16,10 +15,9 @@ from deluge.tests import common common.disable_new_release_check() -@pytest.mark.usefixtures('component') class TestWebUIPlugin: @pytest_twisted.async_yield_fixture(autouse=True) - async def set_up(self, request): + async def set_up(self, request, component): self = request.instance self.rpcserver = RPCServer(listen=False) self.core = Core() @@ -27,11 +25,9 @@ class TestWebUIPlugin: yield - def on_shutdown(result): - del self.rpcserver - del self.core - - await component.shutdown().addCallback(on_shutdown) + await component.shutdown() + del self.rpcserver + del self.core def test_enable_webui(self): if 'WebUi' not in self.core.get_available_plugins(): diff --git a/deluge/plugins/pluginbase.py b/deluge/plugins/pluginbase.py index 5dda2f0..8d55156 100644 --- a/deluge/plugins/pluginbase.py +++ b/deluge/plugins/pluginbase.py @@ -14,7 +14,6 @@ log = logging.getLogger(__name__) class PluginBase(component.Component): - update_interval = 1 def __init__(self, name): @@ -35,7 +34,10 @@ class CorePluginBase(PluginBase): log.debug('CorePlugin initialized..') def __del__(self): - component.get('RPCServer').deregister_object(self) + try: + component.get('RPCServer').deregister_object(self) + except KeyError: + log.debug('RPCServer already deregistered') def enable(self): super().enable() @@ -57,7 +59,6 @@ class Gtk3PluginBase(PluginBase): class WebPluginBase(PluginBase): - scripts = [] debug_scripts = [] |