Cleanup up bluray.com and kinopolis providers
This commit is contained in:
@@ -25,7 +25,7 @@ config = [{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'rating',
|
'name': 'rating',
|
||||||
'default': 6.0,
|
'default': 7.0,
|
||||||
'type': 'float',
|
'type': 'float',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,4 +19,8 @@ class Automation(Plugin):
|
|||||||
|
|
||||||
movies = fireEvent('automation.get_movies', merge = True)
|
movies = fireEvent('automation.get_movies', merge = True)
|
||||||
for imdb_id in movies:
|
for imdb_id in movies:
|
||||||
fireEvent('movie.add', params = {'identifier': imdb_id}, force_readd = False)
|
prop_name = 'automation.added.%s' % imdb_id
|
||||||
|
added = Env.prop(prop_name, default = False)
|
||||||
|
if not added:
|
||||||
|
fireEvent('movie.add', params = {'identifier': imdb_id}, force_readd = False)
|
||||||
|
Env.prop(prop_name, True)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ from couchpotato.core.event import addEvent, fireEvent
|
|||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from couchpotato.core.plugins.base import Plugin
|
from couchpotato.core.plugins.base import Plugin
|
||||||
from couchpotato.environment import Env
|
from couchpotato.environment import Env
|
||||||
from couchpotato.core.helpers.encoding import simplifyString
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
@@ -36,14 +35,9 @@ class Automation(Plugin):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def isMinimal(self, identifier):
|
|
||||||
movie = fireEvent('movie.info', identifier = identifier, merge = True)
|
|
||||||
return self.isMinimalMovie(movie)
|
|
||||||
|
|
||||||
def isMinimalMovie(self, movie):
|
def isMinimalMovie(self, movie):
|
||||||
if movie['rating']:
|
if movie['rating'] and movie['rating'].get('imdb'):
|
||||||
rating = movie['rating']['imdb'][0]
|
movie['votes'] = movie['rating']['imdb'][1]
|
||||||
movie['votes'] = movie['rating']['imdb'][1]
|
|
||||||
movie['rating'] = movie['rating']['imdb'][0]
|
movie['rating'] = movie['rating']['imdb'][0]
|
||||||
identifier = movie['imdb']
|
identifier = movie['imdb']
|
||||||
for minimal_type in ['year', 'rating', 'votes']:
|
for minimal_type in ['year', 'rating', 'votes']:
|
||||||
@@ -55,19 +49,13 @@ class Automation(Plugin):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def getIMDBFromTitle(self, title):
|
def getIMDBFromTitle(self, name, year = None):
|
||||||
cache_key = u'%s/%s' % (__name__, simplifyString(title))
|
result = fireEvent('movie.search', q = '%s %s' % (name, year), limit = 1, merge = True)
|
||||||
movies = Env.get('cache').get(cache_key)
|
|
||||||
|
|
||||||
if not movies:
|
if len(result) > 0:
|
||||||
movies = fireEvent('movie.searchimdb', q = title, merge = True)
|
return result[0]
|
||||||
Env.get('cache').set(cache_key, movies)
|
else:
|
||||||
|
return None
|
||||||
try:
|
|
||||||
return movies[0]
|
|
||||||
|
|
||||||
except:
|
|
||||||
log.info("No results for " + title)
|
|
||||||
|
|
||||||
def getMinimal(self, min_type):
|
def getMinimal(self, min_type):
|
||||||
return Env.setting(min_type, 'automation')
|
return Env.setting(min_type, 'automation')
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ config = [{
|
|||||||
'tab': 'automation',
|
'tab': 'automation',
|
||||||
'name': 'bluray_automation',
|
'name': 'bluray_automation',
|
||||||
'label': 'Blu-ray.com',
|
'label': 'Blu-ray.com',
|
||||||
'description': 'imports movies from blu-ray.com',
|
'description': 'Imports movies from blu-ray.com. (uses minimal requirements)',
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
'name': 'automation_enabled',
|
'name': 'automation_enabled',
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ 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
|
||||||
import traceback
|
|
||||||
import xml.etree.ElementTree as XMLTree
|
import xml.etree.ElementTree as XMLTree
|
||||||
import json
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
@@ -52,7 +50,7 @@ class Bluray(Automation, RSS):
|
|||||||
log.info('No movies found.')
|
log.info('No movies found.')
|
||||||
return
|
return
|
||||||
|
|
||||||
log.info("Applying IMDB filter to found movies...")
|
log.debug("Applying IMDB filter to found movies...")
|
||||||
|
|
||||||
for RSSMovie in RSSMovies:
|
for RSSMovie in RSSMovies:
|
||||||
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ config = [{
|
|||||||
'tab': 'automation',
|
'tab': 'automation',
|
||||||
'name': 'kinepolis_automation',
|
'name': 'kinepolis_automation',
|
||||||
'label': 'Kinepolis',
|
'label': 'Kinepolis',
|
||||||
'description': 'imports movies from the current top 10 of kinepolis',
|
'description': 'Imports movies from the current top 10 of kinepolis. (uses minimal requirements)',
|
||||||
'options': [
|
'options': [
|
||||||
{
|
{
|
||||||
'name': 'automation_enabled',
|
'name': 'automation_enabled',
|
||||||
|
|||||||
@@ -2,12 +2,8 @@ from couchpotato.core.helpers.rss import RSS
|
|||||||
from couchpotato.core.helpers.variable import md5
|
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 dateutil.parser import parse
|
|
||||||
import time
|
|
||||||
import traceback
|
|
||||||
import xml.etree.ElementTree as XMLTree
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import xml.etree.ElementTree as XMLTree
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
@@ -29,7 +25,7 @@ class Kinepolis(Automation, RSS):
|
|||||||
rss_data = self.getCache(cache_key, self.rss_url)
|
rss_data = self.getCache(cache_key, self.rss_url)
|
||||||
data = XMLTree.fromstring(rss_data)
|
data = XMLTree.fromstring(rss_data)
|
||||||
|
|
||||||
if data:
|
if data is not None:
|
||||||
rss_movies = self.getElements(data, 'channel/item')
|
rss_movies = self.getElements(data, 'channel/item')
|
||||||
|
|
||||||
for movie in rss_movies:
|
for movie in rss_movies:
|
||||||
@@ -37,8 +33,8 @@ class Kinepolis(Automation, RSS):
|
|||||||
currentYear = datetime.datetime.now().strftime("%Y")
|
currentYear = datetime.datetime.now().strftime("%Y")
|
||||||
RSSMovie['year'] = currentYear
|
RSSMovie['year'] = currentYear
|
||||||
|
|
||||||
log.info('Release found: %s.' % RSSMovie)
|
log.debug('Release found: %s.', RSSMovie)
|
||||||
imdb = self.getIMDBFromTitle(RSSMovie['name'] + ' ' + RSSMovie['year'])
|
imdb = self.getIMDBFromTitle(RSSMovie['name'], RSSMovie['year'])
|
||||||
|
|
||||||
if imdb:
|
if imdb:
|
||||||
movies.append(imdb['imdb'])
|
movies.append(imdb['imdb'])
|
||||||
|
|||||||
Reference in New Issue
Block a user