summaryrefslogtreecommitdiffstats
path: root/module/plugins/crypter/C1neonCom.py
diff options
context:
space:
mode:
authorGravatar Jeix <devnull@localhost> 2012-04-25 11:22:04 +0200
committerGravatar Jeix <devnull@localhost> 2012-04-25 11:22:04 +0200
commit3748be281f6117309aa1c44d2c5419ce37dac964 (patch)
tree3b325713ca7272cb602872bc39316b225de1b58e /module/plugins/crypter/C1neonCom.py
parentclosed #561 this should do it. CryNickSystems fixed it before, but no version... (diff)
downloadpyload-3748be281f6117309aa1c44d2c5419ce37dac964.tar.xz
ShareRapid fix, closed #586, closed #588, thx godofdream
Diffstat (limited to 'module/plugins/crypter/C1neonCom.py')
-rw-r--r--module/plugins/crypter/C1neonCom.py124
1 files changed, 124 insertions, 0 deletions
diff --git a/module/plugins/crypter/C1neonCom.py b/module/plugins/crypter/C1neonCom.py
new file mode 100644
index 000000000..27ecb86d7
--- /dev/null
+++ b/module/plugins/crypter/C1neonCom.py
@@ -0,0 +1,124 @@
+# -*- coding: utf-8 -*-
+"""
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License,
+ or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, see <http://www.gnu.org/licenses/>.
+
+ @author: godofdream
+"""
+
+import re
+from module.plugins.Crypter import Crypter
+from module.common.json_layer import json_loads
+class C1neonCom(Crypter):
+ __name__ = "C1neonCom"
+ __type__ = "container"
+ __pattern__ = r"http://(www\.)?c1neon.com/.*?"
+ __version__ = "0.01"
+ __config__ = [
+ ("changeNameS", "Packagename;Show;Season;Episode", "Rename Show by", "Show"),
+ ("changeName", "Packagename;Movie", "Rename Movie by", "Movie"),
+ ("useStreams", "bool", "Use Streams too", False),
+ ("hosterListMode", "all;onlypreferred", "Use for hosters (if supported)", "all"),
+ ("hosterList", "str", "Preferred Hoster list (comma separated, no ending)", "2shared,Bayfiles,Netload,Rapidshare,Share-online"),
+ ("ignoreList", "str", "Ignored Hoster list (comma separated, no ending)", "Megaupload")
+ ]
+ __description__ = """C1neon.Com Container Plugin"""
+ __author_name__ = ("godofdream")
+ __author_mail__ = ("soilfiction@gmail.com")
+
+ VALUES_PATTERN = r"var subcats = (.*?)(;</script>|;var)"
+ SHOW_PATTERN = r"title='(.*?)'"
+ SERIE_PATTERN = r"<title>.*Serie.*</title>"
+
+ def decrypt(self, pyfile):
+ src = self.req.load(str(pyfile.url))
+
+ pattern = re.compile(self.VALUES_PATTERN, re.DOTALL)
+ data = json_loads(re.search(pattern, src).group(1))
+
+ # Get package info
+ links = []
+ Showname = re.search(self.SHOW_PATTERN, src)
+ if Showname:
+ Showname = Showname.group(1).decode("utf-8")
+ else:
+ Showname = self.pyfile.package().name
+
+ if re.search(self.SERIE_PATTERN, src):
+ for Season in data:
+ self.logDebug("Season " + Season)
+ for Episode in data[Season]:
+ self.logDebug("Episode " + Episode)
+ links.extend(self.getpreferred(data[Season][Episode]))
+ if self.getConfig("changeNameS") == "Episode":
+ self.packages.append((data[Season][Episode]['info']['name'].split("»")[0], links, data[Season][Episode]['info']['name'].split("»")[0]))
+ links = []
+
+ if self.getConfig("changeNameS") == "Season":
+ self.packages.append((Showname + " Season " + Season, links, Showname + " Season " + Season))
+ links = []
+
+ if self.getConfig("changeNameS") == "Show":
+ if links == []:
+ self.fail('Could not extract any links (Out of Date?)')
+ else:
+ self.packages.append((Showname, links, Showname))
+
+ elif self.getConfig("changeNameS") == "Packagename":
+ if links == []:
+ self.fail('Could not extract any links (Out of Date?)')
+ else:
+ self.core.files.addLinks(links, self.pyfile.package().id)
+ else:
+ for Movie in data:
+ links.extend(self.getpreferred(data[Movie]))
+ if self.getConfig("changeName") == "Movie":
+ if links == []:
+ self.fail('Could not extract any links (Out of Date?)')
+ else:
+ self.packages.append((Showname, links, Showname))
+
+ elif self.getConfig("changeName") == "Packagename":
+ if links == []:
+ self.fail('Could not extract any links (Out of Date?)')
+ else:
+ self.core.files.addLinks(links, self.pyfile.package().id)
+
+ #selects the preferred hoster, after that selects any hoster (ignoring the one to ignore)
+ #selects only one Hoster
+ def getpreferred(self, hosterslist):
+ hosterlist = hosterslist['d']
+ if self.getConfig("useStreams"):
+ hosterlist.append(hosterslist['s'])
+
+ result = []
+ for preferred in self.getConfig("hosterList").strip().lower().replace('|',',').replace('.','').replace(';',',').split(','):
+ for Hoster in hosterlist:
+ if preferred == Hoster.split('<')[0].strip().lower().replace('.',''):
+ for Part in hosterlist[Hoster]:
+ self.logDebug("selected " + Part[3])
+ result.append(str(Part[3]))
+ return result
+
+ ignorelist = self.getConfig("ignoreList").strip().lower().replace('|',',').replace('.','').replace(';',',').split(',')
+ if self.getConfig('hosterListMode') == "all":
+ for Hoster in hosterlist:
+ if Hoster.split('<')[0].strip().lower().replace('.','') not in ignorelist:
+ for Part in hosterlist[Hoster]:
+ self.logDebug("selected " + Part[3])
+ result.append(str(Part[3]))
+ return result
+ return result
+
+
+