summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-20 22:07:48 +0200
committerGravatar Armin <Armin@Armin-PC.diedering.lan> 2015-04-20 22:07:48 +0200
commit016fb615d508e16914480fc1298ba95a3a1d4d13 (patch)
treef78d71e539b03cafafd95563fb426b445eadb169
parentfix typo (diff)
downloadpyload-016fb615d508e16914480fc1298ba95a3a1d4d13.tar.xz
add log warnings by using of deprecated features
-rw-r--r--pyload/plugin/Addon.py12
-rw-r--r--pyload/plugin/Extractor.py7
-rw-r--r--pyload/plugin/addon/ExtractArchive.py36
3 files changed, 32 insertions, 23 deletions
diff --git a/pyload/plugin/Addon.py b/pyload/plugin/Addon.py
index bb90428e4..e66c5999e 100644
--- a/pyload/plugin/Addon.py
+++ b/pyload/plugin/Addon.py
@@ -16,7 +16,7 @@ class Expose(object):
def threaded(fn):
- def run(*args,**kwargs):
+ def run(*args, **kwargs):
addonManager.startThread(fn, *args, **kwargs)
return run
@@ -61,16 +61,18 @@ class Addon(Base):
for event, funcs in self.event_map.iteritems():
if type(funcs) in (list, tuple):
for f in funcs:
- self.manager.addEvent(event, getattr(self,f))
+ self.manager.addEvent(event, getattr(self, f))
else:
- self.manager.addEvent(event, getattr(self,funcs))
+ self.manager.addEvent(event, getattr(self, funcs))
#delete for various reasons
self.event_map = None
if self.event_list:
+ self.logWarning(_("Plugin used deprecated 'event_list', use 'event_map' instead"))
+
for f in self.event_list:
- self.manager.addEvent(f, getattr(self,f))
+ self.manager.addEvent(f, getattr(self, f))
self.event_list = None
@@ -109,6 +111,7 @@ class Addon(Base):
def deactivate(self):
""" called when addon was deactivated """
if has_method(self.__class__, "unload"):
+ self.logWarning(_("Deprecated method 'unload()', use deactivate() instead"))
self.unload()
@@ -127,6 +130,7 @@ class Addon(Base):
def activate(self):
""" called when addon was activated """
if has_method(self.__class__, "coreReady"):
+ self.logWarning(_("Deprecated method 'coreReady()', use activate() instead"))
self.coreReady()
diff --git a/pyload/plugin/Extractor.py b/pyload/plugin/Extractor.py
index c0948c3dd..e50ab8818 100644
--- a/pyload/plugin/Extractor.py
+++ b/pyload/plugin/Extractor.py
@@ -27,7 +27,7 @@ class Extractor:
__description = """Base extractor plugin"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ ("Immenz" , "immenz@gmx.net")]
EXTENSIONS = []
@@ -36,6 +36,11 @@ class Extractor:
@classmethod
+ def NAME(self):
+ return getattr(self, "_" + self.__name__ + "__name")
+
+
+ @classmethod
def isArchive(cls, filename):
name = os.path.basename(filename).lower()
return any(name.endswith(ext) for ext in cls.EXTENSIONS)
diff --git a/pyload/plugin/addon/ExtractArchive.py b/pyload/plugin/addon/ExtractArchive.py
index a106d22ab..7002e94f3 100644
--- a/pyload/plugin/addon/ExtractArchive.py
+++ b/pyload/plugin/addon/ExtractArchive.py
@@ -111,28 +111,28 @@ class ExtractArchive(Addon):
__type = "addon"
__version = "1.41"
- __config = [("activated" , "bool" , "Activated" , True ),
- ("fullpath" , "bool" , "Extract with full paths" , True ),
- ("overwrite" , "bool" , "Overwrite files" , False ),
- ("keepbroken" , "bool" , "Try to extract broken archives" , False ),
- ("repair" , "bool" , "Repair broken archives (RAR required)" , False ),
- ("test" , "bool" , "Test archive before extracting" , False ),
- ("usepasswordfile", "bool" , "Use password file" , True ),
- ("passwordfile" , "file" , "Password file" , "archive_password.txt" ),
- ("delete" , "bool" , "Delete archive after extraction" , True ),
- ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True ),
- ("subfolder" , "bool" , "Create subfolder for each package" , False ),
- ("destination" , "folder" , "Extract files to folder" , "" ),
+ __config = [("activated" , "bool" , "Activated" , True),
+ ("fullpath" , "bool" , "Extract with full paths" , True),
+ ("overwrite" , "bool" , "Overwrite files" , False),
+ ("keepbroken" , "bool" , "Try to extract broken archives" , False),
+ ("repair" , "bool" , "Repair broken archives (RAR required)" , False),
+ ("test" , "bool" , "Test archive before extracting" , False),
+ ("usepasswordfile", "bool" , "Use password file" , True),
+ ("passwordfile" , "file" , "Password file" , "archive_password.txt"),
+ ("delete" , "bool" , "Delete archive after extraction" , True),
+ ("deltotrash" , "bool" , "Move to trash (recycle bin) instead delete", True),
+ ("subfolder" , "bool" , "Create subfolder for each package" , False),
+ ("destination" , "folder" , "Extract files to folder" , ""),
("extensions" , "str" , "Extract archives ending with extension" , "7z,bz2,bzip2,gz,gzip,lha,lzh,lzma,rar,tar,taz,tbz,tbz2,tgz,xar,xz,z,zip"),
- ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db" ),
- ("recursive" , "bool" , "Extract archives in archives" , True ),
- ("waitall" , "bool" , "Run after all downloads was processed" , False ),
- ("renice" , "int" , "CPU priority" , 0 )]
+ ("excludefiles" , "str" , "Don't extract the following files" , "*.nfo,*.DS_Store,index.dat,thumb.db"),
+ ("recursive" , "bool" , "Extract archives in archives" , True),
+ ("waitall" , "bool" , "Run after all downloads was processed" , False),
+ ("renice" , "int" , "CPU priority" , 0)]
__description = """Extract different kind of archives"""
__license = "GPLv3"
__authors = [("Walter Purcaro", "vuolter@gmail.com"),
- ("Immenz" , "immenz@gmx.net" )]
+ ("Immenz" , "immenz@gmx.net")]
event_list = ["allDownloadsProcessed", "packageDeleted"]
@@ -186,7 +186,7 @@ class ExtractArchive(Addon):
traceback.print_exc()
if self.extractors:
- self.logDebug(*["Found %s %s" % (Extractor.__name__, Extractor.VERSION) for Extractor in self.extractors])
+ self.logDebug(*["Found %s %s" % (Extractor.NAME(), Extractor.VERSION) for Extractor in self.extractors])
self.extractQueued() #: Resume unfinished extractions
else:
self.logInfo(_("No Extract plugins activated"))