diff --git a/couchpotato/core/helpers/variable.py b/couchpotato/core/helpers/variable.py index 0db7248..07a240a 100755 --- a/couchpotato/core/helpers/variable.py +++ b/couchpotato/core/helpers/variable.py @@ -197,9 +197,9 @@ def getImdb(txt, check_inside = False, multiple = False): ids = re.findall('(tt\d{4,8})', txt) if multiple: - return removeDuplicate(['tt%08d' % tryInt(x[2:]) for x in ids]) if len(ids) > 0 else [] + return removeDuplicate(['tt%s' % str(tryInt(x[2:])).rjust(7, '0') for x in ids]) if len(ids) > 0 else [] - return 'tt%08d' % tryInt(ids[0][2:]) + return 'tt%s' % str(tryInt(ids[0][2:])).rjust(7, '0') except IndexError: pass diff --git a/couchpotato/core/media/movie/providers/automation/yifypopular.py b/couchpotato/core/media/movie/providers/automation/yifypopular.py new file mode 100644 index 0000000..5794f1e --- /dev/null +++ b/couchpotato/core/media/movie/providers/automation/yifypopular.py @@ -0,0 +1,81 @@ +import HTMLParser +from couchpotato import fireEvent +from couchpotato.core.logger import CPLog +from couchpotato.core.media.movie.providers.automation.base import Automation + +log = CPLog(__name__) + +autoload = 'YTSPopular' + + +class YTSPopular(Automation): + + interval = 1800 + url = 'https://yts.lt/' + + def getIMDBids(self): + + movies = [] + source = self.getHTMLData(self.url) + + class MyHTMLParser(HTMLParser): + doparse = False + dotitle = False + doyear = False + currentmovie = {'title':"", 'year':""} + movies = [] + def handle_starttag(self, tag, attrs): + for attr in attrs: + self.doparse = (attr[0] == "id" and attr[1] == "popular-downloads") or self.doparse + self.dotitle = (attr[0] == "class" and attr[1] == "browse-movie-title" and self.doparse) + self.doyear = (attr[0] == "class" and attr[1] == "browse-movie-year" and self.doparse) + if (attr[0] == "class" and attr[1] == "home-movies"): + self.doparse = False + + def handle_endtag(self, tag): + self.dotitle = False + self.doyear = False + + def handle_data(self, data): + if (self.doparse): + if (self.dotitle): + self.dotitle = False + self.currentmovie['title'] = data + if (self.doyear): + self.doyear = False + self.currentmovie['year'] = data + self.movies.append(self.currentmovie) + self.currentmovie = {'title':"", 'year':""} + + def getMovies(self): + return self.movies + + parser = MyHTMLParser() + parser.feed(source) + for el in parser.getMovies(): + imdb = self.search(el['title'], el['year']) + if imdb and self.isMinimalMovie(imdb): + movies.append(imdb['imdb']) + + return movies + + +config = [{ + 'name': 'ytspopular', + 'groups': [ + { + 'tab': 'automation', + 'list': 'automation_providers', + 'name': 'ytspopular_automation', + 'label': 'YTS Popular', + 'description': 'Imports popular downloas as currently listed on YTS.', + 'options': [ + { + 'name': 'automation_enabled', + 'default': False, + 'type': 'enabler', + }, + ], + }, + ], +}] diff --git a/couchpotato/core/notifications/plex/__init__.py b/couchpotato/core/notifications/plex/__init__.py index 4e2a4fd..254c1ed 100755 --- a/couchpotato/core/notifications/plex/__init__.py +++ b/couchpotato/core/notifications/plex/__init__.py @@ -27,7 +27,7 @@ config = [{ 'name': 'media_server_port', 'label': 'Port', 'default': '32400', - 'description': 'Connection tot he Media Server should use this port' + 'description': 'Connection to the Media Server should use this port' }, { 'name': 'use_https',