diff options
Diffstat (limited to 'module/plugins')
-rw-r--r-- | module/plugins/crypter/Movie2kTo.py | 54 | ||||
-rw-r--r-- | module/plugins/hoster/ChipDe.py (renamed from module/plugins/crypter/ChipDe.py) | 0 | ||||
-rw-r--r-- | module/plugins/hoster/XvidstageCom.py | 13 |
3 files changed, 46 insertions, 21 deletions
diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py index c32f6f930..f5800b498 100644 --- a/module/plugins/crypter/Movie2kTo.py +++ b/module/plugins/crypter/Movie2kTo.py @@ -27,6 +27,7 @@ class Movie2kTo(Crypter): def decrypt(self, pyfile): self.package = pyfile.package() self.folder = self.package.folder + self.qStatReset() whole_season = self.getConfig('whole_season') everything = self.getConfig('everything') self.getInfo(pyfile.url) @@ -46,10 +47,21 @@ class Movie2kTo(Crypter): season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path)) self.logDebug(season_links) - self.packages.append(('%s: Season %s' % (self.name, season), season_links, 'Season %s' % season)) + self.packages.append(('%s: Season %s (%s)' + % (self.name, season, self.qStat()), season_links, 'Season %s' % season)) + self.qStatReset() else: - self.packages.append((self.package.name, self.getLinks(), self.package.folder)) + links = self.getLinks() + self.package.name = '%s%s' % (self.package.name, self.qStat()) + self.packages.append((self.package.name, links , self.package.folder)) + def qStat(self): + if len(self.q) == 0: return '' + return (' (Average quality: %d, min: %d, max: %d, %s, max (all hosters): %d)' + % (sum(self.q) / float(len(self.q)), min(self.q), max(self.q), self.q, self.max_q)) + def qStatReset(self): + self.q = [] ## to calculate the average, min and max of the quality + self.max_q = None def tvshow_number(self, number): if int(number) < 10: return '0%s' % number @@ -85,23 +97,33 @@ class Movie2kTo(Crypter): accepted_hosters = re.findall(r'\b(\w+?)\b', self.getConfig('accepted_hosters')) firstN = self.getConfig('firstN') links = [] - ## h_id: hoster_id of a possible hoster - re_hoster_id_js = re.compile(r'links\[(\d+?)\].+ (.+?)</a>') - re_hoster_id_html = re.compile(r'</td><td.*?<a href=".*?(\d{7}).*?".+? (.+?)</a>') + re_quality = re.compile(r'.+?Quality:.+?smileys/(\d)\.gif') + ## The quality is one digit. 0 is the worst and 5 is the best. + ## Is not always there … + re_hoster_id_html = re.compile(r'(?:<td height|<tr id).+?<a href=".*?(\d{7}).*?".+? ([^<>]+?)</a>(.+?)</tr>') + re_hoster_id_js = re.compile(r'links\[(\d+?)\].+ (.+?)</a>(.+?)</tr>') ## I assume that the ID is 7 digits longs - if re_hoster_id_js.search(self.html): - re_hoster_id = re_hoster_id_js - self.logDebug('Assuming that the ID can be found in a JavaScript section.') - elif re_hoster_id_html.search(self.html): - re_hoster_id = re_hoster_id_html - self.logDebug('Assuming that the ID can be found in a HTML section.') count = defaultdict(int) - for h_id, hoster in re_hoster_id.findall(self.html): - # self.logDebug('Hoster %s' % hoster) + matches = re_hoster_id_html.findall(self.html) + matches += re_hoster_id_js.findall(self.html) + # self.logDebug(matches) + ## h_id: hoster_id of a possible hoster + for h_id, hoster, q_html in matches: + match_q = re_quality.search(q_html) + if match_q: + quality = int(match_q.group(1)) + if self.max_q: + if self.max_q < quality: self.max_q = quality + else: ## was None before + self.max_q = quality + q_s = ', Quality: %d' % quality + else: + q_s = ', unknown quality' if hoster in accepted_hosters: - # self.logDebug('Accepted %s' % hoster) + self.logDebug('Accepted: %s, ID: %s%s' % (hoster, h_id, q_s)) count[hoster] += 1 if count[hoster] <= firstN: + if match_q: self.q.append(quality) if h_id != self.id: self.html = self.load('%s/tvshows-%s-%s.html' % (self.BASE_URL, h_id, self.name)) else: @@ -112,6 +134,8 @@ class Movie2kTo(Crypter): links.append(url) except: self.logDebug('Failed to find the URL') + else: + self.logDebug('Not accepted: %s, ID: %s%s' % (hoster, h_id, q_s)) - self.logDebug(links) + # self.logDebug(links) return links diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/hoster/ChipDe.py index fcb84a300..fcb84a300 100644 --- a/module/plugins/crypter/ChipDe.py +++ b/module/plugins/hoster/ChipDe.py diff --git a/module/plugins/hoster/XvidstageCom.py b/module/plugins/hoster/XvidstageCom.py index 38c54efec..14079df43 100644 --- a/module/plugins/hoster/XvidstageCom.py +++ b/module/plugins/hoster/XvidstageCom.py @@ -13,7 +13,7 @@ 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: 4Christopher """ @@ -29,7 +29,7 @@ def setup(self): def getInfo(urls): result = [] - + for url in urls: result.append(parseFileInfo(url, getInfoMode = True)) yield result @@ -37,9 +37,10 @@ def getInfo(urls): def parseFileInfo(url, getInfoMode = False): html = getURL(url) info = {"name" : url, "size" : 0, "status" : 3} - info['name'] = re.search(r'(?:Filename|Dateiname):</b></td><td nowrap[^>]*?>(.*?)<', html).group(1) - info['size'] = re.search(r'(?:Size|Größe):</b></td><td>.*? <small>\((\d+?) bytes\)', html).group(1) - if info['size'] == 0: + try: + info['name'] = re.search(r'(?:Filename|Dateiname):</b></td><td nowrap[^>]*?>(.*?)<', html).group(1) + info['size'] = re.search(r'(?:Size|Größe):</b></td><td>.*? <small>\((\d+?) bytes\)', html).group(1) + except: ## The file is offline info['status'] = 1 else: info['status'] = 2 @@ -51,7 +52,7 @@ def parseFileInfo(url, getInfoMode = False): class XvidstageCom(Hoster): __name__ = 'XvidstageCom' - __version__ = '0.2' + __version__ = '0.3' __pattern__ = r'http://(?:www.)?xvidstage.com/(?P<id>[0-9A-Za-z]+)' __type__ = 'hoster' __description__ = """A Plugin that allows you to download files from http://xvidstage.com""" |