Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/.project
/.pydevproject
/.settings
*.pyc
*.pyo
8 changes: 7 additions & 1 deletion addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ def show_movies():
)
items = get_movies3(source, limit)
finish_kwargs = {
'sort_methods': ['date', 'title', 'playlist_order']
'sort_methods': ['date', 'title', 'playlist_order'],
'cache_to_disc': False
}
return plugin.finish(items, **finish_kwargs)

Expand Down Expand Up @@ -147,6 +148,11 @@ def __context(movie_title):
items = [{
'label': movie['title'],
'thumbnail': movie['poster'],
'art': {
'thumbnail': movie['poster'],
'poster': movie['poster'],
'fanart': movie['background'],
},
'info': {
'count': i,
'title': movie['title'],
Expand Down
28 changes: 15 additions & 13 deletions resources/lib/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,21 @@ def __trailer_urls(trailer_url):
tree = self.__get_tree(self.TRAILERS_URL % location)
for li in tree.findAll('li', {'class': re.compile('trailer')}):
slug = li.find('h3').string.replace(' ', '').replace('-', '').lower()
playlist = self.__get_url(self.PLAY_LIST_URL % (location, slug))
trailer_url = re.search(self.RE_URL, playlist).group(1)
duration = int(re.search(self.RE_DURATION, playlist).group(1)) / 1000
trailer = {
'title': li.find('h3').string,
'date': '',
'duration': duration,
'thumb': __thumb(li.find('img')['src']),
'background': self.BACKGROUND_URL % location,
'urls': __trailer_urls(trailer_url)
}
yield trailer
try:
playlist = self.__get_url(self.PLAY_LIST_URL % (location, slug))
trailer_url = re.search(self.RE_URL, playlist).group(1)
duration = int(re.search(self.RE_DURATION, playlist).group(1)) / 1000
trailer = {
'title': li.find('h3').string,
'date': '',
'duration': duration,
'thumb': __thumb(li.find('img')['src']),
'background': self.BACKGROUND_URL % location,
'urls': __trailer_urls(trailer_url)
}
yield trailer
except NetworkError:
pass

def __get_tree(self, url):
return BeautifulSoup(self.__get_url(url))
Expand All @@ -157,7 +160,6 @@ def __get_url(self, url):
try:
return urllib2.urlopen(req).read()
except urllib2.HTTPError, error:
print error
raise NetworkError('HTTPError: %s' % error)


Expand Down