Skip to content

Commit

Permalink
implementing latest and recomended movies in monsterdivx
Browse files Browse the repository at this point in the history
  • Loading branch information
j0hn committed Dec 16, 2011
1 parent fea25cb commit 2722ba8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 24 additions & 1 deletion guicavane/Hosts/Monsterdivx/api.py
Expand Up @@ -18,7 +18,7 @@

display_name = "Monsterdivx"
display_image = "monsterdivx.png"
implements = ["Shows", "Movies"]
implements = ["Shows", "Movies", "Recomended", "Latest"]

url_open = UrlOpen()

Expand Down Expand Up @@ -131,6 +131,8 @@ class Movie(BaseMovie):
_hosts_re = re.compile("onclick=\"goSource\('(?P<id>.*?)'," \
"'(?P<name>.*?)'\)")
_real_id_re = re.compile("var postID = (.*?);")
_recomended_movies_re = re.compile('<h2><a href="(?P<url>.*?)">' \
'(?P<name>.*?)</a></h2>')

def __init__(self, id, name, url):
self._id = id
Expand Down Expand Up @@ -186,3 +188,24 @@ def file_hosts(self):

def get_subtitle_url(self, lang="ES", quality=None):
return urls.sub_show % (self.id, lang)

@classmethod
def get_latest(cls):
return cls._get_movies_from_url(urls.latest_movies)

@classmethod
def get_recomended(cls):
return cls._get_movies_from_url(urls.recomended_movies)

@classmethod
def _get_movies_from_url(cls, url):
data = url_open(url)
data = data.split("<h2>LISTADO DE PELICULAS</h2>")[1]

for movie in cls._recomended_movies_re.finditer(data):
movie = movie.groupdict()

_id = None
name = movie["name"]
url = movie["url"].replace(urls.host, "")
yield Movie(_id, name, url)
2 changes: 2 additions & 0 deletions guicavane/Hosts/Monsterdivx/urls.py
Expand Up @@ -8,6 +8,8 @@
episode = host + "/%s/"

# Movies
recomended_movies = host + "/-/peliculas/?mas-vistas"
latest_movies = host + "/-/peliculas/"

# Sources
sources = host + "/wp-content/plugins/monsterdivx-player/scripts/source-iframe.php?" \
Expand Down

0 comments on commit 2722ba8

Please sign in to comment.