allow updates of file metadata for files with info

This commit is contained in:
j 2015-02-21 15:35:01 +05:30
parent 6aa04ca73b
commit 441cb9892a
3 changed files with 20 additions and 20 deletions

View file

@ -208,6 +208,7 @@ class File(models.Model):
return p[0]['normalizedPath']
def update_info(self, info, user):
if not self.info:
#populate name sort with director if unknown
if info.get('director') and info.get('directorSort'):
for name, sortname in zip(info['director'], info['directorSort']):

View file

@ -85,7 +85,6 @@ def update_info(user, info):
user = models.User.objects.get(username=user)
files = models.File.objects.filter(oshash__in=info.keys())
for f in files:
if not f.info:
f.update_info(info[f.oshash], user)
f.save()
for i in Item.objects.filter(files__in=files).distinct():

View file

@ -8,7 +8,7 @@ from django import forms
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template import RequestContext
from django.conf import settings
from django.db.models import Count
from django.db.models import Count, Q
import ox
from ox.utils import json
@ -95,7 +95,7 @@ def update(request, data):
files = all_files.filter(file__available=False)
if volume:
files = files.filter(volume=volume)
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(Q(file__info='{}')|Q(file__size=0))]
response['data']['data'] = [f.file.oshash for f in files.filter(file__is_video=True,
file__available=False,
file__wanted=True)]