Skip to content

Commit 270c1ee

Browse files
committed
Revert fcead18
1 parent 8e7d14b commit 270c1ee

470 files changed

Lines changed: 3372 additions & 3382 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/write_addons.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ All addons should start with something like this: ::
1919
from pyload.plugin.Addon import Addon
2020

2121
class YourAddon(Addon):
22-
__name__ = "YourAddon"
23-
__version__ = "0.1"
24-
__description__ = "Does really cool stuff"
25-
__config__ = [ ("activated" , "bool" , "Activated" , "True" ) ]
22+
__name = "YourAddon"
23+
__version = "0.1"
24+
__description = "Does really cool stuff"
25+
__config = [ ("activated" , "bool" , "Activated" , "True" ) ]
2626
__author_name__ = ("Me")
2727
__author_mail__ = ("me@has-no-mail.com")
2828

29-
All meta-data is defined in the header, you need at least one option at ``__config__`` so the user can toggle your
29+
All meta-data is defined in the header, you need at least one option at ``__config`` so the user can toggle your
3030
addon on and off. Dont't overwrite the ``init`` method if not neccesary, use ``setup`` instead.
3131

3232
Using the Config
3333
----------------
3434

35-
We are taking a closer look at the ``__config__`` parameter.
35+
We are taking a closer look at the ``__config`` parameter.
3636
You can add more config values as desired by adding tuples of the following format to the config list: ``("name", "type", "description", "default value")``.
3737
When everything went right you can access the config values with ``self.getConfig(name)`` and ``self.setConfig(name, value``.
3838

docs/write_plugins.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ There are three kinds of different plugins: **Hoster**, **Crypter**, **Container
1010
All kind of plugins inherit from the base :class:`Plugin <pyload.plugin.Plugin.Plugin>`. You should know its
1111
convenient methods, they make your work easier ;-)
1212

13-
Every plugin defines a ``__pattern__`` and when the user adds urls, every url is matched against the pattern defined in
14-
the plugin. In case the ``__pattern__`` matched on the url the plugin will be assigned to handle it and instanciated when
13+
Every plugin defines a ``__pattern`` and when the user adds urls, every url is matched against the pattern defined in
14+
the plugin. In case the ``__pattern`` matched on the url the plugin will be assigned to handle it and instanciated when
1515
pyLoad begins to download/decrypt the url.
1616

1717
Plugin header
@@ -22,13 +22,13 @@ How basic hoster plugin header could look like: ::
2222
from pyload.plugin.Hoster import Hoster
2323

2424
class MyFileHoster(Hoster):
25-
__name__ = "MyFileHoster"
26-
__version__ = "0.1"
27-
__pattern__ = r"http://myfilehoster.example.com/file_id/[0-9]+"
28-
__config__ = []
25+
__name = "MyFileHoster"
26+
__version = "0.1"
27+
__pattern = r"http://myfilehoster.example.com/file_id/[0-9]+"
28+
__config = []
2929

30-
You have to define these meta-data, ``__pattern__`` has to be a regexp that sucessfully compiles with
31-
``re.compile(__pattern__)``.
30+
You have to define these meta-data, ``__pattern`` has to be a regexp that sucessfully compiles with
31+
``re.compile(__pattern)``.
3232

3333
Just like :ref:`write_addons` you can add and use config values exatly the same way.
3434
If you want a Crypter or Container plugin, just replace the word Hoster with your desired plugin type.

pyload/manager/Account.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def getAccountInfos(self, force=True, refresh=False):
176176
if self.accounts[p]:
177177
p = self.getAccountPlugin(p)
178178
if p:
179-
data[p.__name__] = p.getAllAccounts(force)
179+
data[p.__name] = p.getAllAccounts(force)
180180
else: #@NOTE: When an account has been skipped, p is None
181181
data[p] = []
182182
else:

pyload/manager/Addon.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,17 @@ def createIndex(self):
105105

106106
for pluginname in self.core.pluginManager.addonPlugins:
107107
try:
108-
# hookClass = getattr(plugin, plugin.__name__)
108+
# hookClass = getattr(plugin, plugin.__name)
109109
if self.core.config.getPlugin(pluginname, "activated"):
110110
pluginClass = self.core.pluginManager.loadClass("addon", pluginname)
111111
if not pluginClass:
112112
continue
113113

