forked from 0x2620/pandora
director is a list
This commit is contained in:
parent
2aad7ea984
commit
8f1ac057f5
2 changed files with 9 additions and 1 deletions
|
@ -243,6 +243,11 @@ def moveFiles(request):
|
||||||
else:
|
else:
|
||||||
if len(data['itemId']) != 7:
|
if len(data['itemId']) != 7:
|
||||||
del data['itemId']
|
del data['itemId']
|
||||||
|
if 'director' in data and isinstance(data['director'], basestring):
|
||||||
|
if data['director'] == '':
|
||||||
|
data['director'] = []
|
||||||
|
else:
|
||||||
|
data['director'] = data['director'].split(', ')
|
||||||
i = get_item(data)
|
i = get_item(data)
|
||||||
else:
|
else:
|
||||||
i = get_item({'imdbId': data['itemId']})
|
i = get_item({'imdbId': data['itemId']})
|
||||||
|
|
|
@ -61,6 +61,9 @@ def get_item(info, user=None):
|
||||||
q = Item.objects.all()
|
q = Item.objects.all()
|
||||||
for key in ('title', 'director', 'year'):
|
for key in ('title', 'director', 'year'):
|
||||||
if key in info and info[key]:
|
if key in info and info[key]:
|
||||||
|
if isinstance(info[key], list):
|
||||||
|
q = q.filter(find__key=key, find__value='\n'.join(info[key]))
|
||||||
|
else:
|
||||||
q = q.filter(find__key=key, find__value=info[key])
|
q = q.filter(find__key=key, find__value=info[key])
|
||||||
if q.count() >= 1:
|
if q.count() >= 1:
|
||||||
item = q[0]
|
item = q[0]
|
||||||
|
|
Loading…
Reference in a new issue