Use correct key to check success

This commit is contained in:
Ruud
2014-04-05 10:39:20 +02:00
parent 7410288781
commit b23db7541d
2 changed files with 14 additions and 11 deletions
@@ -108,7 +108,7 @@ Block.Search.ShowItem = new Class({
self.options_el.empty(); self.options_el.empty();
self.options_el.adopt( self.options_el.adopt(
new Element('div.message', { new Element('div.message', {
'text': json.added ? 'Show successfully added.' : 'Show didn\'t add properly. Check logs' 'text': json.success ? 'Show successfully added.' : 'Show didn\'t add properly. Check logs'
}) })
); );
self.mask.fade('out'); self.mask.fade('out');
@@ -10,7 +10,7 @@ from couchpotato.core.helpers.variable import splitString, tryInt, tryFloat
from couchpotato.core.logger import CPLog from couchpotato.core.logger import CPLog
from couchpotato.core.media.show.providers.base import ShowProvider from couchpotato.core.media.show.providers.base import ShowProvider
from tvdb_api import tvdb_exceptions from tvdb_api import tvdb_exceptions
from tvdb_api.tvdb_api import Tvdb from tvdb_api.tvdb_api import Tvdb, Show
log = CPLog(__name__) log = CPLog(__name__)
@@ -269,17 +269,20 @@ class TheTVDb(ShowProvider):
show_data = dict((k, v) for k, v in show_data.iteritems() if v) show_data = dict((k, v) for k, v in show_data.iteritems() if v)
# Parse season and episode data # Only load season info when available
show_data['seasons'] = {} if type(show) == Show:
for season_nr in show: # Parse season and episode data
season = self._parseSeason(show, season_nr, show[season_nr]) show_data['seasons'] = {}
season['episodes'] = {}
for episode_nr in show[season_nr]: for season_nr in show:
season['episodes'][episode_nr] = self._parseEpisode(show[season_nr][episode_nr]) season = self._parseSeason(show, season_nr, show[season_nr])
season['episodes'] = {}
show_data['seasons'][season_nr] = season for episode_nr in show[season_nr]:
season['episodes'][episode_nr] = self._parseEpisode(show[season_nr][episode_nr])
show_data['seasons'][season_nr] = season
# Add alternative titles # Add alternative titles
# try: # try:
@@ -313,7 +316,7 @@ class TheTVDb(ShowProvider):
season_data = { season_data = {
'identifiers': { 'identifiers': {
'thetvdb': show[number][1]['seasonid'] 'thetvdb': show.get('seriesid') if show.get('seriesid') else show[number][1]['seasonid']
}, },
'number': number, 'number': number,
'images': { 'images': {