Browse Source

Delete show provider

pull/2139/merge
Ruud 12 years ago
parent
commit
060859483a
  1. 0
      couchpotato/core/providers/show/__init__.py
  2. 7
      couchpotato/core/providers/show/_modifier/__init__.py
  3. 94
      couchpotato/core/providers/show/_modifier/main.py
  4. 5
      couchpotato/core/providers/show/base.py

0
couchpotato/core/providers/show/__init__.py

7
couchpotato/core/providers/show/_modifier/__init__.py

@ -1,7 +0,0 @@
from .main import ShowResultModifier
def start():
return ShowResultModifier()
config = []

94
couchpotato/core/providers/show/_modifier/main.py

@ -1,94 +0,0 @@
from couchpotato import get_session
from couchpotato.core.event import addEvent, fireEvent
from couchpotato.core.helpers.variable import mergeDicts, randomString
from couchpotato.core.logger import CPLog
from couchpotato.core.plugins.base import Plugin
from couchpotato.core.settings.model import Library
import copy
import traceback
log = CPLog(__name__)
class ShowResultModifier(Plugin):
default_info = {
'tmdb_id': 0,
'titles': [],
'original_title': '',
'year': 0,
'images': {
'poster': [],
'backdrop': [],
'poster_original': [],
'backdrop_original': []
},
'runtime': 0,
'plot': '',
'tagline': '',
'imdb': '',
'genres': [],
}
def __init__(self):
addEvent('result.modify.show.search', self.combineOnIMDB)
addEvent('result.modify.show.info', self.checkLibrary)
def combineOnIMDB(self, results):
temp = {}
order = []
# Combine on imdb id
for item in results:
random_string = randomString()
imdb = item.get('imdb', random_string)
imdb = imdb if imdb else random_string
if not temp.get(imdb):
temp[imdb] = self.getLibraryTags(imdb)
order.append(imdb)
# Merge dicts
temp[imdb] = mergeDicts(temp[imdb], item)
# Make it a list again
temp_list = [temp[x] for x in order]
return temp_list
def getLibraryTags(self, imdb):
temp = {
'in_wanted': False,
'in_library': False,
}
# Add release info from current library
db = get_session()
try:
l = db.query(Library).filter_by(identifier = imdb).first()
if l:
# Statuses
active_status, done_status = fireEvent('status.get', ['active', 'done'], single = True)
for movie in l.media:
if movie.status_id == active_status['id']:
temp['in_wanted'] = fireEvent('movie.get', movie.id, single = True)
for release in movie.releases:
if release.status_id == done_status['id']:
temp['in_library'] = fireEvent('movie.get', movie.id, single = True)
except:
log.error('Tried getting more info on searched movies: %s', traceback.format_exc())
return temp
def checkLibrary(self, result):
result = mergeDicts(copy.deepcopy(self.default_info), copy.deepcopy(result))
if result and result.get('imdb'):
return mergeDicts(result, self.getLibraryTags(result['imdb']))
return result

5
couchpotato/core/providers/show/base.py

@ -1,5 +0,0 @@
from couchpotato.core.providers.base import Provider
class ShowProvider(Provider):
type = 'show'
Loading…
Cancel
Save