114114
plugin = pluginClass(self.core, self)
115115
plugins.append(plugin)
116-
self.pluginMap[pluginClass.__name__] = plugin
116+
self.pluginMap[pluginClass.__name] = plugin
117117
if plugin.isActivated():
118-
active.append(pluginClass.__name__)
118+
active.append(pluginClass.__name)
119119
else:
120120
deactive.append(pluginname)
121121

@@ -141,7 +141,7 @@ def manageAddon(self, plugin, name, value):
141141
def activateAddon(self, pluginname):
142142
# check if already loaded
143143
for inst in self.plugins:
144-
if inst.__name__ == pluginname:
144+
if inst.__name == pluginname:
145145
return
146146

147147
pluginClass = self.core.pluginManager.loadClass("addon", pluginname)
@@ -153,14 +153,14 @@ def activateAddon(self, pluginname):
153153

154154
addon = pluginClass(self.core, self)
155155
self.plugins.append(addon)
156-
self.pluginMap[pluginClass.__name__] = addon
156+
self.pluginMap[pluginClass.__name] = addon
157157

158158
addon.activate()
159159

160160

161161
def deactivateAddon(self, pluginname):
162162
for plugin in self.plugins:
163-
if plugin.__name__ == pluginname:
163+
if plugin.__name == pluginname:
164164
addon = plugin
165165
break
166166
else:
@@ -174,7 +174,7 @@ def deactivateAddon(self, pluginname):
174174
self.core.log.debug("Removed callback: %s" % self.core.scheduler.removeJob(addon.cb))
175175

176176
self.plugins.remove(addon)
177-
del self.pluginMap[addon.__name__]
177+
del self.pluginMap[addon.__name]
178178

179179

180180
@try_catch

pyload/manager/Plugin.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class PluginManager(object):
2020
USERROOT = "userplugins."
2121
TYPES = ["account", "addon", "container", "crypter", "hook", "hoster", "internal", "ocr"]
2222

23-
PATTERN = re.compile(r'__pattern__\s*=\s*u?r("|\')([^"\']+)')
24-
VERSION = re.compile(r'__version__\s*=\s*("|\')([\d.]+)')
25-
CONFIG = re.compile(r'__config__\s*=\s*\[([^\]]+)', re.M)
26-
DESC = re.compile(r'__description__\s*=\s*("|"""|\')([^"\']+)')
23+
PATTERN = re.compile(r'__pattern\s*=\s*u?r("|\')([^"\']+)')
24+
VERSION = re.compile(r'__version\s*=\s*("|\')([\d.]+)')
25+
CONFIG = re.compile(r'__config\s*=\s*\[([^\]]+)', re.M)
26+
DESC = re.compile(r'__description\s*=\s*("|"""|\')([^"\']+)')
2727

2828

2929
def __init__(self, core):
@@ -93,8 +93,7 @@ def parse(self, folder, rootplugins={}):
9393
pfolder = join(pypath, "pyload", "plugins", folder)
9494

9595
for f in listdir(pfolder):
96-
if (isfile(join(pfolder, f)) and f.endswith(".py") or f.endswith("_25.pyc") or f.endswith(
97-
"_26.pyc") or f.endswith("_27.pyc")) and not f.startswith("_"):
96+
if isfile(join(pfolder, f)) and f.endswith(".py") and not f.startswith("_"):
9897

9998
try:
10099
with open(join(pfolder, f)) as data:
@@ -104,15 +103,6 @@ def parse(self, folder, rootplugins={}):
104103
self.core.log.error(str(e))
105104
continue
106105

107-
if f.endswith("_25.pyc") and version_info[0:2] != (2, 5): #@TODO: Remove in 0.4.10
108-
continue
109-
110-
elif f.endswith("_26.pyc") and version_info[0:2] != (2, 6): #@TODO: Remove in 0.4.10
111-
continue
112-
113-
elif f.endswith("_27.pyc") and version_info[0:2] != (2, 7): #@TODO: Remove in 0.4.10
114-
continue
115-
116106
name = f[:-3]
117107
if name[-1] == ".":
118108
name = name[:-4]

pyload/manager/Thread.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def assignJob(self):
266266
job.release()
267267
return
268268

269-
if job.plugin.__type__ == "hoster":
269+
if job.plugin.__type == "hoster":
270270
spaceLeft = freeSpace(self.core.config["general"]["download_folder"]) / 1024 / 1024
271271
if spaceLeft < self.core.config["general"]["min_free_space"]:
272272
self.core.log.warning(_("Not enough space left on device"))

