forked from 0x2620/pandora
bring archive in line with OxFF api
This commit is contained in:
parent
253a401e9b
commit
480f4fec30
7 changed files with 941 additions and 94 deletions
|
@ -14,12 +14,8 @@ class FileAdmin(admin.ModelAdmin):
|
||||||
admin.site.register(models.File, FileAdmin)
|
admin.site.register(models.File, FileAdmin)
|
||||||
|
|
||||||
class FileInstanceAdmin(admin.ModelAdmin):
|
class FileInstanceAdmin(admin.ModelAdmin):
|
||||||
search_fields = ['path', 'archive__name']
|
search_fields = ['path', 'volume__name']
|
||||||
#form = ArchiveFileAdminForm
|
#form = ArchiveFileAdminForm
|
||||||
|
|
||||||
admin.site.register(models.FileInstance, FileInstanceAdmin)
|
admin.site.register(models.FileInstance, FileInstanceAdmin)
|
||||||
|
|
||||||
class ArchiveAdmin(admin.ModelAdmin):
|
|
||||||
search_fields = ['name']
|
|
||||||
admin.site.register(models.Archive, ArchiveAdmin)
|
|
||||||
|
|
||||||
|
|
307
pandora/archive/migrations/0002_volume.py
Normal file
307
pandora/archive/migrations/0002_volume.py
Normal file
|
@ -0,0 +1,307 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Deleting model 'archive'
|
||||||
|
db.delete_table('archive_archive')
|
||||||
|
|
||||||
|
# Removing M2M table for field users on 'archive'
|
||||||
|
db.delete_table('archive_archive_users')
|
||||||
|
|
||||||
|
# Removing M2M table for field volumes on 'archive'
|
||||||
|
db.delete_table('archive_archive_volumes')
|
||||||
|
|
||||||
|
# Adding model 'Stream'
|
||||||
|
db.create_table('archive_stream', (
|
||||||
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
('file', self.gf('django.db.models.fields.related.ForeignKey')(related_name='streams', to=orm['archive.File'])),
|
||||||
|
('profile', self.gf('django.db.models.fields.CharField')(default='96p.webm', max_length=255)),
|
||||||
|
('video', self.gf('django.db.models.fields.files.FileField')(default=None, max_length=100, blank=True)),
|
||||||
|
('source', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='derivatives', blank=True, to=orm['archive.Stream'])),
|
||||||
|
('available', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True)),
|
||||||
|
))
|
||||||
|
db.send_create_signal('archive', ['Stream'])
|
||||||
|
|
||||||
|
# Deleting field 'volume.start'
|
||||||
|
db.delete_column('archive_volume', 'start')
|
||||||
|
|
||||||
|
# Deleting field 'volume.end'
|
||||||
|
db.delete_column('archive_volume', 'end')
|
||||||
|
|
||||||
|
# Adding field 'Volume.created'
|
||||||
|
db.add_column('archive_volume', 'created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2010, 8, 9, 14, 19, 30, 463275), blank=True), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'Volume.modified'
|
||||||
|
db.add_column('archive_volume', 'modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, default=datetime.datetime(2010, 8, 9, 14, 19, 42, 576261), blank=True), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'Volume.user'
|
||||||
|
db.add_column('archive_volume', 'user', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='volumes', to=orm['auth.User']), keep_default=False)
|
||||||
|
|
||||||
|
# Changing field 'Volume.name'
|
||||||
|
db.alter_column('archive_volume', 'name', self.gf('django.db.models.fields.CharField')(max_length=1024))
|
||||||
|
|
||||||
|
# Adding unique constraint on 'Volume', fields ['user', 'name']
|
||||||
|
db.create_unique('archive_volume', ['user_id', 'name'])
|
||||||
|
|
||||||
|
# Adding unique constraint on 'Frame', fields ['position', 'file']
|
||||||
|
db.create_unique('archive_frame', ['position', 'file_id'])
|
||||||
|
|
||||||
|
# Adding field 'File.available'
|
||||||
|
db.add_column('archive_file', 'available', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True), keep_default=False)
|
||||||
|
|
||||||
|
# Changing field 'File.info'
|
||||||
|
db.alter_column('archive_file', 'info', self.gf('oxdjango.fields.DictField')())
|
||||||
|
|
||||||
|
# Deleting field 'fileinstance.published'
|
||||||
|
db.delete_column('archive_fileinstance', 'published')
|
||||||
|
|
||||||
|
# Deleting field 'fileinstance.accessed'
|
||||||
|
db.delete_column('archive_fileinstance', 'accessed')
|
||||||
|
|
||||||
|
# Deleting field 'fileinstance.archive'
|
||||||
|
db.delete_column('archive_fileinstance', 'archive_id')
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.ctime'
|
||||||
|
db.add_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.mtime'
|
||||||
|
db.add_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.atime'
|
||||||
|
db.add_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.volume'
|
||||||
|
db.add_column('archive_fileinstance', 'volume', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Volume']), keep_default=False)
|
||||||
|
|
||||||
|
# Adding unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
||||||
|
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Adding model 'archive'
|
||||||
|
db.create_table('archive_archive', (
|
||||||
|
('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
|
||||||
|
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
|
||||||
|
('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='owned_archives', to=orm['auth.User'])),
|
||||||
|
('published', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
|
||||||
|
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
|
||||||
|
('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
|
||||||
|
))
|
||||||
|
db.send_create_signal('archive', ['archive'])
|
||||||
|
|
||||||
|
# Adding M2M table for field users on 'archive'
|
||||||
|
db.create_table('archive_archive_users', (
|
||||||
|
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
|
||||||
|
('archive', models.ForeignKey(orm['archive.archive'], null=False)),
|
||||||
|
('user', models.ForeignKey(orm['auth.user'], null=False))
|
||||||
|
))
|
||||||
|
db.create_unique('archive_archive_users', ['archive_id', 'user_id'])
|
||||||
|
|
||||||
|
# Adding M2M table for field volumes on 'archive'
|
||||||
|
db.create_table('archive_archive_volumes', (
|
||||||
|
('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
|
||||||
|
('archive', models.ForeignKey(orm['archive.archive'], null=False)),
|
||||||
|
('volume', models.ForeignKey(orm['archive.volume'], null=False))
|
||||||
|
))
|
||||||
|
db.create_unique('archive_archive_volumes', ['archive_id', 'volume_id'])
|
||||||
|
|
||||||
|
# Deleting model 'Stream'
|
||||||
|
db.delete_table('archive_stream')
|
||||||
|
|
||||||
|
# Adding field 'volume.start'
|
||||||
|
db.add_column('archive_volume', 'start', self.gf('django.db.models.fields.CharField')(default='', max_length=1), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'volume.end'
|
||||||
|
db.add_column('archive_volume', 'end', self.gf('django.db.models.fields.CharField')(default='', max_length=1), keep_default=False)
|
||||||
|
|
||||||
|
# Deleting field 'Volume.created'
|
||||||
|
db.delete_column('archive_volume', 'created')
|
||||||
|
|
||||||
|
# Deleting field 'Volume.modified'
|
||||||
|
db.delete_column('archive_volume', 'modified')
|
||||||
|
|
||||||
|
# Deleting field 'Volume.user'
|
||||||
|
db.delete_column('archive_volume', 'user_id')
|
||||||
|
|
||||||
|
# Changing field 'Volume.name'
|
||||||
|
db.alter_column('archive_volume', 'name', self.gf('django.db.models.fields.CharField')(max_length=255))
|
||||||
|
|
||||||
|
# Removing unique constraint on 'Volume', fields ['user', 'name']
|
||||||
|
db.delete_unique('archive_volume', ['user_id', 'name'])
|
||||||
|
|
||||||
|
# Removing unique constraint on 'Frame', fields ['position', 'file']
|
||||||
|
db.delete_unique('archive_frame', ['position', 'file_id'])
|
||||||
|
|
||||||
|
# Deleting field 'File.available'
|
||||||
|
db.delete_column('archive_file', 'available')
|
||||||
|
|
||||||
|
# Changing field 'File.info'
|
||||||
|
db.alter_column('archive_file', 'info', self.gf('fields.DictField')())
|
||||||
|
|
||||||
|
# Adding field 'fileinstance.published'
|
||||||
|
db.add_column('archive_fileinstance', 'published', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'fileinstance.accessed'
|
||||||
|
db.add_column('archive_fileinstance', 'accessed', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now), keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'fileinstance.archive'
|
||||||
|
db.add_column('archive_fileinstance', 'archive', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='files', to=orm['archive.Archive']), keep_default=False)
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.ctime'
|
||||||
|
db.delete_column('archive_fileinstance', 'ctime')
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.mtime'
|
||||||
|
db.delete_column('archive_fileinstance', 'mtime')
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.atime'
|
||||||
|
db.delete_column('archive_fileinstance', 'atime')
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.volume'
|
||||||
|
db.delete_column('archive_fileinstance', 'volume_id')
|
||||||
|
|
||||||
|
# Removing unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
||||||
|
db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'archive.file': {
|
||||||
|
'Meta': {'object_name': 'File'},
|
||||||
|
'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'bits_per_pixel': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'channels': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'display_aspect_ratio': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'duration': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '8'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['backend.Movie']"}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
|
||||||
|
'part': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'pixel_format': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'pixels': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'size': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'sort_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'archive.fileinstance': {
|
||||||
|
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
||||||
|
'atime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'ctime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': "orm['archive.File']"}),
|
||||||
|
'folder': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'mtime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'path': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
|
||||||
|
'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['archive.Volume']"})
|
||||||
|
},
|
||||||
|
'archive.frame': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'position'),)", 'object_name': 'Frame'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'frames'", 'to': "orm['archive.File']"}),
|
||||||
|
'frame': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'position': ('django.db.models.fields.FloatField', [], {})
|
||||||
|
},
|
||||||
|
'archive.stream': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'profile'),)", 'object_name': 'Stream'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['archive.File']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'profile': ('django.db.models.fields.CharField', [], {'default': "'96p.webm'", 'max_length': '255'}),
|
||||||
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'derivatives'", 'blank': 'True', 'to': "orm['archive.Stream']"}),
|
||||||
|
'video': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'archive.volume': {
|
||||||
|
'Meta': {'unique_together': "(('user', 'name'),)", 'object_name': 'Volume'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'backend.movie': {
|
||||||
|
'Meta': {'object_name': 'Movie'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||||
|
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||||
|
'poster': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'poster_frame': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'poster_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'poster_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'posters_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'published': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'stream_aspect': ('django.db.models.fields.FloatField', [], {'default': '1.3333333333333333'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['archive']
|
167
pandora/archive/migrations/0003_file_time.py
Normal file
167
pandora/archive/migrations/0003_file_time.py
Normal file
|
@ -0,0 +1,167 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.ctime'
|
||||||
|
db.alter_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.mtime'
|
||||||
|
db.alter_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.atime'
|
||||||
|
db.alter_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.IntegerField')())
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.ctime'
|
||||||
|
db.alter_column('archive_fileinstance', 'ctime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.mtime'
|
||||||
|
db.alter_column('archive_fileinstance', 'mtime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
|
# Changing field 'FileInstance.atime'
|
||||||
|
db.alter_column('archive_fileinstance', 'atime', self.gf('django.db.models.fields.DateTimeField')())
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'archive.file': {
|
||||||
|
'Meta': {'object_name': 'File'},
|
||||||
|
'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'bits_per_pixel': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'channels': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'display_aspect_ratio': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'duration': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '8'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['backend.Movie']"}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
|
||||||
|
'part': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'pixel_format': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'pixels': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'size': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'sort_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'archive.fileinstance': {
|
||||||
|
'Meta': {'unique_together': "(('path', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
||||||
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5094559'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5095601'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': "orm['archive.File']"}),
|
||||||
|
'folder': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'mtime': ('django.db.models.fields.IntegerField', [], {'default': '1281357186.5096569'}),
|
||||||
|
'path': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
|
||||||
|
'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['archive.Volume']"})
|
||||||
|
},
|
||||||
|
'archive.frame': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'position'),)", 'object_name': 'Frame'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'frames'", 'to': "orm['archive.File']"}),
|
||||||
|
'frame': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'position': ('django.db.models.fields.FloatField', [], {})
|
||||||
|
},
|
||||||
|
'archive.stream': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'profile'),)", 'object_name': 'Stream'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['archive.File']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'profile': ('django.db.models.fields.CharField', [], {'default': "'96p.webm'", 'max_length': '255'}),
|
||||||
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'derivatives'", 'blank': 'True', 'to': "orm['archive.Stream']"}),
|
||||||
|
'video': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'archive.volume': {
|
||||||
|
'Meta': {'unique_together': "(('user', 'name'),)", 'object_name': 'Volume'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'backend.movie': {
|
||||||
|
'Meta': {'object_name': 'Movie'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||||
|
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||||
|
'poster': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'poster_frame': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'poster_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'poster_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'posters_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'published': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'stream_aspect': ('django.db.models.fields.FloatField', [], {'default': '1.3333333333333333'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['archive']
|
173
pandora/archive/migrations/0004_file_name.py
Normal file
173
pandora/archive/migrations/0004_file_name.py
Normal file
|
@ -0,0 +1,173 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.path'
|
||||||
|
db.delete_column('archive_fileinstance', 'path')
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.name'
|
||||||
|
db.add_column('archive_fileinstance', 'name', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
||||||
|
|
||||||
|
# Removing unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
||||||
|
db.delete_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
# Adding unique constraint on 'FileInstance', fields ['volume', 'folder', 'name']
|
||||||
|
db.create_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Adding field 'FileInstance.path'
|
||||||
|
db.add_column('archive_fileinstance', 'path', self.gf('django.db.models.fields.CharField')(default='', max_length=2048), keep_default=False)
|
||||||
|
|
||||||
|
# Deleting field 'FileInstance.name'
|
||||||
|
db.delete_column('archive_fileinstance', 'name')
|
||||||
|
|
||||||
|
# Adding unique constraint on 'FileInstance', fields ['volume', 'path', 'folder']
|
||||||
|
db.create_unique('archive_fileinstance', ['volume_id', 'path', 'folder'])
|
||||||
|
|
||||||
|
# Removing unique constraint on 'FileInstance', fields ['volume', 'folder', 'name']
|
||||||
|
db.delete_unique('archive_fileinstance', ['volume_id', 'folder', 'name'])
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'archive.file': {
|
||||||
|
'Meta': {'object_name': 'File'},
|
||||||
|
'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'bits_per_pixel': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'channels': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'display_aspect_ratio': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'duration': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '8'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['backend.Movie']"}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'max_length': '16'}),
|
||||||
|
'part': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'pixel_format': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'pixels': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'size': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'sort_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'archive.fileinstance': {
|
||||||
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
||||||
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': "orm['archive.File']"}),
|
||||||
|
'folder': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'mtime': ('django.db.models.fields.IntegerField', [], {'default': '1281358260'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
|
||||||
|
'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['archive.Volume']"})
|
||||||
|
},
|
||||||
|
'archive.frame': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'position'),)", 'object_name': 'Frame'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'frames'", 'to': "orm['archive.File']"}),
|
||||||
|
'frame': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'position': ('django.db.models.fields.FloatField', [], {})
|
||||||
|
},
|
||||||
|
'archive.stream': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'profile'),)", 'object_name': 'Stream'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['archive.File']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'profile': ('django.db.models.fields.CharField', [], {'default': "'96p.webm'", 'max_length': '255'}),
|
||||||
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'derivatives'", 'blank': 'True', 'to': "orm['archive.Stream']"}),
|
||||||
|
'video': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'archive.volume': {
|
||||||
|
'Meta': {'unique_together': "(('user', 'name'),)", 'object_name': 'Volume'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'backend.movie': {
|
||||||
|
'Meta': {'object_name': 'Movie'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||||
|
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||||
|
'poster': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'poster_frame': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'poster_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'poster_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'posters_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'published': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'stream_aspect': ('django.db.models.fields.FloatField', [], {'default': '1.3333333333333333'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['archive']
|
155
pandora/archive/migrations/0005_oshash_unique.py
Normal file
155
pandora/archive/migrations/0005_oshash_unique.py
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
# encoding: utf-8
|
||||||
|
import datetime
|
||||||
|
from south.db import db
|
||||||
|
from south.v2 import SchemaMigration
|
||||||
|
from django.db import models
|
||||||
|
|
||||||
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
def forwards(self, orm):
|
||||||
|
|
||||||
|
# Adding unique constraint on 'File', fields ['oshash']
|
||||||
|
db.create_unique('archive_file', ['oshash'])
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
# Removing unique constraint on 'File', fields ['oshash']
|
||||||
|
db.delete_unique('archive_file', ['oshash'])
|
||||||
|
|
||||||
|
|
||||||
|
models = {
|
||||||
|
'archive.file': {
|
||||||
|
'Meta': {'object_name': 'File'},
|
||||||
|
'audio_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'bits_per_pixel': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'channels': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'display_aspect_ratio': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'duration': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'episode': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'framerate': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'info': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_extra': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_main': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_version': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '8'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movie': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['backend.Movie']"}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '16'}),
|
||||||
|
'part': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'pixel_format': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'pixels': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'season': ('django.db.models.fields.IntegerField', [], {'default': '-1'}),
|
||||||
|
'size': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'sort_name': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'archive.fileinstance': {
|
||||||
|
'Meta': {'unique_together': "(('name', 'folder', 'volume'),)", 'object_name': 'FileInstance'},
|
||||||
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': "orm['archive.File']"}),
|
||||||
|
'folder': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'mtime': ('django.db.models.fields.IntegerField', [], {'default': '1281372184'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
|
||||||
|
'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['archive.Volume']"})
|
||||||
|
},
|
||||||
|
'archive.frame': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'position'),)", 'object_name': 'Frame'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'frames'", 'to': "orm['archive.File']"}),
|
||||||
|
'frame': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'null': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'position': ('django.db.models.fields.FloatField', [], {})
|
||||||
|
},
|
||||||
|
'archive.stream': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'profile'),)", 'object_name': 'Stream'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['archive.File']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'profile': ('django.db.models.fields.CharField', [], {'default': "'96p.webm'", 'max_length': '255'}),
|
||||||
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'derivatives'", 'blank': 'True', 'to': "orm['archive.Stream']"}),
|
||||||
|
'video': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'archive.volume': {
|
||||||
|
'Meta': {'unique_together': "(('user', 'name'),)", 'object_name': 'Volume'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '1024'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'volumes'", 'to': "orm['auth.User']"})
|
||||||
|
},
|
||||||
|
'auth.group': {
|
||||||
|
'Meta': {'object_name': 'Group'},
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
|
||||||
|
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
|
||||||
|
},
|
||||||
|
'auth.user': {
|
||||||
|
'Meta': {'object_name': 'User'},
|
||||||
|
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
|
||||||
|
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}),
|
||||||
|
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
|
||||||
|
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
|
||||||
|
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
|
||||||
|
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
|
||||||
|
},
|
||||||
|
'backend.movie': {
|
||||||
|
'Meta': {'object_name': 'Movie'},
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'imdb': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'json': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'metadata': ('oxdjango.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'movieId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||||
|
'oxdbId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '42', 'blank': 'True'}),
|
||||||
|
'poster': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'poster_frame': ('django.db.models.fields.FloatField', [], {'default': '-1'}),
|
||||||
|
'poster_height': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'poster_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'posters_url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'published': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
|
||||||
|
'stream_aspect': ('django.db.models.fields.FloatField', [], {'default': '1.3333333333333333'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
|
||||||
|
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
|
||||||
|
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['archive']
|
|
@ -5,6 +5,7 @@ import os.path
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
import time
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
@ -30,43 +31,13 @@ def parse_decimal(string):
|
||||||
d = string.split('/')
|
d = string.split('/')
|
||||||
return Decimal(d[0]) / Decimal(d[1])
|
return Decimal(d[0]) / Decimal(d[1])
|
||||||
|
|
||||||
def stream_path(f):
|
|
||||||
h = f.oshash
|
|
||||||
return os.path.join('stream', h[:2], h[2:4], h[4:6], h[6:], f.profile)
|
|
||||||
|
|
||||||
class Stream(models.Model):
|
|
||||||
file = models.ForeignKey(File, related_name='streams')
|
|
||||||
profile = models.CharField(max_length=255, default='96p.webm')
|
|
||||||
video = models.FileField(default=None, blank=True, upload_to=lambda f, x: stream_path(f))
|
|
||||||
source = models.ForeignKey(Stream, related_name='derivatives', default=None, blank=True)
|
|
||||||
available = models.BooleanField(default=False)
|
|
||||||
|
|
||||||
def extract_derivates(self):
|
|
||||||
#here based on settings derivates like smaller versions or other formats would be created
|
|
||||||
|
|
||||||
def editable(self, user):
|
|
||||||
#FIXME: possibly needs user setting for stream
|
|
||||||
return True
|
|
||||||
|
|
||||||
def save_chunk(self, chunk, chunk_id=-1):
|
|
||||||
if not self.available:
|
|
||||||
if not self.video:
|
|
||||||
self.video.save(self.profile, ContentFile(chunk))
|
|
||||||
else:
|
|
||||||
f = open(self.file.path, 'a')
|
|
||||||
#FIXME: should check that chunk_id/offset is right
|
|
||||||
f.write(chunk)
|
|
||||||
f.close()
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
class File(models.Model):
|
class File(models.Model):
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
modified = models.DateTimeField(auto_now=True)
|
modified = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
verified = models.BooleanField(default=False)
|
verified = models.BooleanField(default=False)
|
||||||
|
|
||||||
oshash = models.CharField(max_length=16)
|
oshash = models.CharField(max_length=16, unique=True)
|
||||||
movie = models.ForeignKey(Movie, related_name='files')
|
movie = models.ForeignKey(Movie, related_name='files')
|
||||||
|
|
||||||
name = models.CharField(max_length=2048, default="") # canoncial path/file
|
name = models.CharField(max_length=2048, default="") # canoncial path/file
|
||||||
|
@ -76,11 +47,11 @@ class File(models.Model):
|
||||||
version = models.CharField(default="", max_length=255) # sort path/file name
|
version = models.CharField(default="", max_length=255) # sort path/file name
|
||||||
language = models.CharField(default="", max_length=8)
|
language = models.CharField(default="", max_length=8)
|
||||||
|
|
||||||
season = models.IntegerField(default = -1)
|
season = models.IntegerField(default=-1)
|
||||||
episode = models.IntegerField(default = -1)
|
episode = models.IntegerField(default=-1)
|
||||||
|
|
||||||
size = models.BigIntegerField(default = 0)
|
size = models.BigIntegerField(default=0)
|
||||||
duration = models.IntegerField(default = 0)
|
duration = models.IntegerField(default=0)
|
||||||
|
|
||||||
info = fields.DictField(default={})
|
info = fields.DictField(default={})
|
||||||
|
|
||||||
|
@ -92,8 +63,8 @@ class File(models.Model):
|
||||||
framerate = models.CharField(max_length=255)
|
framerate = models.CharField(max_length=255)
|
||||||
|
|
||||||
audio_codec = models.CharField(max_length=255)
|
audio_codec = models.CharField(max_length=255)
|
||||||
channels = models.IntegerField(default = 0)
|
channels = models.IntegerField(default=0)
|
||||||
samplerate = models.IntegerField(default = 0)
|
samplerate = models.IntegerField(default=0)
|
||||||
|
|
||||||
bits_per_pixel = models.FloatField(default=-1)
|
bits_per_pixel = models.FloatField(default=-1)
|
||||||
pixels = models.BigIntegerField(default=0)
|
pixels = models.BigIntegerField(default=0)
|
||||||
|
@ -101,13 +72,12 @@ class File(models.Model):
|
||||||
#This is true if derivative is available or subtitles where uploaded
|
#This is true if derivative is available or subtitles where uploaded
|
||||||
available = models.BooleanField(default = False)
|
available = models.BooleanField(default = False)
|
||||||
|
|
||||||
is_audio = models.BooleanField(default = False)
|
is_audio = models.BooleanField(default=False)
|
||||||
is_video = models.BooleanField(default = False)
|
is_video = models.BooleanField(default=False)
|
||||||
is_extra = models.BooleanField(default = False)
|
is_extra = models.BooleanField(default=False)
|
||||||
is_main = models.BooleanField(default = False)
|
is_main = models.BooleanField(default=False)
|
||||||
is_subtitle = models.BooleanField(default = False)
|
is_subtitle = models.BooleanField(default=False)
|
||||||
is_version = models.BooleanField(default = False)
|
is_version = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -148,7 +118,7 @@ class File(models.Model):
|
||||||
if not self.is_audio and not self.is_video and self.name.endswith('.srt'):
|
if not self.is_audio and not self.is_video and self.name.endswith('.srt'):
|
||||||
self.is_subtitle = True
|
self.is_subtitle = True
|
||||||
|
|
||||||
if self.name and self.name.startswith('Extra/'):
|
if self.name and self.name.startswith('Extras/'):
|
||||||
self.is_extra = True
|
self.is_extra = True
|
||||||
self.is_main = False
|
self.is_main = False
|
||||||
else:
|
else:
|
||||||
|
@ -163,22 +133,38 @@ class File(models.Model):
|
||||||
r[k] = unicode(self[k])
|
r[k] = unicode(self[k])
|
||||||
return r
|
return r
|
||||||
|
|
||||||
class FileInstance(models.Model):
|
class Volume(models.Model):
|
||||||
|
class Meta:
|
||||||
|
unique_together = ("user", "name")
|
||||||
|
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
modified = models.DateTimeField(auto_now=True)
|
modified = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
ctime = models.DateTimeField(default=datetime.now, editable=False)
|
user = models.ForeignKey(User, related_name='volumes')
|
||||||
mtime = models.DateTimeField(default=datetime.now, editable=False)
|
name = models.CharField(max_length=1024)
|
||||||
atime = models.DateTimeField(default=datetime.now, editable=False)
|
|
||||||
|
|
||||||
path = models.CharField(max_length=2048)
|
def __unicode__(self):
|
||||||
|
return u"%s's %s"% (self.user, self.name)
|
||||||
|
|
||||||
|
class FileInstance(models.Model):
|
||||||
|
class Meta:
|
||||||
|
unique_together = ("name", "folder", "volume")
|
||||||
|
|
||||||
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
|
modified = models.DateTimeField(auto_now=True)
|
||||||
|
|
||||||
|
atime = models.IntegerField(default=lambda: int(time.time()), editable=False)
|
||||||
|
ctime = models.IntegerField(default=lambda: int(time.time()), editable=False)
|
||||||
|
mtime = models.IntegerField(default=lambda: int(time.time()), editable=False)
|
||||||
|
|
||||||
|
name = models.CharField(max_length=2048)
|
||||||
folder = models.CharField(max_length=255)
|
folder = models.CharField(max_length=255)
|
||||||
|
|
||||||
file = models.ForeignKey(File, related_name='instances')
|
file = models.ForeignKey(File, related_name='instances')
|
||||||
user = models.ForeignKey(User, related_name='files')
|
volume = models.ForeignKey(Volume, related_name='files')
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return u"%s's %s <%s>"% (self.user, self.path, self.oshash)
|
return u"%s's %s <%s>"% (self.volume.user, self.name, self.file.oshash)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def movieId(self):
|
def movieId(self):
|
||||||
|
@ -191,6 +177,8 @@ def frame_path(f, name):
|
||||||
return os.path.join('frame', h[:2], h[2:4], h[4:6], name)
|
return os.path.join('frame', h[:2], h[2:4], h[4:6], name)
|
||||||
|
|
||||||
class Frame(models.Model):
|
class Frame(models.Model):
|
||||||
|
class Meta:
|
||||||
|
unique_together = ("file", "position")
|
||||||
created = models.DateTimeField(auto_now_add=True)
|
created = models.DateTimeField(auto_now_add=True)
|
||||||
modified = models.DateTimeField(auto_now=True)
|
modified = models.DateTimeField(auto_now=True)
|
||||||
file = models.ForeignKey(File, related_name="frames")
|
file = models.ForeignKey(File, related_name="frames")
|
||||||
|
@ -202,3 +190,37 @@ class Frame(models.Model):
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return '%s at %s' % (self.file, self.position)
|
return '%s at %s' % (self.file, self.position)
|
||||||
|
|
||||||
|
def stream_path(f):
|
||||||
|
h = f.oshash
|
||||||
|
return os.path.join('stream', h[:2], h[2:4], h[4:6], h[6:], f.profile)
|
||||||
|
|
||||||
|
class Stream(models.Model):
|
||||||
|
class Meta:
|
||||||
|
unique_together = ("file", "profile")
|
||||||
|
|
||||||
|
file = models.ForeignKey(File, related_name='streams')
|
||||||
|
profile = models.CharField(max_length=255, default='96p.webm')
|
||||||
|
video = models.FileField(default=None, blank=True, upload_to=lambda f, x: stream_path(f))
|
||||||
|
source = models.ForeignKey('Stream', related_name='derivatives', default=None, blank=True)
|
||||||
|
available = models.BooleanField(default=False)
|
||||||
|
|
||||||
|
def extract_derivates(self):
|
||||||
|
#here based on settings derivates like smaller versions or other formats would be created
|
||||||
|
return True
|
||||||
|
|
||||||
|
def editable(self, user):
|
||||||
|
#FIXME: possibly needs user setting for stream
|
||||||
|
return True
|
||||||
|
|
||||||
|
def save_chunk(self, chunk, chunk_id=-1):
|
||||||
|
if not self.available:
|
||||||
|
if not self.video:
|
||||||
|
self.video.save(self.profile, ContentFile(chunk))
|
||||||
|
else:
|
||||||
|
f = open(self.file.path, 'a')
|
||||||
|
#FIXME: should check that chunk_id/offset is right
|
||||||
|
f.write(chunk)
|
||||||
|
f.close()
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
|
@ -32,34 +32,62 @@ import models
|
||||||
from backend.utils import oxid, parse_path
|
from backend.utils import oxid, parse_path
|
||||||
import backend.models
|
import backend.models
|
||||||
|
|
||||||
#@login_required_json
|
@login_required_json
|
||||||
|
def api_removeVolume(request):
|
||||||
|
data = json.loads(request.POST['data'])
|
||||||
|
user = request.user
|
||||||
|
try:
|
||||||
|
volume = models.Volume.objects.get(user=user, name=data['volume'])
|
||||||
|
volume.files.delete()
|
||||||
|
volume.delete()
|
||||||
|
response = json_response(status=200, text='ok')
|
||||||
|
except models.Volume.DoesNotExist:
|
||||||
|
response = json_response(status=404, text='volume not found')
|
||||||
|
return render_to_json_response(response)
|
||||||
|
|
||||||
|
@login_required_json
|
||||||
def api_update(request):
|
def api_update(request):
|
||||||
'''
|
'''
|
||||||
//both are optional, idea is to have 2 requests first with files, and
|
2 calls possible:
|
||||||
after that with info for the requested oshashes
|
volume/files
|
||||||
|
info
|
||||||
|
call volume/files first and fill in requested info after that
|
||||||
|
|
||||||
param data
|
param data
|
||||||
|
volume: '',
|
||||||
files: [
|
files: [
|
||||||
{oshash:, name:, folder:, oshash:, ctime:, atime:, mtime:, }
|
{oshash:, path:, ctime:, atime:, mtime:, }
|
||||||
]
|
]
|
||||||
info: {oshash: object}
|
info: {oshash: object}
|
||||||
|
|
||||||
return {'status': {'code': int, 'text': string},
|
return {'status': {'code': int, 'text': string},
|
||||||
'data': {info: list, data: list, file: list}}
|
'data': {info: list, data: list, file: list}}
|
||||||
'''
|
'''
|
||||||
|
print "here we go fucker", request.user
|
||||||
data = json.loads(request.POST['data'])
|
data = json.loads(request.POST['data'])
|
||||||
user = request.user
|
user = request.user
|
||||||
|
|
||||||
response = json_response({'info': [], 'rename': [], 'file': []})
|
response = json_response({'info': [], 'data': [], 'file': []})
|
||||||
|
|
||||||
if 'files' in data:
|
if 'files' in data:
|
||||||
|
volume, created = models.Volume.objects.get_or_create(user=user, name=data['volume'])
|
||||||
all_files = []
|
all_files = []
|
||||||
for f in data['files']:
|
for f in data['files']:
|
||||||
folder = f['folder']
|
print f
|
||||||
name = f['name']
|
path = f['path']
|
||||||
|
folder = path.split('/')
|
||||||
|
name = folder.pop()
|
||||||
|
if folder and folder[-1] in ('Extras', 'Versions', 'DVDs'):
|
||||||
|
name = '/'.join([folder.pop(), name])
|
||||||
|
folder = '/'.join(folder)
|
||||||
|
print folder
|
||||||
|
print name
|
||||||
|
f['folder'] = folder
|
||||||
|
f['name'] = name
|
||||||
oshash = f['oshash']
|
oshash = f['oshash']
|
||||||
all_files.append(oshash)
|
all_files.append(oshash)
|
||||||
|
|
||||||
same_folder = models.FileInstance.objects.filter(folder=folder, user=user)
|
same_folder = models.FileInstance.objects.filter(folder=folder, volume=volume)
|
||||||
if same_folder.count() > 0:
|
if same_folder.count() > 0:
|
||||||
movie = same_folder[0].file.movie
|
movie = same_folder[0].file.movie
|
||||||
else:
|
else:
|
||||||
|
@ -67,7 +95,7 @@ def api_update(request):
|
||||||
|
|
||||||
path = os.path.join(folder, name)
|
path = os.path.join(folder, name)
|
||||||
|
|
||||||
instance = models.FileInstance.objects.filter(file__oshash=oshash, user=user)
|
instance = models.FileInstance.objects.filter(file__oshash=oshash, volume=volume)
|
||||||
if instance.count()>0:
|
if instance.count()>0:
|
||||||
instance = instance[0]
|
instance = instance[0]
|
||||||
updated = False
|
updated = False
|
||||||
|
@ -76,39 +104,33 @@ def api_update(request):
|
||||||
setattr(instance, key, f[key])
|
setattr(instance, key, f[key])
|
||||||
updated=True
|
updated=True
|
||||||
if updated:
|
if updated:
|
||||||
f.save()
|
instance.save()
|
||||||
else:
|
else:
|
||||||
#look if oshash is known
|
#look if oshash is known
|
||||||
file_object = models.File.objects.filter(oshash=oshash)
|
file_objects = models.File.objects.filter(oshash=oshash)
|
||||||
if file_object.count() > 0:
|
if file_objects.count() > 0:
|
||||||
file_object = file_object[0]
|
file_object = file_objects[0]
|
||||||
instance = models.FileInstance()
|
|
||||||
instance.file = file_object
|
|
||||||
for key in ('atime', 'mtime', 'ctime', 'name', 'folder'):
|
|
||||||
setattr(instance, key, f[key])
|
|
||||||
instance.save()
|
|
||||||
#new oshash, add to database
|
#new oshash, add to database
|
||||||
else:
|
else:
|
||||||
if not movie:
|
if not movie:
|
||||||
movie_info = parse_path(folder)
|
movie_info = parse_path(folder)
|
||||||
movie = backend.models.getMovie(movie_info)
|
movie = backend.models.getMovie(movie_info)
|
||||||
f = models.File()
|
file_object = models.File()
|
||||||
f.oshash = oshash
|
file_object.oshash = oshash
|
||||||
f.name = name
|
file_object.name = name
|
||||||
f.movie = movie
|
file_object.movie = movie
|
||||||
f.save()
|
file_object.save()
|
||||||
response['info'].append(oshash)
|
response['data']['info'].append(oshash)
|
||||||
|
instance = models.FileInstance()
|
||||||
instance = models.FileInstance()
|
instance.volume = volume
|
||||||
instance.user = user
|
instance.file = file_object
|
||||||
instance.file = f
|
for key in ('atime', 'mtime', 'ctime', 'name', 'folder'):
|
||||||
for key in ('atime', 'mtime', 'ctime', 'name', 'folder'):
|
setattr(instance, key, f[key])
|
||||||
setattr(instance, key, f[key])
|
instance.save()
|
||||||
instance.save()
|
|
||||||
|
|
||||||
#remove deleted files
|
#remove deleted files
|
||||||
#FIXME: can this have any bad consequences? i.e. on the selction of used movie files.
|
#FIXME: can this have any bad consequences? i.e. on the selction of used movie files.
|
||||||
models.FileInstance.objects.filter(user=user).exclude(file__oshash__in=all_files).delete()
|
models.FileInstance.objects.filter(volume=volume).exclude(file__oshash__in=all_files).delete()
|
||||||
|
|
||||||
user_profile = user.get_profile()
|
user_profile = user.get_profile()
|
||||||
user_profile.files_updated = datetime.now()
|
user_profile.files_updated = datetime.now()
|
||||||
|
@ -117,21 +139,26 @@ def api_update(request):
|
||||||
if 'info' in data:
|
if 'info' in data:
|
||||||
for oshash in data['info']:
|
for oshash in data['info']:
|
||||||
info = data['info'][oshash]
|
info = data['info'][oshash]
|
||||||
instance = models.FileInstance.objects.filter(file__oshash=oshash, user=user)
|
instance = models.FileInstance.objects.filter(file__oshash=oshash, volume__user=user)
|
||||||
if instance.count()>0:
|
if instance.count()>0:
|
||||||
instance = instance[0]
|
instance = instance[0]
|
||||||
if not instance.file.info:
|
if not instance.file.info:
|
||||||
|
for key in ('atime', 'mtime', 'ctime'):
|
||||||
|
if key in info:
|
||||||
|
del info[key]
|
||||||
instance.file.info = info
|
instance.file.info = info
|
||||||
instance.file.save()
|
instance.file.save()
|
||||||
|
|
||||||
files = models.FileInstance.objects.filter(user=user, file__available=False)
|
files = models.FileInstance.objects.filter(volume__user=user, file__available=False)
|
||||||
response['data'] = [f.file.oshash for f in files.filter(file__is_video=True)]
|
response['data']['info'] = [f.file.oshash for f in files.filter(file__info='{}')]
|
||||||
response['files'] = [f.file.oshash for f in files.filter(file__is_subtitle=True)]
|
#needs some flag to find those that are actually used main is to generic
|
||||||
|
response['data']['data'] = [f.file.oshash for f in files.filter(file__is_video=True, file__is_main=True)]
|
||||||
|
response['data']['file'] = [f.file.oshash for f in files.filter(file__is_subtitle=True)]
|
||||||
|
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
|
|
||||||
|
|
||||||
#@login_required_json
|
@login_required_json
|
||||||
#FIXME: is this part of the api or does it have to be outside due to multipart?
|
#FIXME: is this part of the api or does it have to be outside due to multipart?
|
||||||
def api_upload(request):
|
def api_upload(request):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue