summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--module/plugins/hooks/AndroidPhoneNotify.py3
-rw-r--r--module/plugins/hooks/AntiStandby.py10
-rw-r--r--module/plugins/hooks/AntiVirus.py3
-rw-r--r--module/plugins/hooks/BypassCaptcha.py5
-rw-r--r--module/plugins/hooks/Captcha9Kw.py3
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py7
-rw-r--r--module/plugins/hooks/Checksum.py11
-rw-r--r--module/plugins/hooks/DeathByCaptcha.py7
-rw-r--r--module/plugins/hooks/DeleteFinished.py12
-rw-r--r--module/plugins/hooks/DownloadScheduler.py3
-rw-r--r--module/plugins/hooks/ExpertDecoders.py5
-rw-r--r--module/plugins/hooks/ExtractArchive.py9
-rw-r--r--module/plugins/hooks/HotFolder.py8
-rw-r--r--module/plugins/hooks/IRCInterface.py7
-rw-r--r--module/plugins/hooks/ImageTyperz.py7
-rw-r--r--module/plugins/hooks/JustPremium.py5
-rw-r--r--module/plugins/hooks/LinkdecrypterComHook.py4
-rw-r--r--module/plugins/hooks/MultiHome.py3
-rw-r--r--module/plugins/hooks/RestartFailed.py10
-rw-r--r--module/plugins/hooks/SkipRev.py3
-rw-r--r--module/plugins/hooks/TransmissionRPC.py3
-rw-r--r--module/plugins/hooks/UpdateManager.py17
-rw-r--r--module/plugins/hooks/WindowsPhoneNotify.py3
-rw-r--r--module/plugins/hooks/XMPPInterface.py7
-rw-r--r--module/plugins/hoster/OboomCom.py5
-rw-r--r--module/plugins/hoster/TurbobitNet.py5
-rw-r--r--module/plugins/internal/Account.py48
-rw-r--r--module/plugins/internal/Addon.py49
-rw-r--r--module/plugins/internal/Base.py22
-rw-r--r--module/plugins/internal/Crypter.py4
-rw-r--r--module/plugins/internal/Hook.py12
-rw-r--r--module/plugins/internal/Hoster.py4
-rw-r--r--module/plugins/internal/Plugin.py12
-rw-r--r--module/plugins/internal/XFSHoster.py5
34 files changed, 201 insertions, 120 deletions
diff --git a/module/plugins/hooks/AndroidPhoneNotify.py b/module/plugins/hooks/AndroidPhoneNotify.py
index aa9bc591b..60e9297e1 100644
--- a/module/plugins/hooks/AndroidPhoneNotify.py
+++ b/module/plugins/hooks/AndroidPhoneNotify.py
@@ -11,7 +11,8 @@ class AndroidPhoneNotify(Addon):
__version__ = "0.11"
__status__ = "testing"
- __config__ = [("apikey" , "str" , "API key" , "" ),
+ __config__ = [("activated" , "bool", "Activated" , False),
+ ("apikey" , "str" , "API key" , "" ),
("notifycaptcha" , "bool", "Notify captcha request" , True ),
("notifypackage" , "bool", "Notify package finished" , True ),
("notifyprocessed", "bool", "Notify packages processed" , True ),
diff --git a/module/plugins/hooks/AntiStandby.py b/module/plugins/hooks/AntiStandby.py
index fbb7f6760..aa7a028a5 100644
--- a/module/plugins/hooks/AntiStandby.py
+++ b/module/plugins/hooks/AntiStandby.py
@@ -27,7 +27,7 @@ class Kernel32(object):
class AntiStandby(Addon):
__name__ = "AntiStandby"
__type__ = "hook"
- __version__ = "0.11"
+ __version__ = "0.12"
__status__ = "testing"
__config__ = [("activated", "bool", "Activated" , True ),
@@ -41,8 +41,9 @@ class AntiStandby(Addon):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- TMP_FILE = ".antistandby"
- MIN_INTERVAL = 5
+ TMP_FILE = ".antistandby"
+
+ PERIODICAL_INTERVAL = 5
def init(self):
@@ -56,8 +57,7 @@ class AntiStandby(Addon):
display = not self.get_config('display')
if hdd:
- self.interval = max(self.get_config('interval'), self.MIN_INTERVAL)
- self.init_periodical(threaded=True)
+ self.start_periodical(self.get_config('interval'), threaded=True)
if os.name is "nt":
self.win_standby(system, display)
diff --git a/module/plugins/hooks/AntiVirus.py b/module/plugins/hooks/AntiVirus.py
index 536675a41..c68e86c77 100644
--- a/module/plugins/hooks/AntiVirus.py
+++ b/module/plugins/hooks/AntiVirus.py
@@ -21,7 +21,8 @@ class AntiVirus(Addon):
__status__ = "testing"
#@TODO: add trash option (use Send2Trash lib)
- __config__ = [("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
+ __config__ = [("activated" , "bool" , "Activated" , False ),
+ ("action" , "Antivirus default;Delete;Quarantine", "Manage infected files" , "Antivirus default"),
("quardir" , "folder" , "Quarantine folder" , "" ),
("deltotrash", "bool" , "Move to trash instead delete", True ),
("scanfailed", "bool" , "Scan failed downloads" , False ),
diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py
index 4b155a67e..a5e424532 100644
--- a/module/plugins/hooks/BypassCaptcha.py
+++ b/module/plugins/hooks/BypassCaptcha.py
@@ -31,8 +31,9 @@ class BypassCaptcha(Hook):
__version__ = "0.08"
__status__ = "testing"
- __config__ = [("passkey" , "password", "Access key" , "" ),
- ("check_client", "bool" , "Don't use if client is connected", True)]
+ __config__ = [("activated" , "bool" , "Activated" , False),
+ ("passkey" , "password", "Access key" , "" ),
+ ("check_client", "bool" , "Don't use if client is connected", True )]
__description__ = """Send captchas to BypassCaptcha.com"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py
index 656497dd6..61b496ec6 100644
--- a/module/plugins/hooks/Captcha9Kw.py
+++ b/module/plugins/hooks/Captcha9Kw.py
@@ -17,7 +17,8 @@ class Captcha9Kw(Hook):
__version__ = "0.30"
__status__ = "testing"
- __config__ = [("check_client" , "bool" , "Don't use if client is connected" , True ),
+ __config__ = [("activated" , "bool" , "Activated" , False ),
+ ("check_client" , "bool" , "Don't use if client is connected" , True ),
("confirm" , "bool" , "Confirm Captcha (cost +6 credits)" , False ),
("captchaperhour", "int" , "Captcha per hour" , "9999" ),
("captchapermin" , "int" , "Captcha per minute" , "9999" ),
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index 838c220f0..a8abb1600 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -41,9 +41,10 @@ class CaptchaBrotherhood(Hook):
__version__ = "0.10"
__status__ = "testing"
- __config__ = [("username" , "str" , "Username" , "" ),
- ("password" , "password", "Password" , "" ),
- ("check_client", "bool" , "Don't use if client is connected", True)]
+ __config__ = [("activated" , "bool" , "Activated" , False),
+ ("username" , "str" , "Username" , "" ),
+ ("password" , "password", "Password" , "" ),
+ ("check_client", "bool" , "Don't use if client is connected", True )]
__description__ = """Send captchas to CaptchaBrotherhood.com"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/Checksum.py b/module/plugins/hooks/Checksum.py
index fe866563d..4d0493212 100644
--- a/module/plugins/hooks/Checksum.py
+++ b/module/plugins/hooks/Checksum.py
@@ -41,11 +41,12 @@ class Checksum(Addon):
__version__ = "0.22"
__status__ = "testing"
- __config__ = [("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ),
- ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"),
- ("max_tries" , "int" , "Number of retries" , 2 ),
- ("retry_action" , "fail;nothing" , "What to do if all retries fail?" , "fail" ),
- ("wait_time" , "int" , "Time to wait before each retry (seconds)" , 1 )]
+ __config__ = [("activated" , "bool" , "Activated" , False ),
+ ("check_checksum", "bool" , "Check checksum? (If False only size will be verified)", True ),
+ ("check_action" , "fail;retry;nothing", "What to do if check fails?" , "retry"),
+ ("max_tries" , "int" , "Number of retries" , 2 ),
+ ("retry_action" , "fail;nothing" , "What to do if all retries fail?" , "fail" ),
+ ("wait_time" , "int" , "Time to wait before each retry (seconds)" , 1 )]
__description__ = """Verify downloaded file size and checksum"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py
index c39cf11da..d3d00affa 100644
--- a/module/plugins/hooks/DeathByCaptcha.py
+++ b/module/plugins/hooks/DeathByCaptcha.py
@@ -54,9 +54,10 @@ class DeathByCaptcha(Hook):
__version__ = "0.08"
__status__ = "testing"
- __config__ = [("username" , "str" , "Username" , "" ),
- ("password" , "password", "Password" , "" ),
- ("check_client", "bool" , "Don't use if client is connected", True)]
+ __config__ = [("activated" , "bool" , "Activated" , False),
+ ("username" , "str" , "Username" , "" ),
+ ("password" , "password", "Password" , "" ),
+ ("check_client", "bool" , "Don't use if client is connected", True )]
__description__ = """Send captchas to DeathByCaptcha.com"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/DeleteFinished.py b/module/plugins/hooks/DeleteFinished.py
index 4c29d5fdf..e72439c0a 100644
--- a/module/plugins/hooks/DeleteFinished.py
+++ b/module/plugins/hooks/DeleteFinished.py
@@ -7,10 +7,11 @@ from module.plugins.internal.Addon import Addon
class DeleteFinished(Addon):
__name__ = "DeleteFinished"
__type__ = "hook"
- __version__ = "1.15"
+ __version__ = "1.16"
__status__ = "testing"
- __config__ = [("interval" , "int" , "Check interval in hours" , 72 ),
+ __config__ = [("activated" , "bool", "Activated" , False),
+ ("interval" , "int" , "Check interval in hours" , 72 ),
("deloffline", "bool", "Delete package with offline links", False)]
__description__ = """Automatically delete all finished packages from queue"""
@@ -18,12 +19,11 @@ class DeleteFinished(Addon):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- MIN_CHECK_INTERVAL = 1 * 60 * 60 #: 1 hour
+ PERIODICAL_INTERVAL = 1 * 60 * 60 #: 1 hour
def activate(self):
- self.interval = self.MIN_CHECK_INTERVAL
- self.init_periodical()
+ self.start_periodical()
def periodical(self):
@@ -43,7 +43,7 @@ class DeleteFinished(Addon):
def activate(self):
self.info['sleep'] = True
- self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60 * 60)
+ self.interval = max(self.PERIODICAL_INTERVAL, self.get_config('interval') * 60 * 60)
self.add_event('package_finished', self.wakeup)
diff --git a/module/plugins/hooks/DownloadScheduler.py b/module/plugins/hooks/DownloadScheduler.py
index b2e804dce..8454438a1 100644
--- a/module/plugins/hooks/DownloadScheduler.py
+++ b/module/plugins/hooks/DownloadScheduler.py
@@ -12,7 +12,8 @@ class DownloadScheduler(Addon):
__version__ = "0.24"
__status__ = "testing"
- __config__ = [("timetable", "str" , "List time periods as hh:mm full or number(kB/s)" , "0:00 full, 7:00 250, 10:00 0, 17:00 150"),
+ __config__ = [("activated", "bool", "Activated" , False ),
+ ("timetable", "str" , "List time periods as hh:mm full or number(kB/s)" , "0:00 full, 7:00 250, 10:00 0, 17:00 150"),
("abort" , "bool", "Abort active downloads when start period with speed 0", False )]
__description__ = """Download Scheduler"""
diff --git a/module/plugins/hooks/ExpertDecoders.py b/module/plugins/hooks/ExpertDecoders.py
index 630382f2d..cdb76a49d 100644
--- a/module/plugins/hooks/ExpertDecoders.py
+++ b/module/plugins/hooks/ExpertDecoders.py
@@ -18,8 +18,9 @@ class ExpertDecoders(Hook):
__version__ = "0.06"
__status__ = "testing"
- __config__ = [("passkey" , "password", "Access key" , "" ),
- ("check_client", "bool" , "Don't use if client is connected", True)]
+ __config__ = [("activated" , "bool" , "Activated" , False),
+ ("passkey" , "password", "Access key" , "" ),
+ ("check_client", "bool" , "Don't use if client is connected", True )]
__description__ = """Send captchas to expertdecoders.com"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/ExtractArchive.py b/module/plugins/hooks/ExtractArchive.py
index 59df2746c..47ed708be 100644
--- a/module/plugins/hooks/ExtractArchive.py
+++ b/module/plugins/hooks/ExtractArchive.py
@@ -143,12 +143,11 @@ class ExtractArchive(Addon):
self.queue = ArchiveQueue(self, "Queue")
self.failed = ArchiveQueue(self, "Failed")
- self.interval = 60
- self.extracting = False
+ self.extracting = False
self.last_package = False
- self.extractors = []
- self.passwords = []
- self.repair = False
+ self.extractors = []
+ self.passwords = []
+ self.repair = False
def activate(self):
diff --git a/module/plugins/hooks/HotFolder.py b/module/plugins/hooks/HotFolder.py
index 6da2d5071..c7631a1fc 100644
--- a/module/plugins/hooks/HotFolder.py
+++ b/module/plugins/hooks/HotFolder.py
@@ -13,10 +13,11 @@ from module.utils import fs_encode, save_join as fs_join
class HotFolder(Addon):
__name__ = "HotFolder"
__type__ = "hook"
- __version__ = "0.18"
+ __version__ = "0.19"
__status__ = "testing"
- __config__ = [("folder" , "str" , "Folder to watch" , "watchdir" ),
+ __config__ = [("activated", "bool", "Activated" , False ),
+ ("folder" , "str" , "Folder to watch" , "watchdir" ),
("watchfile", "bool", "Watch link file" , False ),
("delete" , "bool", "Delete added containers", False ),
("file" , "str" , "Link file" , "links.txt")]
@@ -27,8 +28,7 @@ class HotFolder(Addon):
def activate(self):
- self.interval = 30
- self.init_periodical(threaded=True)
+ self.start_periodical(30, threaded=True)
def periodical(self):
diff --git a/module/plugins/hooks/IRCInterface.py b/module/plugins/hooks/IRCInterface.py
index a3d538272..16640df0b 100644
--- a/module/plugins/hooks/IRCInterface.py
+++ b/module/plugins/hooks/IRCInterface.py
@@ -21,7 +21,8 @@ class IRCInterface(Thread, Addon):
__version__ = "0.17"
__status__ = "testing"
- __config__ = [("host" , "str" , "IRC-Server Address" , "Enter your server here!"),
+ __config__ = [("activated", "bool", "Activated" , False ),
+ ("host" , "str" , "IRC-Server Address" , "Enter your server here!"),
("port" , "int" , "IRC-Server Port" , 6667 ),
("ident" , "str" , "Clients ident" , "pyload-irc" ),
("realname" , "str" , "Realname" , "pyload-irc" ),
@@ -37,9 +38,9 @@ class IRCInterface(Thread, Addon):
__authors__ = [("Jeix", "Jeix@hasnomail.com")]
- def __init__(self, core, manager):
+ def __init__(self, *args, **kwargs):
Thread.__init__(self)
- Addon.__init__(self, core, manager)
+ Addon.__init__(self, *args, **kwargs)
self.setDaemon(True)
diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py
index 85c22f1da..a22ddce7b 100644
--- a/module/plugins/hooks/ImageTyperz.py
+++ b/module/plugins/hooks/ImageTyperz.py
@@ -35,9 +35,10 @@ class ImageTyperz(Hook):
__version__ = "0.08"
__status__ = "testing"
- __config__ = [("username" , "str" , "Username" , "" ),
- ("password" , "password", "Password" , "" ),
- ("check_client", "bool" , "Don't use if client is connected", True)]
+ __config__ = [("activated" , "bool" , "Activated" , False),
+ ("username" , "str" , "Username" , "" ),
+ ("password" , "password", "Password" , "" ),
+ ("check_client", "bool" , "Don't use if client is connected", True )]
__description__ = """Send captchas to ImageTyperz.com"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py
index 69a6a851b..f4c48cfa9 100644
--- a/module/plugins/hooks/JustPremium.py
+++ b/module/plugins/hooks/JustPremium.py
@@ -11,8 +11,9 @@ class JustPremium(Addon):
__version__ = "0.24"
__status__ = "testing"
- __config__ = [("excluded", "str", "Exclude hosters (comma separated)", ""),
- ("included", "str", "Include hosters (comma separated)", "")]
+ __config__ = [("activated", "bool", "Activated" , False),
+ ("excluded" , "str" , "Exclude hosters (comma separated)", "" ),
+ ("included" , "str" , "Include hosters (comma separated)", "" )]
__description__ = """Remove not-premium links from added urls"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/LinkdecrypterComHook.py b/module/plugins/hooks/LinkdecrypterComHook.py
index a318a78fa..2fe780a0c 100644
--- a/module/plugins/hooks/LinkdecrypterComHook.py
+++ b/module/plugins/hooks/LinkdecrypterComHook.py
@@ -8,10 +8,10 @@ from module.plugins.internal.Addon import Addon
class LinkdecrypterComHook(Addon):
__name__ = "LinkdecrypterComHook"
__type__ = "hook"
- __version__ = "1.07"
+ __version__ = "1.08"
__status__ = "testing"
- __config__ = [("activated" , "bool" , "Activated" , True ),
+ __config__ = [("activated" , "bool" , "Activated" , False),
("pluginmode" , "all;listed;unlisted", "Use for plugins" , "all"),
("pluginlist" , "str" , "Plugin list (comma separated)", "" ),
("reload" , "bool" , "Reload plugin list" , True ),
diff --git a/module/plugins/hooks/MultiHome.py b/module/plugins/hooks/MultiHome.py
index b1e3c8ada..90e8a60d2 100644
--- a/module/plugins/hooks/MultiHome.py
+++ b/module/plugins/hooks/MultiHome.py
@@ -47,7 +47,8 @@ class MultiHome(Addon):
__version__ = "0.14"
__status__ = "testing"
- __config__ = [("interfaces", "str", "Interfaces", "None")]
+ __config__ = [("activated" , "bool", "Activated" , False ),
+ ("interfaces", "str" , "Interfaces", "None")]
__description__ = """IP address changer"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/RestartFailed.py b/module/plugins/hooks/RestartFailed.py
index e1498b0ae..74d570425 100644
--- a/module/plugins/hooks/RestartFailed.py
+++ b/module/plugins/hooks/RestartFailed.py
@@ -6,17 +6,18 @@ from module.plugins.internal.Addon import Addon
class RestartFailed(Addon):
__name__ = "RestartFailed"
__type__ = "hook"
- __version__ = "1.61"
+ __version__ = "1.62"
__status__ = "testing"
- __config__ = [("interval", "int", "Check interval in minutes", 90)]
+ __config__ = [("activated", "bool", "Activated" , False),
+ ("interval" , "int" , "Check interval in minutes", 90 )]
__description__ = """Restart all the failed downloads in queue"""
__license__ = "GPLv3"
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- MIN_CHECK_INTERVAL = 15 * 60 #: 15 minutes
+ PERIODICAL_INTERVAL = 15 * 60 #: 15 minutes
def periodical(self):
@@ -25,5 +26,4 @@ class RestartFailed(Addon):
def activate(self):
- self.interval = max(self.MIN_CHECK_INTERVAL, self.get_config('interval') * 60)
- self.init_periodical()
+ self.start_periodical(self.get_config('interval') * 60)
diff --git a/module/plugins/hooks/SkipRev.py b/module/plugins/hooks/SkipRev.py
index 1e0a495b4..891d2db6d 100644
--- a/module/plugins/hooks/SkipRev.py
+++ b/module/plugins/hooks/SkipRev.py
@@ -15,7 +15,8 @@ class SkipRev(Addon):
__version__ = "0.34"
__status__ = "testing"
- __config__ = [("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"),
+ __config__ = [("activated", "bool" , "Activated" , False ),
+ ("mode" , "Auto;Manual", "Choose recovery archives to skip" , "Auto"),
("revtokeep", "int" , "Number of recovery archives to keep for package", 0 )]
__description__ = """Skip recovery archives (.rev)"""
diff --git a/module/plugins/hooks/TransmissionRPC.py b/module/plugins/hooks/TransmissionRPC.py
index 5fdbf6402..7d3e24661 100644
--- a/module/plugins/hooks/TransmissionRPC.py
+++ b/module/plugins/hooks/TransmissionRPC.py
@@ -18,7 +18,8 @@ class TransmissionRPC(Addon):
__status__ = "testing"
__pattern__ = r"https?://.+\.torrent|magnet:\?.+"
- __config__ = [("rpc_url", "str", "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")]
+ __config__ = [("activated", "bool", "Activated" , False ),
+ ("rpc_url" , "str" , "Transmission RPC URL", "http://127.0.0.1:9091/transmission/rpc")]
__description__ = """Send torrent and magnet URLs to Transmission Bittorent daemon via RPC"""
__license__ = "GPLv3"
diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py
index 330269397..872d4eb40 100644
--- a/module/plugins/hooks/UpdateManager.py
+++ b/module/plugins/hooks/UpdateManager.py
@@ -16,7 +16,7 @@ from module.utils import fs_encode, save_join as fs_join
class UpdateManager(Addon):
__name__ = "UpdateManager"
__type__ = "hook"
- __version__ = "0.56"
+ __version__ = "0.57"
__status__ = "testing"
__config__ = [("activated" , "bool", "Activated" , True ),
@@ -32,10 +32,8 @@ class UpdateManager(Addon):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- interval = 0
-
SERVER_URL = "http://updatemanager.pyload.org"
- MIN_CHECK_INTERVAL = 3 * 60 * 60 #: 3 hours
+ PERIODICAL_INTERVAL = 3 * 60 * 60 #: 3 hours
def activate(self):
@@ -45,17 +43,14 @@ class UpdateManager(Addon):
if self.do_restart is False:
self.pyload.api.unpauseServer()
- self.init_periodical()
+ self.start_periodical(10)
def init(self):
- self.info = {'pyload': False, 'version': None, 'plugins': False, 'last_check': time.time()}
- self.mtimes = {} #: Store modification time for each plugin
-
+ self.info = {'pyload': False, 'version': None, 'plugins': False, 'last_check': time.time()}
+ self.mtimes = {} #: Store modification time for each plugin
self.event_map = {'allDownloadsProcessed': "all_downloads_processed"}
- self.interval = 10
-
if self.get_config('checkonstart'):
self.pyload.api.pauseServer()
self.checkonstart = True
@@ -80,7 +75,7 @@ class UpdateManager(Addon):
return
if self.get_config('checkperiod') and \
- time.time() - max(self.MIN_CHECK_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']:
+ time.time() - max(self.PERIODICAL_INTERVAL, self.get_config('checkinterval') * 60 * 60) > self.info['last_check']:
self.update()
diff --git a/module/plugins/hooks/WindowsPhoneNotify.py b/module/plugins/hooks/WindowsPhoneNotify.py
index 52fff88b8..4343d16f2 100644
--- a/module/plugins/hooks/WindowsPhoneNotify.py
+++ b/module/plugins/hooks/WindowsPhoneNotify.py
@@ -12,7 +12,8 @@ class WindowsPhoneNotify(Addon):
__version__ = "0.13"
__status__ = "testing"
- __config__ = [("push-id" , "str" , "Push ID" , "" ),
+ __config__ = [("activated" , "bool", "Activated" , False),
+ ("push-id" , "str" , "Push ID" , "" ),
("push-url" , "str" , "Push url" , "" ),
("notifycaptcha" , "bool", "Notify captcha request" , True ),
("notifypackage" , "bool", "Notify package finished" , True ),
diff --git a/module/plugins/hooks/XMPPInterface.py b/module/plugins/hooks/XMPPInterface.py
index f6e7020cd..811e2f5f4 100644
--- a/module/plugins/hooks/XMPPInterface.py
+++ b/module/plugins/hooks/XMPPInterface.py
@@ -15,7 +15,8 @@ class XMPPInterface(IRCInterface, JabberClient):
__version__ = "0.13"
__status__ = "testing"
- __config__ = [("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ),
+ __config__ = [("activated", "bool", "Activated" , False ),
+ ("jid" , "str" , "Jabber ID" , "user@exmaple-jabber-server.org" ),
("pw" , "str" , "Password" , "" ),
("tls" , "bool", "Use TLS" , False ),
("owners" , "str" , "List of JIDs accepting commands from", "me@icq-gateway.org;some@msn-gateway.org"),
@@ -31,8 +32,8 @@ class XMPPInterface(IRCInterface, JabberClient):
implements(IMessageHandlersProvider)
- def __init__(self, core, manager):
- IRCInterface.__init__(self, core, manager)
+ def __init__(self, *args, **kwargs):
+ IRCInterface.__init__(self, *args, **kwargs)
self.jid = JID(self.get_config('jid'))
password = self.get_config('pw')
diff --git a/module/plugins/hoster/OboomCom.py b/module/plugins/hoster/OboomCom.py
index 77cf6b68f..fd1f26874 100644
--- a/module/plugins/hoster/OboomCom.py
+++ b/module/plugins/hoster/OboomCom.py
@@ -13,7 +13,7 @@ from module.plugins.captcha.ReCaptcha import ReCaptcha
class OboomCom(Hoster):
__name__ = "OboomCom"
__type__ = "hoster"
- __version__ = "0.38"
+ __version__ = "0.39"
__status__ = "testing"
__pattern__ = r'https?://(?:www\.)?oboom\.com/(?:#(?:id=|/)?)?(?P<ID>\w{8})'
@@ -95,7 +95,8 @@ class OboomCom(Hoster):
if result[1] == -1: #: Another download is running
self.set_wait(15 * 60)
else:
- self.set_wait(result[1], True)
+ self.set_wait(result[1])
+ self.set_reconnect(True)
self.wait()
self.retry(5)
diff --git a/module/plugins/hoster/TurbobitNet.py b/module/plugins/hoster/TurbobitNet.py
index 6d83c3b56..95de33a3f 100644
--- a/module/plugins/hoster/TurbobitNet.py
+++ b/module/plugins/hoster/TurbobitNet.py
@@ -17,7 +17,7 @@ from module.plugins.internal.SimpleHoster import SimpleHoster, create_getInfo
class TurbobitNet(SimpleHoster):
__name__ = "TurbobitNet"
__type__ = "hoster"
- __version__ = "0.22"
+ __version__ = "0.23"
__status__ = "testing"
__pattern__ = r'http://(?:www\.)?turbobit\.net/(?:download/free/)?(?P<ID>\w+)'
@@ -130,7 +130,8 @@ class TurbobitNet(SimpleHoster):
fun = self.load(url)
- self.set_wait(65, False)
+ self.set_wait(65)
+ self.set_reconnect(False)
for b in [1, 3]:
self.jscode = "var id = \'%s\';var b = %d;var inn = \'%s\';%sout" % (
diff --git a/module/plugins/internal/Account.py b/module/plugins/internal/Account.py
index 1034fec19..20ecf6afd 100644
--- a/module/plugins/internal/Account.py
+++ b/module/plugins/internal/Account.py
@@ -13,7 +13,7 @@ from module.utils import compare_time, lock
class Account(Plugin):
__name__ = "Account"
__type__ = "account"
- __version__ = "0.56"
+ __version__ = "0.57"
__status__ = "testing"
__description__ = """Base account plugin"""
@@ -21,8 +21,10 @@ class Account(Plugin):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- LOGIN_TIMEOUT = 30 * 60 #: Relogin accounts every 30 minutes
- AUTO_INTERVAL = True #: Automatically adjust relogin interval
+ LOGIN_TIMEOUT = 30 * 60 #: Relogin account every 30 minutes
+ TUNE_TIMEOUT = True #: Automatically tune relogin interval
+
+ PERIODICAL_INTERVAL = None
def __init__(self, manager, accounts):
@@ -38,7 +40,7 @@ class Account(Plugin):
#: Callback of periodical job task
self.cb = None
- self.interval = self.LOGIN_TIMEOUT
+ self.interval = None
self.init()
@@ -50,22 +52,46 @@ class Account(Plugin):
pass
- def init_periodical(self, delay=0, threaded=False):
- self.cb = self.pyload.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
+ def set_interval(self, value):
+ newinterval = max(0, self.PERIODICAL_INTERVAL, value)
+ if newinterval != value:
+ return False
- def _periodical(self, threaded):
- if self.interval < 0:
+ if newinterval != self.interval:
+ self.interval = newinterval
+
+ return True
+
+
+ def start_periodical(self, interval=None, threaded=False, delay=0):
+ if interval is not None and self.set_interval(interval) is False:
+ return False
+ else:
+ self.cb = self.pyload.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
+ return True
+
+
+ def restart_periodical(self, *args, **kwargs):
+ self.stop_periodical()
+ return self.start_periodical(*args, **kwargs)
+
+
+ def stop_periodical(self):
+ try:
+ return self.pyload.scheduler.removeJob(self.cb)
+ finally:
self.cb = None
- return
+
+ def _periodical(self, threaded):
try:
self.periodical()
except Exception, e:
self.log_error(_("Error executing periodical task: %s") % e, trace=True)
- self.init_periodical(self.interval, threaded)
+ self.restart_periodical(self.interval, threaded)
def periodical(self):
@@ -121,7 +147,7 @@ class Account(Plugin):
self.info['login']['valid'] = True
new_timeout = timestamp - self.info['login']['timestamp']
- if self.AUTO_INTERVAL and new_timeout > self.timeout:
+ if self.TUNE_TIMEOUT and new_timeout > self.timeout:
self.timeout = new_timeout
except Exception, e:
diff --git a/module/plugins/internal/Addon.py b/module/plugins/internal/Addon.py
index c6e7ea7b8..32344191a 100644
--- a/module/plugins/internal/Addon.py
+++ b/module/plugins/internal/Addon.py
@@ -23,7 +23,7 @@ def threaded(fn):
class Addon(Plugin):
__name__ = "Addon"
__type__ = "hook" #@TODO: Change to `addon` in 0.4.10
- __version__ = "0.08"
+ __version__ = "0.10"
__status__ = "testing"
__threaded__ = [] #@TODO: Remove in 0.4.10
@@ -33,6 +33,9 @@ class Addon(Plugin):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
+ PERIODICAL_INTERVAL = None
+
+
def __init__(self, core, manager):
self._init(core)
@@ -50,7 +53,7 @@ class Addon(Plugin):
#: Callback of periodical job task, used by HookManager
self.cb = None
- self.interval = 60
+ self.interval = None
self.init()
self.init_events()
@@ -83,27 +86,51 @@ class Addon(Plugin):
self.event_list = None
- def init_periodical(self, delay=0, threaded=False):
- self.cb = self.pyload.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
+ def set_interval(self, value):
+ newinterval = max(0, self.PERIODICAL_INTERVAL, value)
+ if newinterval != value:
+ return False
- #: Deprecated method, use `init_periodical` instead (Remove in 0.4.10)
- def initPeriodical(self, *args, **kwargs):
- return self.init_periodical(*args, **kwargs)
+ if newinterval != self.interval:
+ self.interval = newinterval
+ return True
- def _periodical(self, threaded):
- if self.interval < 0:
+
+ def start_periodical(self, interval=None, threaded=False, delay=0):
+ if interval is not None and self.set_interval(interval) is False:
+ return False
+ else:
+ self.cb = self.pyload.scheduler.addJob(max(0, delay), self._periodical, [threaded], threaded=threaded)
+ return True
+
+
+ def restart_periodical(self, *args, **kwargs):
+ self.stop_periodical()
+ return self.start_periodical(*args, **kwargs)
+
+
+ def stop_periodical(self):
+ try:
+ return self.pyload.scheduler.removeJob(self.cb)
+ finally:
self.cb = None
- return
+
+ #: Deprecated method, use `start_periodical` instead (Remove in 0.4.10)
+ def initPeriodical(self, *args, **kwargs):
+ return self.start_periodical(*args, **kwargs)
+
+
+ def _periodical(self, threaded):
try:
self.periodical()
except Exception, e:
self.log_error(_("Error executing periodical task: %s") % e, trace=True)
- self.init_periodical(self.interval, threaded)
+ self.restart_periodical(self.interval, threaded)
def periodical(self):
diff --git a/module/plugins/internal/Base.py b/module/plugins/internal/Base.py
index 1b2987322..46502a9d3 100644
--- a/module/plugins/internal/Base.py
+++ b/module/plugins/internal/Base.py
@@ -52,7 +52,7 @@ def check_abort(fn):
class Base(Plugin):
__name__ = "Base"
__type__ = "base"
- __version__ = "0.04"
+ __version__ = "0.05"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -212,25 +212,29 @@ class Base(Plugin):
self.log_debug("RECONNECT %s required" % ("" if reconnect else "not"),
"Previous wantReconnect: %s" % self.wantReconnect)
self.wantReconnect = bool(reconnect)
+ return True
- def set_wait(self, seconds, reconnect=None):
+ def set_wait(self, seconds, strict=False):
"""
Set a specific wait time later used with `wait`
:param seconds: wait time in seconds
:param reconnect: True if a reconnect would avoid wait time
"""
- wait_time = max(int(seconds), 1)
- wait_until = time.time() + wait_time + 1
+ wait_time = float(seconds)
- self.log_debug("WAIT set to %d seconds" % wait_time,
- "Previous waitUntil: %f" % self.pyfile.waitUntil)
+ if wait_time < 0:
+ return False
- self.pyfile.waitUntil = wait_until
+ old_wait_until = self.pyfile.waitUntil
+ new_wait_until = time.time() + wait_time + float(not strict)
- if reconnect is not None:
- self.set_reconnect(reconnect)
+ self.log_debug("WAIT set to timestamp %f" % new_wait_until,
+ "Previous waitUntil: %f" % old_wait_until)
+
+ self.pyfile.waitUntil = new_wait_until
+ return True
def wait(self, seconds=None, reconnect=None):
diff --git a/module/plugins/internal/Crypter.py b/module/plugins/internal/Crypter.py
index cc1eeb5fd..db13e445c 100644
--- a/module/plugins/internal/Crypter.py
+++ b/module/plugins/internal/Crypter.py
@@ -20,8 +20,8 @@ class Crypter(Base):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- def __init__(self, pyfile):
- super(Crypter, self).__init__(pyfile)
+ def __init__(self, *args, **kwargs):
+ super(Crypter, self).__init__(*args, **kwargs)
#: Put all packages here. It's a list of tuples like: ( name, [list of links], folder )
self.packages = []
diff --git a/module/plugins/internal/Hook.py b/module/plugins/internal/Hook.py
index 6ead5cf0b..f1308c25b 100644
--- a/module/plugins/internal/Hook.py
+++ b/module/plugins/internal/Hook.py
@@ -6,7 +6,7 @@ from module.plugins.internal.Addon import Addon, threaded
class Hook(Addon):
__name__ = "Hook"
__type__ = "hook"
- __version__ = "0.14"
+ __version__ = "0.16"
__status__ = "testing"
__description__ = """Base hook plugin"""
@@ -16,9 +16,13 @@ class Hook(Addon):
("Walter Purcaro", "vuolter@gmail.com")]
- def __init__(self, core, manager):
- super(Hook, self).__init__(core, manager)
- self.init_periodical(10)
+ PERIODICAL_INTERVAL = 10
+
+
+ def __init__(self, *args, **kwargs):
+ super(Hook, self).__init__(*args, **kwargs)
+ if self.PERIODICAL_INTERVAL:
+ self.start_periodical(self.PERIODICAL_INTERVAL)
#@TODO: Remove in 0.4.10
diff --git a/module/plugins/internal/Hoster.py b/module/plugins/internal/Hoster.py
index 96d0b86f3..09466465d 100644
--- a/module/plugins/internal/Hoster.py
+++ b/module/plugins/internal/Hoster.py
@@ -26,8 +26,8 @@ class Hoster(Base):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- def __init__(self, pyfile):
- super(Hoster, self).__init__(pyfile)
+ def __init__(self, *args, **kwargs):
+ super(Hoster, self).__init__(*args, **kwargs)
#: Enable simultaneous processing of multiple downloads
self.limitDL = 0 #@TODO: Change to `limit_dl` in 0.4.10
diff --git a/module/plugins/internal/Plugin.py b/module/plugins/internal/Plugin.py
index 61f219556..7bfdd588c 100644
--- a/module/plugins/internal/Plugin.py
+++ b/module/plugins/internal/Plugin.py
@@ -142,13 +142,19 @@ def which(program):
return exe_file
-def seconds_to_midnight(utc=None):
+def seconds_to_nexthour(strict=False):
+ now = datetime.datetime.today()
+ nexthour = now.replace(minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(hours=1)
+ return (nexthour - now).seconds
+
+
+def seconds_to_midnight(utc=None, strict=False):
if utc is None:
now = datetime.datetime.today()
else:
now = datetime.datetime.utcnow() + datetime.timedelta(hours=utc)
- midnight = now.replace(hour=0, minute=1, second=0, microsecond=0) + datetime.timedelta(days=1)
+ midnight = now.replace(hour=0, minute=0 if strict else 1, second=0, microsecond=0) + datetime.timedelta(days=1)
return (midnight - now).seconds
@@ -226,7 +232,7 @@ def chunks(iterable, size):
class Plugin(object):
__name__ = "Plugin"
__type__ = "plugin"
- __version__ = "0.50"
+ __version__ = "0.51"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
diff --git a/module/plugins/internal/XFSHoster.py b/module/plugins/internal/XFSHoster.py
index 99a091129..2e9cbceb2 100644
--- a/module/plugins/internal/XFSHoster.py
+++ b/module/plugins/internal/XFSHoster.py
@@ -14,7 +14,7 @@ from module.utils import html_unescape
class XFSHoster(SimpleHoster):
__name__ = "XFSHoster"
__type__ = "hoster"
- __version__ = "0.64"
+ __version__ = "0.65"
__status__ = "testing"
__pattern__ = r'^unmatchable$'
@@ -217,7 +217,8 @@ class XFSHoster(SimpleHoster):
m = re.search(self.WAIT_PATTERN, self.html)
if m is not None:
wait_time = int(m.group(1))
- self.set_wait(wait_time, False)
+ self.set_wait(wait_time)
+ self.set_reconnect(False)
self.handle_captcha(inputs)
self.wait()