Browse Source

Merge pull request #7319 from CouchPotato/develop

Develop
master
Ruud Burger 5 years ago
committed by GitHub
parent
commit
7260c12f72
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      couchpotato/core/helpers/variable.py
  2. 81
      couchpotato/core/media/movie/providers/automation/yifypopular.py
  3. 2
      couchpotato/core/notifications/plex/__init__.py

4
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

81
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',
},
],
},
],
}]

2
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',

Loading…
Cancel
Save