pyload/manager/thread/Plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def writeDebugReport(self, pyfile):
7272

7373
def getDebugDump(self, pyfile):
7474
dump = "pyLoad %s Debug Report of %s %s \n\nTRACEBACK:\n %s \n\nFRAMESTACK:\n" % (
75-
self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version__, format_exc())
75+
self.m.core.api.getServerVersion(), pyfile.pluginname, pyfile.plugin.__version, format_exc())
7676

7777
tb = exc_info()[2]
7878
stack = []

pyload/plugin/Account.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ class Account(Base):
1919
Just overwrite `login` and cookies will be stored and account becomes accessible in\
2020
associated hoster plugin. Plugin should also provide `loadAccountInfo`
2121
"""
22-
__name__ = "Account"
23-
__type__ = "account"
24-
__version__ = "0.03"
22+
__name = "Account"
23+
__type = "account"
24+
__version = "0.03"
2525

26-
__description__ = """Base account plugin"""
27-
__license__ = "GPLv3"
28-
__authors__ = [("mkaay", "mkaay@mkaay.de")]
26+
__description = """Base account plugin"""
27+
__license = "GPLv3"
28+
__authors = [("mkaay", "mkaay@mkaay.de")]
2929

3030

3131
#: after that time (in minutes) pyload will relogin the account
@@ -197,7 +197,7 @@ def loadAccountInfo(self, name, req=None):
197197
"maxtraffic" : None,
198198
"premium" : None,
199199
"timestamp" : 0, #: time this info was retrieved
200-
"type" : self.__name__}
200+
"type" : self.__name}
201201

202202

203203
def getAllAccounts(self, force=False):
@@ -210,7 +210,7 @@ def getAccountRequest(self, user=None):
210210
if not user:
211211
return None
212212

213-
req = self.core.requestFactory.getRequest(self.__name__, user)
213+
req = self.core.requestFactory.getRequest(self.__name, user)
214214
return req
215215

216216

@@ -220,7 +220,7 @@ def getAccountCookies(self, user=None):
220220
if not user:
221221
return None
222222

223-
cj = self.core.requestFactory.getCookieJar(self.__name__, user)
223+
cj = self.core.requestFactory.getCookieJar(self.__name, user)
224224
return cj
225225

226226

pyload/plugin/Addon.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ def run(*args,**kwargs):
2323

2424

2525
class Addon(Base):
26-
__name__ = "Addon"
27-
__type__ = "addon"
28-
__version__ = "0.01"
26+
__name = "Addon"
27+
__type = "addon"
28+
__version = "0.01"
2929

30-
__config__ = [] #: [("name", "type", "desc", "default")]
30+
__config = [] #: [("name", "type", "desc", "default")]
3131

32-
__description__ = """Base addon plugin"""
33-
__license__ = "GPLv3"
34-
__authors__ = [("mkaay", "mkaay@mkaay.de"),
32+
__description = """Base addon plugin"""
33+
__license = "GPLv3"
34+
__authors = [("mkaay", "mkaay@mkaay.de"),
3535
("RaNaN", "RaNaN@pyload.org")]
3636

3737

@@ -100,7 +100,7 @@ def _periodical(self, threaded):
100100

101101

102102
def __repr__(self):
103-
return "<Addon %s>" % self.__name__
103+
return "<Addon %s>" % self.__name
104104

105105

106106
def setup(self):
@@ -119,7 +119,7 @@ def unload(self): # Deprecated, use method deactivate() instead
119119

120120
def isActivated(self):
121121
""" checks if addon is activated"""
122-
return self.core.config.getPlugin(self.__name__, "activated")
122+
return self.core.config.getPlugin(self.__name, "activated")
123123

124124

125125
# Event methods - overwrite these if needed

pyload/plugin/Captcha.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77

88
#@TODO: Extend Plugin class; remove all `html` args
99
class Captcha(Base):
10-
__name__ = "Captcha"
11-
__type__ = "captcha"
12-
__version__ = "0.25"
10+
__name = "Captcha"
11+
__type = "captcha"
12+
__version = "0.25"
1313

14-
__description__ = """Base captcha service plugin"""
15-
__license__ = "GPLv3"
16-
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
14+
__description = """Base captcha service plugin"""
15+
__license = "GPLv3"
16+
__authors = [("Walter Purcaro", "vuolter@gmail.com")]
1717

1818

1919
def __init__(self, plugin):

0 commit comments

Comments
 (0)