Calum Lind 535b13b5f1 [Plugins] Convert plugins to deluge_ module prefix convention
This commit reverts namespace for the plugins and uses a module prefix
"deluge_" in it's place. The distribution package name remains the same
for now but will also be considered to use a prefix to help find the
third-party plugins e.g. Deluge-{Plugin} and the pluginmanager will
strip the prefix for displaying.

The change is a result of problems trying to package Deluge with
pyinstaller and the pkg_resources namespaces is not compatible.
Testing alternatives to using the pkgutil or PEP420 (native) namespaces
did not yield any joy either as importing eggs with namespaces does not
work. [1]

At this point importable eggs are considered deprecated but there is no
viable alternative yet. [2]

[1] https://github.com/pypa/packaging-problems/issues/212
[2] https://github.com/pypa/packaging-problems/issues/244
2019-05-15 19:20:08 +01:00

51 lines
1.4 KiB
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# -*- coding: utf-8 -*-
#
# Copyright (C) 2008 Martijn Voncken <mvoncken@gmail.com>
#
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
from __future__ import print_function, unicode_literals
from deluge.ui.client import sclient
sclient.set_core_uri()
print(sclient.get_enabled_plugins())
# enable plugin.
if 'label' not in sclient.get_enabled_plugins():
sclient.enable_plugin('label')
# test labels.
print('#init labels')
try:
sclient.label_remove('test')
except Exception:
pass
sess_id = sclient.get_session_state()[0]
print('#add')
sclient.label_add('test')
print('#set')
sclient.label_set_torrent(id, 'test')
print(sclient.get_torrents_status({'label': 'test'}, 'name'))
print('#set options')
sclient.label_set_options('test', {'max_download_speed': 999}, True)
print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '999')
sclient.label_set_options('test', {'max_download_speed': 9}, True)
print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '9')
sclient.label_set_options('test', {'max_download_speed': 888}, False)
print(sclient.get_torrent_status(sess_id, ['max_download_speed']), '9 (888)')
print(sclient.get_torrent_status(sess_id, ['name', 'tracker_host', 'label']))