From 5db85c41e9f92b35d71396f8bf12ad84f37127f6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 4 Oct 2015 20:24:30 +0200 Subject: Small code cosmetics --- module/plugins/hooks/AndroidPhoneNotify.py | 6 +++--- module/plugins/hooks/DeleteFinished.py | 8 -------- module/plugins/hooks/ExternalScripts.py | 15 +++++++++------ module/plugins/hooks/ExtractArchive.py | 4 ++-- module/plugins/hooks/WindowsPhoneNotify.py | 6 +++--- module/plugins/hooks/XFileSharingPro.py | 12 ++---------- 6 files changed, 19 insertions(+), 32 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py index f79f226e4..aa9bc591b 100644 --- a/module/plugins/hooks/AndroidPhoneNotify.py +++ b/module/plugins/hooks/AndroidPhoneNotify.py @@ -8,7 +8,7 @@ from module.plugins.internal.Addon import Addon, Expose class AndroidPhoneNotify(Addon): __name__ = "AndroidPhoneNotify" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("apikey" , "str" , "API key" , "" ), @@ -28,8 +28,8 @@ class AndroidPhoneNotify(Addon): def init(self): - self.event_list = ["plugin_updated"] - self.event_map = {'allDownloadsProcessed': "all_downloads_processed"} + self.event_map = {'allDownloadsProcessed': "all_downloads_processed", + 'plugin_updated' : "plugin_updated" } self.last_notify = 0 self.notifications = 0 diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py index a38966476..4c29d5fdf 100644 --- a/module/plugins/hooks/DeleteFinished.py +++ b/module/plugins/hooks/DeleteFinished.py @@ -37,20 +37,12 @@ class DeleteFinished(Addon): self.add_event('package_finished', self.wakeup) - # def plugin_config_changed(self, plugin, name, value): - # if name == "interval" and value is not self.interval: - # self.interval = value * 3600 - # self.init_periodical() - - def deactivate(self): self.manager.removeEvent('package_finished', self.wakeup) def activate(self): self.info['sleep'] = True - # interval = self.get_config('interval') - # self.plugin_config_changed(self.__name__, 'interval', interval) self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60 * 60) self.add_event('package_finished', self.wakeup) diff --git a/module/plugins/hooks/ExternalScripts.py b/module/plugins/hooks/ExternalScripts.py index 09fe59d0a..3459eb3aa 100644 --- a/module/plugins/hooks/ExternalScripts.py +++ b/module/plugins/hooks/ExternalScripts.py @@ -28,12 +28,15 @@ class ExternalScripts(Addon): def init(self): self.scripts = {} - self.event_list = ["archive_extract_failed", "archive_extracted" , - "package_extract_failed", "package_extracted" , - "all_archives_extracted", "all_archives_processed"] - self.event_map = {'allDownloadsFinished' : "all_downloads_finished" , - 'allDownloadsProcessed': "all_downloads_processed", - 'packageDeleted' : "package_deleted" } + self.event_map = {'allDownloadsFinished' : "all_downloads_finished" , + 'allDownloadsProcessed' : "all_downloads_processed", + 'packageDeleted' : "package_deleted" , + 'archive_extract_failed': "archive_extract_failed" , + 'archive_extracted' : "archive_extracted" , + 'package_extract_failed': "package_extract_failed" , + 'package_extracted' : "package_extracted" , + 'all_archives_extracted': "all_archives_extracted" , + 'all_archives_processed': "all_archives_processed" } folders = ["pyload_start", "pyload_restart", "pyload_stop", "before_reconnect", "after_reconnect", diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py index 9c662a897..59df2746c 100644 --- a/module/plugins/hooks/ExtractArchive.py +++ b/module/plugins/hooks/ExtractArchive.py @@ -137,8 +137,8 @@ class ExtractArchive(Addon): def init(self): - self.event_map = {'allDownloadsProcessed': "all_downloads_processed", - 'packageDeleted' : "package_deleted" } + self.event_map = {'allDownloadsProcessed': "all_downloads_processed", + 'packageDeleted' : "package_deleted" } self.queue = ArchiveQueue(self, "Queue") self.failed = ArchiveQueue(self, "Failed") diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py index 900d94a04..52fff88b8 100644 --- a/module/plugins/hooks/WindowsPhoneNotify.py +++ b/module/plugins/hooks/WindowsPhoneNotify.py @@ -9,7 +9,7 @@ from module.plugins.internal.Addon import Addon, Expose class WindowsPhoneNotify(Addon): __name__ = "WindowsPhoneNotify" __type__ = "hook" - __version__ = "0.12" + __version__ = "0.13" __status__ = "testing" __config__ = [("push-id" , "str" , "Push ID" , "" ), @@ -30,8 +30,8 @@ class WindowsPhoneNotify(Addon): def init(self): - self.event_list = ["plugin_updated"] - self.event_map = {'allDownloadsProcessed': "all_downloads_processed"} + self.event_map = {'allDownloadsProcessed': "all_downloads_processed", + 'plugin_updated' : "plugin_updated" } self.last_notify = 0 self.notifications = 0 diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py index 70bafba67..a96074328 100644 --- a/module/plugins/hooks/XFileSharingPro.py +++ b/module/plugins/hooks/XFileSharingPro.py @@ -23,9 +23,9 @@ class XFileSharingPro(Hook): __authors__ = [("Walter Purcaro", "vuolter@gmail.com")] - regexp = {'hoster' : (r'https?://(?:www\.)?(?:\w+\.)*?(?P(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', + regexp = {'hoster' : (r'https?://(?:www\.)?(?:\w+\.)*?(?P(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)', r'https?://(?:[^/]+\.)?(?P%s)/(?:embed-)?\w+'), - 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P(?:[\d.]+|[\w\-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', + 'crypter': (r'https?://(?:www\.)?(?:\w+\.)*?(?P(?:[\d.]+|[\w-^_]{3,}(?:\.[a-zA-Z]{2,}){1,2})(?:\:\d+)?)/(?:user|folder)s?/\w+', r'https?://(?:[^/]+\.)?(?P%s)/(?:user|folder)s?/\w+')} BUILTIN_HOSTERS = [#WORKING HOSTERS: @@ -46,14 +46,6 @@ class XFileSharingPro(Hook): BUILTIN_CRYPTERS = ["junocloud.me", "rapidfileshare.net"] - # def plugin_config_changed(self, plugin, name, value): - # self.load_pattern() - - - # def init(self): - # self.event_map = {'pluginConfigChanged': "plugin_config_changed"} - - def activate(self): self.load_pattern() -- cgit v1.2.3