diff --git a/README.md b/README.md index fd9b834..58255a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Description - -This is a [Deluge][1] plugin that allows you to create a list of default trackers +Updated to Python3.7 +This is a updated fork of the [Deluge][1] plugin that allows you to create a list of default trackers that will be added to new public torrents (and old ones after restarting Deluge). The plugin will not duplicate existing trackers and does not care how the torrent was added so it works perfectly fine with infohashes. @@ -8,6 +8,12 @@ was added so it works perfectly fine with infohashes. Private torrents are excluded on purpose, because their metadata is not supposed to reach public trackers. +[download 2.7 here][2] + +[download 3.7 here][3] + +There is also a premade [config][4] for those of us that run cli/headless Based off of this [list][5] from ngosang + Besides manually creating the default tracker list, you can also load it (periodically) from a URL. ## Installation @@ -16,7 +22,7 @@ Besides manually creating the default tracker list, you can also load it (period `python setup.py bdist_egg` -(or try to use [the one from the "egg" directory][2] - be careful to install the py2.7 version of Deluge, if you're using Windows) +(or try to use [the one from the "egg" directory][4] - be careful to install the py2.7 or py3.7 version of Deluge, if you're using Windows) * add it to Deluge from Preferences -> Plugins -> Install Plugin @@ -32,5 +38,8 @@ To get Deluge's output on Windows, run this in a terminal ("cmd" works): * WebUI version [1]: http://deluge-torrent.org/ -[2]: https://github.com/stefantalpalaru/deluge-default-trackers/raw/master/egg/DefaultTrackers-0.1-py2.7.egg +[2]: https://github.com/BigWebstas/deluge-default-trackers/blob/master/egg/DefaultTrackers-0.1-py2.7.egg?raw=true +[3]: https://github.com/BigWebstas/deluge-default-trackers/blob/master/egg/DefaultTrackers-0.1-py3.7.egg?raw=true +[4]: https://github.com/BigWebstas/deluge-default-trackers/tree/master/egg +[5]: https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_all_ip.txt diff --git a/defaulttrackers/__init__.py b/defaulttrackers/__init__.py index 81d6af9..429ad5a 100644 --- a/defaulttrackers/__init__.py +++ b/defaulttrackers/__init__.py @@ -42,18 +42,18 @@ class CorePlugin(PluginInitBase): def __init__(self, plugin_name): - from core import Core as _plugin_cls - self._plugin_cls = _plugin_cls - super(CorePlugin, self).__init__(plugin_name) + from .core import Core as _plugin_cls + self._plugin_cls = _plugin_cls + super(CorePlugin, self).__init__(plugin_name) class GtkUIPlugin(PluginInitBase): def __init__(self, plugin_name): - from gtkui import GtkUI as _plugin_cls + from .gtkui import GtkUI as _plugin_cls self._plugin_cls = _plugin_cls super(GtkUIPlugin, self).__init__(plugin_name) class WebUIPlugin(PluginInitBase): def __init__(self, plugin_name): - from webui import WebUI as _plugin_cls + from .webui import WebUI as _plugin_cls self._plugin_cls = _plugin_cls super(WebUIPlugin, self).__init__(plugin_name) diff --git a/defaulttrackers/core.py b/defaulttrackers/core.py index 9f4b208..227cc58 100644 --- a/defaulttrackers/core.py +++ b/defaulttrackers/core.py @@ -44,7 +44,7 @@ import ssl import time import traceback -import urllib2 +import urllib.request, urllib.error, urllib.parse from deluge.common import is_url from deluge.core.rpcserver import export @@ -94,12 +94,12 @@ def update_trackerlist_from_url(self): 'Accept-Language': 'en-US,en;q=0.8', } - req = urllib2.Request(self.config["dynamic_trackerlist_url"], headers=headers) + req = urllib.request.Request(self.config["dynamic_trackerlist_url"], headers=headers) try: - page = urllib2.urlopen(req, context=ssl._create_unverified_context()).read() + page = urllib.request.urlopen(req, context=ssl._create_unverified_context()).read() except: # maybe an older Python version without a "context" argument - page = urllib2.urlopen(req).read() + page = urllib.request.urlopen(req).read() new_trackers = [url for url in re.findall(r'\w+://[\w\-.:/]+', page) if is_url(url)] if new_trackers: # replace all existing trackers @@ -133,7 +133,7 @@ def on_torrent_added(self, torrent_id, from_state=False): @export def set_config(self, config): """Sets the config dictionary""" - for key in config.keys(): + for key in list(config.keys()): self.config[key] = config[key] self.config.save() diff --git a/defaulttrackers/gtkui.py b/defaulttrackers/gtkui.py index a37ba26..c7f2fad 100644 --- a/defaulttrackers/gtkui.py +++ b/defaulttrackers/gtkui.py @@ -47,7 +47,7 @@ from deluge.ui.gtkui import dialogs #from pprint import pprint -from common import get_resource +from .common import get_resource log = logging.getLogger(__name__) @@ -109,7 +109,7 @@ def on_add(self, widget): if not self.in_store(url): self.gtkui.store.append([url]) self.gtkui.trackers.append({"url": url}) - except Exception, err: + except Exception as err: dialogs.ErrorDialog("Error", str(err), self.dialog).run() def generate_opts(self): @@ -127,7 +127,7 @@ def on_apply(self, widget): options = self.generate_opts() self.gtkui.store[self.item_id][0] = options["urls"][0] self.gtkui.trackers[self.item_index]["url"] = options["urls"][0] - except Exception, err: + except Exception as err: dialogs.ErrorDialog("Error", str(err), self.dialog).run() def on_cancel(self, widget): diff --git a/defaulttrackers/webui.py b/defaulttrackers/webui.py index 7f6dc84..5ae6be2 100644 --- a/defaulttrackers/webui.py +++ b/defaulttrackers/webui.py @@ -43,7 +43,7 @@ from deluge import component from deluge.plugins.pluginbase import WebPluginBase -from common import get_resource +from .common import get_resource log = logging.getLogger(__name__) diff --git a/egg/DefaultTrackers-0.1-py3.7.egg b/egg/DefaultTrackers-0.1-py3.7.egg new file mode 100644 index 0000000..4f40cfc Binary files /dev/null and b/egg/DefaultTrackers-0.1-py3.7.egg differ diff --git a/egg/defaulttrackers.conf b/egg/defaulttrackers.conf new file mode 100644 index 0000000..b00e5d8 --- /dev/null +++ b/egg/defaulttrackers.conf @@ -0,0 +1,109 @@ +{ + "file": 1, + "format": 1 +}{ + "trackers": [ + { + "url": "udp://62.138.0.158:6969/announce" + }, + { + "url": "udp://188.241.58.209:6969/announce" + }, + { + "url": "udp://188.241.58.209:6969/announce" + }, + { + "url": "udp://185.225.17.100:1337/announce" + }, + { + "url": "http://185.225.17.100:1337/announce" + }, + { + "url": "https://104.27.177.131:2053/announce" + }, + { + "url": "https://104.27.139.209:443/announce" + }, + { + "url": "https://172.64.194.3:443/announce" + }, + { + "url": "https://104.31.85.189:443/announce" + }, + { + "url": "https://104.24.120.115:443/announce" + }, + { + "url": "http://85.114.2.27:80/announce" + }, + { + "url": "http://95.107.48.115:80/announce" + }, + { + "url": "http://91.217.91.21:3218/announce" + }, + { + "url": "http://62.210.202.61:80/announce" + }, + { + "url": "http://104.27.139.209:80/announce" + }, + { + "url": "http://172.64.195.3:80/announce" + }, + { + "url": "http://104.28.27.45:2095/announce" + }, + { + "url": "http://45.56.74.11:6969/announce" + }, + { + "url": "http://172.64.134.23:80/announce" + }, + { + "url": "http://62.210.177.88:1096/announce" + }, + { + "url": "http://86.62.124.78:80/announce" + }, + { + "url": "http://199.247.2.19:6969/announce" + }, + { + "url": "udp://198.177.123.165:80/announce" + }, + { + "url": "https://104.24.124.114:443/announce" + }, + { + "url": "https://104.24.127.56:443/announce" + }, + { + "url": "http://198.251.81.243:6699/announce" + }, + { + "url": "http://198.251.81.243:8080/announce" + }, + { + "url": "http://91.207.136.85:80/announce" + }, + { + "url": "http://51.68.41.25:2710/announce" + }, + { + "url": "udp://37.235.174.46:2710/announce" + }, + { + "url": "http://78.30.254.12:2710/announce" + }, + { + "url": "http://176.113.71.19:6961/announce" + }, + { + "url": "http://176.113.68.66:6961/announce" + }, + { + "url": "http://104.24.105.127:8080/announce" + } + ] +} \ No newline at end of file