summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/XFileSharingPro.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks/XFileSharingPro.py')
-rw-r--r--module/plugins/hooks/XFileSharingPro.py69
1 files changed, 35 insertions, 34 deletions
diff --git a/module/plugins/hooks/XFileSharingPro.py b/module/plugins/hooks/XFileSharingPro.py
index 589143547..7443266b3 100644
--- a/module/plugins/hooks/XFileSharingPro.py
+++ b/module/plugins/hooks/XFileSharingPro.py
@@ -8,7 +8,7 @@ from module.plugins.Hook import Hook
class XFileSharingPro(Hook):
__name__ = "XFileSharingPro"
__type__ = "hook"
- __version__ = "0.28"
+ __version__ = "0.37"
__config__ = [("activated" , "bool", "Activated" , True ),
("use_hoster_list" , "bool", "Load listed hosters only" , False),
@@ -22,31 +22,32 @@ class XFileSharingPro(Hook):
__authors__ = [("Walter Purcaro", "vuolter@gmail.com")]
- # event_list = ["pluginConfigChanged"]
- regexp = {'hoster' : (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)',
- r'https?://(?:[^/]+\.)?(%s)/(?:embed-)?\w+'),
- 'crypter': (r'https?://(?:www\.)?([\w.^_]+(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+',
- r'https?://(?:[^/]+\.)?(%s)/(?:user|folder)s?/\w+')}
+ interval = 0 #@TODO: Remove in 0.4.10
+ regexp = {'hoster' : (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:embed-)?\w{12}(?:\W|$)',
+ r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:embed-)?\w+'),
+ 'crypter': (r'https?://(?:www\.)?(?P<DOMAIN>[\w\-.^_]{3,63}(?:\.[a-zA-Z]{2,})(?:\:\d+)?)/(?:user|folder)s?/\w+',
+ r'https?://(?:[^/]+\.)?(?P<DOMAIN>%s)/(?:user|folder)s?/\w+')}
- HOSTER_LIST = [#WORKING HOSTERS:
- "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "filevice.com", "hostingbulk.com",
- "ravishare.com", "salefiles.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com",
- #NOT TESTED:
- "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com",
- "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com",
- "vidbull.com", "zalaa.com", "zomgupload.com",
- #NOT WORKING:
- "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"]
- CRYPTER_LIST = []
+ HOSTER_BUILTIN = [#WORKING HOSTERS:
+ "backin.net", "eyesfile.ca", "file4safe.com", "fileband.com", "filedwon.com", "fileparadox.in",
+ "filevice.com", "hostingbulk.com", "junkyvideo.com", "linestorage.com", "ravishare.com", "ryushare.com",
+ "salefiles.com", "sendmyway.com", "sharesix.com", "thefile.me", "verzend.be", "xvidstage.com",
+ #NOT TESTED:
+ "101shared.com", "4upfiles.com", "filemaze.ws", "filenuke.com", "linkzhost.com", "mightyupload.com",
+ "rockdizfile.com", "sharebeast.com", "sharerepo.com", "shareswift.com", "uploadbaz.com", "uploadc.com",
+ "vidbull.com", "worldbytez.com", "zalaa.com", "zomgupload.com",
+ #NOT WORKING:
+ "amonshare.com", "banicrazy.info", "boosterking.com", "host4desi.com", "laoupload.com", "rd-fs.com"]
+ CRYPTER_BUILTIN = ["junocloud.me", "rapidfileshare.net"]
- # def pluginConfigChanged(self.__name__, plugin, name, value):
+ # def pluginConfigChanged(self, plugin, name, value):
# self.loadPattern()
- #@TODO: Remove in 0.4.10
- def initPeriodical(self):
- pass
+ def setup(self):
+ self.info = {} #@TODO: Remove in 0.4.10
+ # self.event_list = ["pluginConfigChanged"]
def coreReady(self):
@@ -64,25 +65,25 @@ class XFileSharingPro(Hook):
self.logInfo(_("Handling any %s I can!") % type)
pattern = self.regexp[type][0]
else:
- s = self.getConfig('%s_list' % type).replace('\\', '').replace('|', ',').replace(';', ',').lower()
- plugin_list = set([x.strip() for x in s.split(',')])
+ plugins = self.getConfig('%s_list' % type)
+ plugin_set = set(plugins.replace(' ', '').replace('\\', '').replace('|', ',').replace(';', ',').lower().split(','))
if use_builtin_list:
- plugin_list |= set([x.lower() for x in getattr(self, "%s_LIST" % type.upper())])
+ plugin_set |= set(x.lower() for x in getattr(self, "%s_BUILTIN" % type.upper()))
- plugin_list -= set(('', u''))
+ plugin_set -= set(('', u''))
- if not plugin_list:
+ if not plugin_set:
self.logInfo(_("No %s to handle") % type)
self._unload(type, plugin)
return
- match_list = '|'.join(sorted(plugin_list))
+ match_list = '|'.join(sorted(plugin_set))
- len_match_list = len(plugin_list)
+ len_match_list = len(plugin_set)
self.logInfo(_("Handling %d %s%s: %s") % (len_match_list,
type,
- "" if len_match_list is 1 else "s",
+ "" if len_match_list == 1 else "s",
match_list.replace('|', ', ')))
pattern = self.regexp[type][1] % match_list.replace('.', '\.')
@@ -109,13 +110,13 @@ class XFileSharingPro(Hook):
def unloadHoster(self, hoster):
hdict = self.core.pluginManager.hosterPlugins[hoster]
- if "new_name" in hdict and hdict['new_name'] is "XFileSharingPro":
+ if "new_name" in hdict and hdict['new_name'] == "XFileSharingPro":
if "module" in hdict:
- del hdict['module']
+ hdict.pop('module', None)
if "new_module" in hdict:
- del hdict['new_module']
- del hdict['new_name']
+ hdict.pop('new_module', None)
+ hdict.pop('new_name', None)
return True
else:
@@ -123,9 +124,9 @@ class XFileSharingPro(Hook):
# def downloadFailed(self, pyfile):
- # if pyfile.pluginname is "BasePlugin" \
+ # if pyfile.pluginname == "BasePlugin" \
# and pyfile.hasStatus("failed") \
- # and not self.getConfig("use_hoster_list") \
+ # and not self.getConfig('use_hoster_list') \
# and self.unloadHoster("BasePlugin"):
# self.logDebug("Unloaded XFileSharingPro from BasePlugin")
# pyfile.setStatus("queued")