import cleanup
This commit is contained in:
parent
f36e0f56ee
commit
00c8db1a19
8 changed files with 33 additions and 28 deletions
|
@ -7,7 +7,6 @@ from django.contrib.auth.models import User
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
|
||||||
class Layer(models.Model):
|
class Layer(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
from item.models import *
|
|
||||||
|
|
||||||
|
|
|
@ -78,24 +78,28 @@ class File(models.Model):
|
||||||
setattr(self, key, self.info.get(key, 0))
|
setattr(self, key, self.info.get(key, 0))
|
||||||
|
|
||||||
if 'video' in self.info and self.info['video']:
|
if 'video' in self.info and self.info['video']:
|
||||||
self.video_codec = self.info['video'][0]['codec']
|
video = self.info['video'][0]
|
||||||
self.width = self.info['video'][0]['width']
|
self.video_codec = video['codec']
|
||||||
self.height = self.info['video'][0]['height']
|
self.width = video['width']
|
||||||
self.framerate = self.info['video'][0]['framerate']
|
self.height = video['height']
|
||||||
if 'display_aspect_ratio' in self.info['video'][0]:
|
self.framerate = video['framerate']
|
||||||
self.display_aspect_ratio = self.info['video'][0]['display_aspect_ratio']
|
if 'display_aspect_ratio' in video:
|
||||||
|
self.display_aspect_ratio = video['display_aspect_ratio']
|
||||||
else:
|
else:
|
||||||
self.display_aspect_ratio = "%s:%s" % (self.width, self.height)
|
self.display_aspect_ratio = "%s:%s" % (self.width, self.height)
|
||||||
self.is_video = True
|
self.is_video = True
|
||||||
self.is_audio = False
|
self.is_audio = False
|
||||||
if self.name.endswith('.jpg') or self.name.endswith('.png') or self.duration == 0.04:
|
if self.name.endswith('.jpg') or \
|
||||||
|
self.name.endswith('.png') or \
|
||||||
|
self.duration == 0.04:
|
||||||
self.is_video = False
|
self.is_video = False
|
||||||
else:
|
else:
|
||||||
self.is_video = False
|
self.is_video = False
|
||||||
if 'audio' in self.info and self.info['audio']:
|
if 'audio' in self.info and self.info['audio']:
|
||||||
self.audio_codec = self.info['audio'][0]['codec']
|
audio = self.info['audio'][0]
|
||||||
self.samplerate = self.info['audio'][0].get('samplerate', 0)
|
self.audio_codec = audio['codec']
|
||||||
self.channels = self.info['audio'][0].get('channels', 0)
|
self.samplerate = audio.get('samplerate', 0)
|
||||||
|
self.channels = audio.get('channels', 0)
|
||||||
|
|
||||||
if not self.is_video:
|
if not self.is_video:
|
||||||
self.is_audio = True
|
self.is_audio = True
|
||||||
|
@ -118,8 +122,10 @@ class File(models.Model):
|
||||||
super(File, self).save(*args, **kwargs)
|
super(File, self).save(*args, **kwargs)
|
||||||
|
|
||||||
#upload and data handling
|
#upload and data handling
|
||||||
video = models.FileField(null=True, blank=True, upload_to=lambda f, x: f.path('%s.webm'%settings.VIDEO_PROFILE))
|
video = models.FileField(null=True, blank=True,
|
||||||
data = models.FileField(null=True, blank=True, upload_to=lambda f, x: f.path('data.bin'))
|
upload_to=lambda f, x: f.path('%s.webm'%settings.VIDEO_PROFILE))
|
||||||
|
data = models.FileField(null=True, blank=True,
|
||||||
|
upload_to=lambda f, x: f.path('data.bin'))
|
||||||
|
|
||||||
def path(self, name):
|
def path(self, name):
|
||||||
h = self.oshash
|
h = self.oshash
|
||||||
|
@ -297,4 +303,4 @@ class Frame(models.Model):
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u'%s at %s' % (self.file, self.position)
|
return u'%s/%s' % (self.file, self.position)
|
||||||
|
|
|
@ -6,7 +6,6 @@ from datetime import datetime
|
||||||
import os.path
|
import os.path
|
||||||
import subprocess
|
import subprocess
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import unicodedata
|
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.files.base import ContentFile
|
from django.core.files.base import ContentFile
|
||||||
|
@ -24,7 +23,7 @@ import utils
|
||||||
import tasks
|
import tasks
|
||||||
from archive import extract
|
from archive import extract
|
||||||
|
|
||||||
from annotaion.models import Annotation, Layer
|
from annotaion.models import Annotation
|
||||||
from person.models import get_name_sort
|
from person.models import get_name_sort
|
||||||
from app.models import site_config
|
from app.models import site_config
|
||||||
|
|
||||||
|
@ -103,13 +102,15 @@ class Item(models.Model):
|
||||||
external_data = fields.DictField(default={}, editable=False)
|
external_data = fields.DictField(default={}, editable=False)
|
||||||
data = fields.DictField(default={}, editable=False)
|
data = fields.DictField(default={}, editable=False)
|
||||||
json = fields.DictField(default={}, editable=False)
|
json = fields.DictField(default={}, editable=False)
|
||||||
poster = models.ImageField(default=None, blank=True, upload_to=lambda i, x: i.path("poster.jpg"))
|
poster = models.ImageField(default=None, blank=True,
|
||||||
|
upload_to=lambda i, x: i.path("poster.jpg"))
|
||||||
poster_url = models.TextField(blank=True)
|
poster_url = models.TextField(blank=True)
|
||||||
poster_height = models.IntegerField(default=0)
|
poster_height = models.IntegerField(default=0)
|
||||||
poster_width = models.IntegerField(default=0)
|
poster_width = models.IntegerField(default=0)
|
||||||
poster_frame = models.FloatField(default=-1)
|
poster_frame = models.FloatField(default=-1)
|
||||||
|
|
||||||
icon = models.ImageField(default=None, blank=True, upload_to=lambda i, x: i.path("icon.jpg"))
|
icon = models.ImageField(default=None, blank=True,
|
||||||
|
upload_to=lambda i, x: i.path("icon.jpg"))
|
||||||
|
|
||||||
#stream related fields
|
#stream related fields
|
||||||
stream_aspect = models.FloatField(default=4/3)
|
stream_aspect = models.FloatField(default=4/3)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from __future__ import division, with_statement
|
from __future__ import division, with_statement
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -26,7 +28,8 @@ class List(models.Model):
|
||||||
type= models.CharField(max_length=255, default='static')
|
type= models.CharField(max_length=255, default='static')
|
||||||
description = models.TextField(default='')
|
description = models.TextField(default='')
|
||||||
|
|
||||||
icon = models.ImageField(default=None, blank=True, upload_to=lambda i, x: i.path("icon.jpg"))
|
icon = models.ImageField(default=None, blank=True,
|
||||||
|
upload_to=lambda i, x: i.path("icon.jpg"))
|
||||||
|
|
||||||
#is through table still required?
|
#is through table still required?
|
||||||
items = models.ManyToManyField('item.Item', related_name='lists',
|
items = models.ManyToManyField('item.Item', related_name='lists',
|
||||||
|
@ -73,7 +76,9 @@ class List(models.Model):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def json(self, keys=['id', 'name', 'user', 'type', 'query', 'status', 'subscribed'], user=None):
|
def json(self, keys=None, user=None):
|
||||||
|
if not keys:
|
||||||
|
keys=['id', 'name', 'user', 'type', 'query', 'status', 'subscribed']
|
||||||
response = {}
|
response = {}
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if key == 'items':
|
if key == 'items':
|
||||||
|
@ -98,7 +103,7 @@ class List(models.Model):
|
||||||
|
|
||||||
def make_icon(self):
|
def make_icon(self):
|
||||||
frames = []
|
frames = []
|
||||||
iself.icon.name = self.path('icon.png')
|
self.icon.name = self.path('icon.png')
|
||||||
icon = self.icon.path
|
icon = self.icon.path
|
||||||
if frames:
|
if frames:
|
||||||
cmd = [
|
cmd = [
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from ox.utils import json
|
|
||||||
from ox.django.fields import DictField
|
from ox.django.fields import DictField
|
||||||
|
|
||||||
from app.models import site_config
|
from app.models import site_config
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
random.seed()
|
random.seed()
|
||||||
|
|
||||||
|
|
|
@ -3649,4 +3649,4 @@ var pandora = new Ox.App({
|
||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
});
|
//});
|
||||||
|
|
Loading…
Reference in a new issue