Zero fill identifier when adding movie

This commit is contained in:
Ruud
2014-03-09 23:39:46 +01:00
parent 61edcfe4f3
commit 58f198ddad
2 changed files with 10 additions and 3 deletions

View File

@@ -337,9 +337,13 @@ class Database(object):
'profile_id': profile_id,
'category_id': category_id,
'title': title
}, force_readd = False, search_after = False, update_after = False, notify_after = False, status = status, single = True)
added_media['files'] = added_media.get('files', {})
}, force_readd = False, search_after = False, update_after = False, notify_after = False, status = status, single = True)
if not added_media:
log.error('Failed adding media %s: %s', (l.get('identifier'), info))
continue
added_media['files'] = added_media.get('files', {})
for f in files:
ffile = all_files[f.get('file_id')]

View File

@@ -4,7 +4,7 @@ from couchpotato import get_db
from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, fireEventAsync, addEvent
from couchpotato.core.helpers.encoding import toUnicode
from couchpotato.core.helpers.variable import splitString, getTitle
from couchpotato.core.helpers.variable import splitString, getTitle, getImdb
from couchpotato.core.logger import CPLog
from couchpotato.core.media.movie import MovieTypeBase
import time
@@ -49,6 +49,9 @@ class MovieBase(MovieTypeBase):
def add(self, params = None, force_readd = True, search_after = True, update_after = True, notify_after = True, status = None):
if not params: params = {}
# Make sure it's a correct zero filled imdb id
params['identifier'] = getImdb(params.get('identifier', ''))
if not params.get('identifier'):
msg = 'Can\'t add movie without imdb identifier.'
log.error(msg)