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.adopt(
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');
@@ -10,7 +10,7 @@ from couchpotato.core.helpers.variable import splitString, tryInt, tryFloat
from couchpotato.core.logger import CPLog
from couchpotato.core.media.show.providers.base import ShowProvider
from tvdb_api import tvdb_exceptions
from tvdb_api.tvdb_api import Tvdb
from tvdb_api.tvdb_api import Tvdb, Show
log = CPLog(__name__)
@@ -269,17 +269,20 @@ class TheTVDb(ShowProvider):
show_data = dict((k, v) for k, v in show_data.iteritems() if v)
# Parse season and episode data
show_data['seasons'] = {}
# Only load season info when available
if type(show) == Show:
for season_nr in show:
season = self._parseSeason(show, season_nr, show[season_nr])
season['episodes'] = {}
# Parse season and episode data
show_data['seasons'] = {}
for episode_nr in show[season_nr]:
season['episodes'][episode_nr] = self._parseEpisode(show[season_nr][episode_nr])
for season_nr in show:
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
# try:
@@ -313,7 +316,7 @@ class TheTVDb(ShowProvider):
season_data = {
'identifiers': {
'thetvdb': show[number][1]['seasonid']
'thetvdb': show.get('seriesid') if show.get('seriesid') else show[number][1]['seasonid']
},
'number': number,
'images': {