diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b97cce1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +/.project +/.pydevproject +/.settings +*.pyc +*.pyo diff --git a/addon.py b/addon.py index df608f5..6fb32c9 100644 --- a/addon.py +++ b/addon.py @@ -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) @@ -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'], diff --git a/resources/lib/scraper.py b/resources/lib/scraper.py index 732fd0c..0a1f7f4 100644 --- a/resources/lib/scraper.py +++ b/resources/lib/scraper.py @@ -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)) @@ -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)