summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar glukgluk <matthias.leu@outlook.com> 2014-08-08 21:53:56 +0200
committerGravatar glukgluk <matthias.leu@outlook.com> 2014-08-08 21:53:56 +0200
commitdabe45332a554aba173c47754d39b514fa77c1bb (patch)
tree58ccd5580451b7c7408906c7d3beb32cff43967d /module
parentCreate JustPremium.py (diff)
downloadpyload-dabe45332a554aba173c47754d39b514fa77c1bb.tar.xz
Update JustPremium.py
Diffstat (limited to 'module')
-rw-r--r--module/plugins/hooks/JustPremium.py77
1 files changed, 40 insertions, 37 deletions
diff --git a/module/plugins/hooks/JustPremium.py b/module/plugins/hooks/JustPremium.py
index 17028ef5e..2c5788b75 100644
--- a/module/plugins/hooks/JustPremium.py
+++ b/module/plugins/hooks/JustPremium.py
@@ -22,55 +22,58 @@ from module.plugins.Hoster import Hoster
class JustPremium(Hook):
__name__ = "JustPremium"
- __version__ = "0.15"
+ __version__ = "0.16"
__description__ = "If you add multiple links with at least one premium hoster link, all non premium links get removed"
__config__ = [("activated", "bool", "Activated", "False"),
- ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"),
+ ("freehosters","bool", "Allow all freehosters and other unknown sites", "false"),
("nicehoster", "str", "unblock this hosters (comma seperated)", "Zippyshare.com")]
-
+
__author_name__ = ("mazleu")
__author_mail__ = ("mazleica@gmail.com")
event_list = ["linksAdded"]
-
- def coreReady(self) :
+
+ def coreReady(self) :
accs=str(self.core.accountManager.getAccountInfos())
- global badhosts
- global hosts
- hosts = ""
- while "[{" in accs:
- startid=accs.rfind("[], ", 0, accs.find("[{"))+2
- endid=accs.find("}]",startid)+2
- hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)]
- accs=accs[0:startid]+accs[endid:]
- badhosts=accs.replace("': [], '",",")[2:-6]
- hosts=hosts[1:]
- hosts=hosts+","+self.getConfig("nicehoster")
- self.logDebug("good hosts:",hosts)
- self.logDebug("bad hosts:",badhosts)
+ global badhosts
+ global hosts
+ hosts = ""
+ while "[{" in accs:
+ startid=accs.rfind("[], ", 0, accs.find("[{"))+2
+ endid=accs.find("}]",startid)+2
+ hosts=hosts+","+accs[startid+3:accs.find("'",startid+3)]
+ accs=accs[0:startid]+accs[endid:]
+ badhosts=accs.replace("': [], '",",")[2:-6]
+ hosts=hosts[1:]
+ hosts=hosts+","+self.getConfig("nicehoster")
+ self.logDebug("good hosts:",hosts)
+ self.logDebug("bad hosts:",badhosts)
- def filterLinks(self, t):
- links = self.core.api.checkURLs(t)
+ def filterLinks(self, t):
+ links = self.core.api.checkURLs(t)
hosterlist =""
- bhosters = [x.strip() for x in badhosts.split(",")]
- ghosters = [x.strip() for x in hosts.split(",")]
- premhoster = False
- for hoster in links:
- self.logDebug(hoster)
+ bhosters = [x.strip() for x in badhosts.split(",")]
+ ghosters = [x.strip() for x in hosts.split(",")]
+ premhoster = False
+ for hoster in links:
+ self.logDebug(hoster)
if hoster in ghosters:
premhoster = True
- if premhoster :
- for hoster in links:
- if self.getConfig("freehosters"):
- if hoster in bhosters:
- for link in links[hoster]:
- t.remove(link)
- self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster))
- else:
- if not hoster in ghosters:
- for link in links[hoster]:
- t.remove(link)
- self.logDebug("removed link '%s'because hoster was: '%s' " % (link,hoster))
+ self.logDebug ("Found at least one hoster with account")
+ if premhoster :
+ for hoster in links:
+ if self.getConfig("freehosters"):
+ if hoster in bhosters:
+ self.logInfo("remove links from hoster '%s' " % (hoster))
+ for link in links[hoster]:
+ t.remove(link)
+ self.logDebug("remove link '%s'because hoster was: '%s' " % (link,hoster))
+ else:
+ if not hoster in ghosters:
+ self.logInfo("remove links from hoster '%s' " % (hoster))
+ for link in links[hoster]:
+ t.remove(link)
+ self.logDebug("remove link '%s' because hoster was: '%s' " % (link,hoster))
def linksAdded(self, links, pid):
self.filterLinks(links)