summaryrefslogtreecommitdiffstats
path: root/module/plugins
diff options
context:
space:
mode:
authorGravatar Christopher <4Christopher@gmx.de> 2013-03-11 20:48:41 +0100
committerGravatar Christopher <4Christopher@gmx.de> 2013-03-11 20:48:41 +0100
commit6c80f7bf4e9e1e21eeb0cc2522e6b674b793cd7a (patch)
treea0e7f4da3e55061aa3a7b8094d7e160c0aedc7de /module/plugins
parentwrote crypter plugin for chip.de/videos (diff)
downloadpyload-6c80f7bf4e9e1e21eeb0cc2522e6b674b793cd7a.tar.xz
added setting to set how many URLs should be returned for each episode.
Usually the first URL will be all you need. The movie2k.to website also just returns the first URL but in the source code of the website there are more links for each episode …
Diffstat (limited to 'module/plugins')
-rw-r--r--module/plugins/crypter/ChipDe.py1
-rw-r--r--module/plugins/crypter/Movie2kTo.py56
2 files changed, 30 insertions, 27 deletions
diff --git a/module/plugins/crypter/ChipDe.py b/module/plugins/crypter/ChipDe.py
index 955d731b2..fcb84a300 100644
--- a/module/plugins/crypter/ChipDe.py
+++ b/module/plugins/crypter/ChipDe.py
@@ -14,7 +14,6 @@ class ChipDe(Crypter):
__author_mail__ = ('4Christopher@gmx.de')
def decrypt(self, pyfile):
- # self.package = pyfile.package()
self.html = self.load(pyfile.url)
try:
url = re.search(r'"(http://video.chip.de/\d+?/.*)"', self.html).group(1)
diff --git a/module/plugins/crypter/Movie2kTo.py b/module/plugins/crypter/Movie2kTo.py
index a9cdb188b..1b93dfa78 100644
--- a/module/plugins/crypter/Movie2kTo.py
+++ b/module/plugins/crypter/Movie2kTo.py
@@ -3,15 +3,17 @@
import re
from module.plugins.Crypter import Crypter
+from collections import defaultdict
class Movie2kTo(Crypter):
- __name__ = "Movie2kTo"
- __type__ = "container"
- __pattern__ = r"http://(?:www\.)?movie2k\.to/(.*)\.html"
- __version__ = "0.2"
- __config__ = [("accepted_hosters", "str", "List of accepted hosters", "Xvidstage, "),
- ("whole_season", "bool", "Download whole season", "False"),
- ("everything", "bool", "Download everything", "False")]
+ __name__ = 'Movie2kTo'
+ __type__ = 'container'
+ __pattern__ = r'http://(?:www\.)?movie2k\.to/(.*)\.html'
+ __version__ = '0.3'
+ __config__ = [('accepted_hosters', 'str', 'List of accepted hosters', 'Xvidstage, '),
+ ('whole_season', 'bool', 'Download whole season', 'False'),
+ ('everything', 'bool', 'Download everything', 'False'),
+ ('firstN', 'int', 'Download the first N files for each episode. The first file is probably all you will need.', '1')]
__description__ = """Movie2k.to Container Plugin"""
__author_name__ = ('4Christopher')
__author_mail__ = ('4Christopher@gmx.de')
@@ -21,7 +23,7 @@ class Movie2kTo(Crypter):
SEASON_PATTERN = r'<div id="episodediv(\d+?)" style="display:(inline|none)">(.*?)</div>'
EP_PATTERN = r'<option value="(.+?)"( selected)?>Episode\s*?(\d+?)</option>'
BASE_URL = 'http://www.movie2k.to'
-
+
def decrypt(self, pyfile):
self.package = pyfile.package()
self.folder = self.package.folder
@@ -42,17 +44,18 @@ class Movie2kTo(Crypter):
season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path))
elif (whole_season and (season_sel == 'inline')) or everything:
season_links += self.getInfoAndLinks('%s/%s' % (self.BASE_URL, url_path))
- self.packages.append(('%s: Season %s' % (self.name, season), season_links, 'Season %s' % season))
+ self.logDebug(season_links)
+ self.packages.append(('%s: Season %s' % (self.name, season), season_links, 'Season %s' % season))
else:
self.packages.append((self.package.name, self.getLinks(), self.package.folder))
-
+
def tvshow_number(self, number):
if int(number) < 10:
return '0%s' % number
else:
return number
-
+
def name_tvshow(self, season, ep):
return '%s S%sE%s' % (self.name, self.tvshow_number(season), self.tvshow_number(ep))
@@ -77,8 +80,10 @@ class Movie2kTo(Crypter):
self.getInfo(url)
return self.getLinks()
+ ## This function returns the links for one episode as list
def getLinks(self):
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+?)\].+&nbsp;(.+?)</a>')
@@ -88,22 +93,21 @@ class Movie2kTo(Crypter):
re_hoster_id = re_hoster_id_js
elif re_hoster_id_html.search(self.html):
re_hoster_id = re_hoster_id_html
+ count = 0
for h_id, hoster in re_hoster_id.findall(self.html):
if hoster in accepted_hosters:
- if h_id != self.id:
- self.html = self.load('%s/tvshows-%s-%s.html' % (self.BASE_URL, h_id, self.name))
- else:
- self.logDebug('This is already the right ID')
- try:
- url = re.search(r'<a target="_blank" href="(http://.*?)"', self.html).group(1)
- self.logDebug('id: %s, %s: %s' % (h_id, hoster, url))
- links.append(url)
- except:
- self.logDebug('Failed to find the URL')
-
- # self.logDebug(links[-1]) ## Last link, this is probably everything
- ## you will need
- # links.append('http://localhost/IfTheProcessFunctionReturnsOnlyOneLinkItWillFail')
+ count += 1
+ if count <= firstN:
+ if h_id != self.id:
+ self.html = self.load('%s/tvshows-%s-%s.html' % (self.BASE_URL, h_id, self.name))
+ else:
+ self.logDebug('This is already the right ID')
+ try:
+ url = re.search(r'<a target="_blank" href="(http://.*?)"', self.html).group(1)
+ self.logDebug('id: %s, %s: %s' % (h_id, hoster, url))
+ links.append(url)
+ except:
+ self.logDebug('Failed to find the URL')
+
self.logDebug(links)
- # return links[-1]
return links