save info into right place

This commit is contained in:
j 2013-02-08 17:51:12 +00:00
parent bf1a4102c1
commit 2bb7fe3a75
2 changed files with 4 additions and 5 deletions

View file

@ -151,11 +151,11 @@ class File(models.Model):
data['directorSort'] = [get_name_sort(n) for n in self.item.get('director', [])] data['directorSort'] = [get_name_sort(n) for n in self.item.get('director', [])]
data['isEpisode'] = data.get('season') != None \ data['isEpisode'] = data.get('season') != None \
or data.get('episode') != None \ or data.get('episode') != None \
or data.get('episodes') != [] or data.get('episodes') not in ([], None)
if data['isEpisode'] and data['seriesYear'] == None: if data['isEpisode'] and data['seriesYear'] == None:
data['seriesYear'] = data['year'] data['seriesYear'] = data['year']
data['type'] = 'unknown' data['type'] = 'unknown'
if 'extension' in data: if 'extension' in data and data['extension']:
data['extension'] = data['extension'].lower() data['extension'] = data['extension'].lower()
for type in ox.movie.EXTENSIONS: for type in ox.movie.EXTENSIONS:
if data['extension'] in ox.movie.EXTENSIONS[type]: if data['extension'] in ox.movie.EXTENSIONS[type]:

View file

@ -95,7 +95,6 @@ def update(request):
files = all_files.filter(file__available=False) files = all_files.filter(file__available=False)
if volume: if volume:
files = files.filter(volume=volume) files = files.filter(volume=volume)
#fixme: might be better to check for file__path_info
response['data']['info'] = [f.file.oshash for f in all_files.filter(file__info='{}')] response['data']['info'] = [f.file.oshash for f in all_files.filter(file__info='{}')]
response['data']['data'] = [f.file.oshash for f in files.filter(file__is_video=True, response['data']['data'] = [f.file.oshash for f in files.filter(file__is_video=True,
file__available=False, file__available=False,
@ -369,9 +368,9 @@ def editFiles(request):
else: else:
dont_ignore.append(info['id']) dont_ignore.append(info['id'])
update = False update = False
for key in ('episodes', 'extension', 'language', 'part', 'partTitle', 'version'): for key in f.PATH_INFO:
if key in info: if key in info:
f.path_info[key] = info[key] f.info[key] = info[key]
update = True update = True
if update: if update:
f.save() f.save()