* Added Kinepolis automation provider (uses optimized search code from the blu-ray.com commit)
* Optimized imports
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
from couchpotato.core.helpers.rss import RSS
|
from couchpotato.core.helpers.rss import RSS
|
||||||
from couchpotato.core.helpers.variable import md5, getImdb, cleanHost
|
from couchpotato.core.helpers.variable import md5
|
||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.providers.automation.base import Automation
|
from couchpotato.core.providers.automation.base import Automation
|
||||||
from couchpotato.environment import Env
|
from couchpotato.environment import Env
|
||||||
from urllib import quote_plus
|
|
||||||
import traceback
|
import traceback
|
||||||
import xml.etree.ElementTree as XMLTree
|
import xml.etree.ElementTree as XMLTree
|
||||||
import json
|
import json
|
||||||
@@ -56,7 +55,6 @@ class Bluray(Automation, RSS):
|
|||||||
log.info("Applying IMDB filter to found movies...")
|
log.info("Applying IMDB filter to found movies...")
|
||||||
|
|
||||||
for RSSMovie in RSSMovies:
|
for RSSMovie in RSSMovies:
|
||||||
log.debug('Searching for "%s".' % RSSMovie)
|
|
||||||
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
||||||
|
|
||||||
if imdb:
|
if imdb:
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
from .main import Kinepolis
|
||||||
|
|
||||||
|
def start():
|
||||||
|
return Kinepolis()
|
||||||
|
|
||||||
|
config = [{
|
||||||
|
'name': 'kinepolis',
|
||||||
|
'groups': [
|
||||||
|
{
|
||||||
|
'tab': 'automation',
|
||||||
|
'name': 'kinepolis_automation',
|
||||||
|
'label': 'Kinepolis',
|
||||||
|
'description': 'imports movies from the current top 10 of kinepolis',
|
||||||
|
'options': [
|
||||||
|
{
|
||||||
|
'name': 'automation_enabled',
|
||||||
|
'default': False,
|
||||||
|
'type': 'enabler',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}]
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
from couchpotato.core.helpers.rss import RSS
|
||||||
|
from couchpotato.core.helpers.variable import md5
|
||||||
|
from couchpotato.core.logger import CPLog
|
||||||
|
from couchpotato.core.providers.automation.base import Automation
|
||||||
|
from couchpotato.environment import Env
|
||||||
|
from dateutil.parser import parse
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
import xml.etree.ElementTree as XMLTree
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class Kinepolis(Automation, RSS):
|
||||||
|
|
||||||
|
interval = 1800
|
||||||
|
rss_url = 'http://kinepolis.be/nl/top10-box-office/feed'
|
||||||
|
|
||||||
|
def getIMDBids(self):
|
||||||
|
|
||||||
|
if self.isDisabled():
|
||||||
|
return
|
||||||
|
|
||||||
|
movies = []
|
||||||
|
RSSMovie = {'name': 'placeholder', 'year' : 'placeholder'}
|
||||||
|
|
||||||
|
cache_key = 'kinepolis.%s' % md5(self.rss_url)
|
||||||
|
rss_data = self.getCache(cache_key, self.rss_url)
|
||||||
|
data = XMLTree.fromstring(rss_data)
|
||||||
|
|
||||||
|
if data:
|
||||||
|
rss_movies = self.getElements(data, 'channel/item')
|
||||||
|
|
||||||
|
for movie in rss_movies:
|
||||||
|
RSSMovie['name'] = self.getTextElement(movie, "title")
|
||||||
|
currentYear = datetime.datetime.now().strftime("%Y")
|
||||||
|
RSSMovie['year'] = currentYear
|
||||||
|
|
||||||
|
log.info('Release found: %s.' % RSSMovie)
|
||||||
|
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
||||||
|
|
||||||
|
if imdb:
|
||||||
|
movies.append(imdb['imdb'])
|
||||||
|
|
||||||
|
return movies
|
||||||
Reference in New Issue
Block a user