Zero fill identifier when adding movie

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

No files matched your search

+6 -2
View File
@@ -337,9 +337,13 @@ class Database(object):
'profile_id': profile_id, 'profile_id': profile_id,
'category_id': category_id, 'category_id': category_id,
'title': title 'title': title
}, force_readd = False, search_after = False, update_after = False, notify_after = False, status = status, single = True) }, force_readd = False, search_after = False, update_after = False, notify_after = False, status = status, single = True)
added_media['files'] = added_media.get('files', {})
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: for f in files:
ffile = all_files[f.get('file_id')] ffile = all_files[f.get('file_id')]
+4 -1
View File
@@ -4,7 +4,7 @@ from couchpotato import get_db
from couchpotato.api import addApiView from couchpotato.api import addApiView
from couchpotato.core.event import fireEvent, fireEventAsync, addEvent from couchpotato.core.event import fireEvent, fireEventAsync, addEvent
from couchpotato.core.helpers.encoding import toUnicode 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.logger import CPLog
from couchpotato.core.media.movie import MovieTypeBase from couchpotato.core.media.movie import MovieTypeBase
import time 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): def add(self, params = None, force_readd = True, search_after = True, update_after = True, notify_after = True, status = None):
if not params: params = {} 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'): if not params.get('identifier'):
msg = 'Can\'t add movie without imdb identifier.' msg = 'Can\'t add movie without imdb identifier.'
log.error(msg) log.error(msg)