From 057b941c86c759da9922e361ce300023101ae74c Mon Sep 17 00:00:00 2001 From: Ruud Date: Wed, 13 Jun 2012 15:33:19 +0200 Subject: [PATCH] Don't add movies without imdb id --- couchpotato/core/plugins/movie/main.py | 6 +++++- couchpotato/core/plugins/movie/static/search.js | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/couchpotato/core/plugins/movie/main.py b/couchpotato/core/plugins/movie/main.py index d1092b5..62d6769 100644 --- a/couchpotato/core/plugins/movie/main.py +++ b/couchpotato/core/plugins/movie/main.py @@ -280,6 +280,10 @@ class MoviePlugin(Plugin): def add(self, params = {}, force_readd = True, search_after = True): + if not params.get('identifier'): + log.error('Can\'t add movie without imdb identifier.') + return False + library = fireEvent('library.add', single = True, attrs = params, update_after = False) # Status @@ -352,7 +356,7 @@ class MoviePlugin(Plugin): return jsonified({ 'success': True, - 'added': True, + 'added': True if movie_dict else False, 'movie': movie_dict, }) diff --git a/couchpotato/core/plugins/movie/static/search.js b/couchpotato/core/plugins/movie/static/search.js index bfb3b0d..6c6c94e 100644 --- a/couchpotato/core/plugins/movie/static/search.js +++ b/couchpotato/core/plugins/movie/static/search.js @@ -301,11 +301,11 @@ Block.Search.Item = new Class({ 'title': self.title_select.get('value'), 'profile_id': self.profile_select.get('value') }, - 'onComplete': function(){ + 'onComplete': function(json){ self.options.empty(); self.options.adopt( new Element('div.message', { - 'text': 'Movie succesfully added.' + 'text': json.added ? 'Movie succesfully added.' : 'Movie didn\'t add properly. Check logs' }) ); },