merge
This commit is contained in:
commit
cb83a8a478
3 changed files with 24 additions and 19 deletions
|
@ -108,11 +108,13 @@ class Annotation(models.Model):
|
||||||
def set_public_id(self):
|
def set_public_id(self):
|
||||||
public_id = Annotation.objects.filter(item=self.item, id__lt=self.id).count()
|
public_id = Annotation.objects.filter(item=self.item, id__lt=self.id).count()
|
||||||
self.public_id = "%s/%s" % ( self.item.itemId, ox.to26(public_id))
|
self.public_id = "%s/%s" % ( self.item.itemId, ox.to26(public_id))
|
||||||
|
Annotation.objects.filter(id=self.id).update(public_id=public_id)
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
if not self.id:
|
if not self.id:
|
||||||
super(Annotation, self).save(*args, **kwargs)
|
set_public_id = True
|
||||||
self.set_public_id()
|
else:
|
||||||
|
set_public_id = False
|
||||||
|
|
||||||
#no clip or update clip
|
#no clip or update clip
|
||||||
if not self.clip and not self.layer.private or \
|
if not self.clip and not self.layer.private or \
|
||||||
|
@ -121,6 +123,8 @@ class Annotation(models.Model):
|
||||||
self.clip, created = Clip.get_or_create(self.item, self.start, self.end)
|
self.clip, created = Clip.get_or_create(self.item, self.start, self.end)
|
||||||
|
|
||||||
super(Annotation, self).save(*args, **kwargs)
|
super(Annotation, self).save(*args, **kwargs)
|
||||||
|
if set_public_id:
|
||||||
|
self.set_public_id()
|
||||||
|
|
||||||
def json(self, layer=False, keys=None):
|
def json(self, layer=False, keys=None):
|
||||||
j = {
|
j = {
|
||||||
|
|
|
@ -122,7 +122,7 @@ class File(models.Model):
|
||||||
self.pixels = int(self.width * self.height * float(utils.parse_decimal(self.framerate)) * self.duration)
|
self.pixels = int(self.width * self.height * float(utils.parse_decimal(self.framerate)) * self.duration)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.is_video = os.path.splitext(self.path)[-1] in ('.avi', '.mkv', '.dv', '.ogv', '.mpeg', '.mov', '.webm')
|
self.is_video = os.path.splitext(self.path)[-1] in ('.avi', '.mkv', '.dv', '.ogv', '.mpeg', '.mov', '.webm', '.mp4', '.mpg')
|
||||||
self.is_audio = os.path.splitext(self.path)[-1] in ('.mp3', '.wav', '.ogg', '.flac', '.oga')
|
self.is_audio = os.path.splitext(self.path)[-1] in ('.mp3', '.wav', '.ogg', '.flac', '.oga')
|
||||||
self.is_subtitle = os.path.splitext(self.path)[-1] in ('.srt', )
|
self.is_subtitle = os.path.splitext(self.path)[-1] in ('.srt', )
|
||||||
|
|
||||||
|
|
|
@ -511,11 +511,12 @@ class Item(models.Model):
|
||||||
ItemFind.objects.filter(item=self, key=key).delete()
|
ItemFind.objects.filter(item=self, key=key).delete()
|
||||||
|
|
||||||
for key in settings.CONFIG['itemKeys']:
|
for key in settings.CONFIG['itemKeys']:
|
||||||
if key.get('find'):
|
|
||||||
i = key['id']
|
i = key['id']
|
||||||
if i == 'title':
|
if i == 'title':
|
||||||
save(i, u'\n'.join([self.get('title', 'Untitled'),
|
save(i, u'\n'.join([self.get('title', 'Untitled'),
|
||||||
self.get('originalTitle', '')]))
|
self.get('originalTitle', '')]))
|
||||||
|
elif i == 'rightslevel':
|
||||||
|
save(i, self.level)
|
||||||
elif i == 'filename':
|
elif i == 'filename':
|
||||||
save(i,
|
save(i,
|
||||||
'\n'.join([f.path for f in self.files.all()]))
|
'\n'.join([f.path for f in self.files.all()]))
|
||||||
|
|
Loading…
Reference in a new issue