forked from 0x2620/pandora
keep encoding error in database and show in media view
This commit is contained in:
parent
56df34f049
commit
fbc3b6f8b7
4 changed files with 258 additions and 23 deletions
|
@ -246,14 +246,15 @@ def stream(video, target, profile, info, avconv=None):
|
||||||
|
|
||||||
#print cmd
|
#print cmd
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||||
stdout=open('/dev/null', 'w'),
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
t = "%s.mp4" % target if format == 'mp4' else target
|
t = "%s.mp4" % target if format == 'mp4' else target
|
||||||
if os.path.exists(t):
|
if os.path.exists(t):
|
||||||
os.unlink(t)
|
os.unlink(t)
|
||||||
return False
|
return False, stdout
|
||||||
if format == 'mp4':
|
if format == 'mp4':
|
||||||
cmd = ['qt-faststart', "%s.mp4" % target, target]
|
cmd = ['qt-faststart', "%s.mp4" % target, target]
|
||||||
#print cmd
|
#print cmd
|
||||||
|
@ -262,7 +263,7 @@ def stream(video, target, profile, info, avconv=None):
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
p.communicate()
|
p.communicate()
|
||||||
os.unlink("%s.mp4" % target)
|
os.unlink("%s.mp4" % target)
|
||||||
return True
|
return True, None
|
||||||
|
|
||||||
|
|
||||||
def run_command(cmd, timeout=10):
|
def run_command(cmd, timeout=10):
|
||||||
|
|
182
pandora/archive/migrations/0009_error.py
Normal file
182
pandora/archive/migrations/0009_error.py
Normal file
|
@ -0,0 +1,182 @@
|
||||||
|
# -*- coding: 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 field 'File.failed'
|
||||||
|
db.add_column('archive_file', 'failed',
|
||||||
|
self.gf('django.db.models.fields.BooleanField')(default=False),
|
||||||
|
keep_default=False)
|
||||||
|
|
||||||
|
# Adding field 'Stream.error'
|
||||||
|
db.add_column('archive_stream', 'error',
|
||||||
|
self.gf('django.db.models.fields.TextField')(default='', blank=True),
|
||||||
|
keep_default=False)
|
||||||
|
|
||||||
|
|
||||||
|
def backwards(self, orm):
|
||||||
|
# Deleting field 'File.failed'
|
||||||
|
db.delete_column('archive_file', 'failed')
|
||||||
|
|
||||||
|
# Deleting field 'Stream.error'
|
||||||
|
db.delete_column('archive_stream', 'error')
|
||||||
|
|
||||||
|
|
||||||
|
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'}),
|
||||||
|
'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'}),
|
||||||
|
'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
|
||||||
|
'display_aspect_ratio': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'duration': ('django.db.models.fields.FloatField', [], {'null': 'True'}),
|
||||||
|
'encoding': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'extension': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True'}),
|
||||||
|
'failed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'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': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'is_audio': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'is_subtitle': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'is_video': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'item': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'null': 'True', 'to': "orm['item.Item']"}),
|
||||||
|
'language': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '8', 'null': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '16'}),
|
||||||
|
'part': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True'}),
|
||||||
|
'part_title': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True'}),
|
||||||
|
'path': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'pixel_format': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'pixels': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'queued': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'samplerate': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'selected': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'size': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
|
||||||
|
'sort_path': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '2048'}),
|
||||||
|
'type': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
|
||||||
|
'uploading': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'null': 'True'}),
|
||||||
|
'video_codec': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
|
||||||
|
'wanted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'width': ('django.db.models.fields.IntegerField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'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.instance': {
|
||||||
|
'Meta': {'unique_together': "(('path', 'volume'),)", 'object_name': 'Instance'},
|
||||||
|
'atime': ('django.db.models.fields.IntegerField', [], {'default': '1382350870'}),
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'ctime': ('django.db.models.fields.IntegerField', [], {'default': '1382350870'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'instances'", 'to': "orm['archive.File']"}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'ignore': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'mtime': ('django.db.models.fields.IntegerField', [], {'default': '1382350870'}),
|
||||||
|
'path': ('django.db.models.fields.CharField', [], {'max_length': '2048'}),
|
||||||
|
'volume': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'files'", 'to': "orm['archive.Volume']"})
|
||||||
|
},
|
||||||
|
'archive.stream': {
|
||||||
|
'Meta': {'unique_together': "(('file', 'resolution', 'format'),)", 'object_name': 'Stream'},
|
||||||
|
'aspect_ratio': ('django.db.models.fields.FloatField', [], {'default': '0'}),
|
||||||
|
'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'color': ('ox.django.fields.TupleField', [], {'default': '[]'}),
|
||||||
|
'cuts': ('ox.django.fields.TupleField', [], {'default': '[]'}),
|
||||||
|
'duration': ('django.db.models.fields.FloatField', [], {'default': '0'}),
|
||||||
|
'error': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'file': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'streams'", 'to': "orm['archive.File']"}),
|
||||||
|
'format': ('django.db.models.fields.CharField', [], {'default': "'webm'", 'max_length': '255'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'media': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'oshash': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True', 'db_index': 'True'}),
|
||||||
|
'resolution': ('django.db.models.fields.IntegerField', [], {'default': '96'}),
|
||||||
|
'source': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'derivatives'", 'null': 'True', 'to': "orm['archive.Stream']"}),
|
||||||
|
'volume': ('django.db.models.fields.FloatField', [], {'default': '0'})
|
||||||
|
},
|
||||||
|
'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': '255'}),
|
||||||
|
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
|
||||||
|
},
|
||||||
|
'auth.permission': {
|
||||||
|
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", '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': '255', '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'}),
|
||||||
|
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
|
||||||
|
'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': '255'}),
|
||||||
|
'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': '255'})
|
||||||
|
},
|
||||||
|
'contenttypes.contenttype': {
|
||||||
|
'Meta': {'ordering': "('name',)", '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'})
|
||||||
|
},
|
||||||
|
'item.item': {
|
||||||
|
'Meta': {'object_name': 'Item'},
|
||||||
|
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
|
||||||
|
'data': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'external_data': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'items'", 'blank': 'True', 'to': "orm['auth.Group']"}),
|
||||||
|
'icon': ('django.db.models.fields.files.ImageField', [], {'default': 'None', 'max_length': '100', 'blank': 'True'}),
|
||||||
|
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
|
||||||
|
'itemId': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128', 'blank': 'True'}),
|
||||||
|
'json': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'level': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
|
||||||
|
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
|
||||||
|
'oxdbId': ('django.db.models.fields.CharField', [], {'max_length': '42', 'unique': 'True', 'null': 'True', '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_source': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
|
||||||
|
'poster_width': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
|
||||||
|
'rendered': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
|
||||||
|
'stream_aspect': ('django.db.models.fields.FloatField', [], {'default': '1.3333333333333333'}),
|
||||||
|
'stream_info': ('ox.django.fields.DictField', [], {'default': '{}'}),
|
||||||
|
'torrent': ('django.db.models.fields.files.FileField', [], {'default': 'None', 'max_length': '1000', 'blank': 'True'}),
|
||||||
|
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'null': 'True', 'to': "orm['auth.User']"})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
complete_apps = ['archive']
|
|
@ -79,6 +79,7 @@ class File(models.Model):
|
||||||
queued = models.BooleanField(default = False)
|
queued = models.BooleanField(default = False)
|
||||||
encoding = models.BooleanField(default = False)
|
encoding = models.BooleanField(default = False)
|
||||||
wanted = models.BooleanField(default = False)
|
wanted = models.BooleanField(default = False)
|
||||||
|
failed = 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)
|
||||||
|
@ -341,7 +342,12 @@ class File(models.Model):
|
||||||
if self.type != 'video':
|
if self.type != 'video':
|
||||||
duration = None
|
duration = None
|
||||||
state = ''
|
state = ''
|
||||||
if self.encoding:
|
error = ''
|
||||||
|
if self.failed:
|
||||||
|
state = 'failed'
|
||||||
|
error = '\n\n'.join(['Failed to encode %s:\n%s' % (s.name(), s.error)
|
||||||
|
for s in self.streams.exclude(error='') if s.error])
|
||||||
|
elif self.encoding:
|
||||||
state = 'encoding'
|
state = 'encoding'
|
||||||
elif self.queued:
|
elif self.queued:
|
||||||
state = 'queued'
|
state = 'queued'
|
||||||
|
@ -368,6 +374,8 @@ class File(models.Model):
|
||||||
'videoCodec': self.video_codec,
|
'videoCodec': self.video_codec,
|
||||||
'wanted': self.wanted,
|
'wanted': self.wanted,
|
||||||
}
|
}
|
||||||
|
if error:
|
||||||
|
data['error'] = error
|
||||||
for key in self.PATH_INFO:
|
for key in self.PATH_INFO:
|
||||||
data[key] = self.info.get(key)
|
data[key] = self.info.get(key)
|
||||||
data['users'] = list(set([i['user'] for i in data['instances']]))
|
data['users'] = list(set([i['user'] for i in data['instances']]))
|
||||||
|
@ -512,6 +520,8 @@ class Stream(models.Model):
|
||||||
color = fields.TupleField(default=[])
|
color = fields.TupleField(default=[])
|
||||||
volume = models.FloatField(default=0)
|
volume = models.FloatField(default=0)
|
||||||
|
|
||||||
|
error = models.TextField(blank=True, default='')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def timeline_prefix(self):
|
def timeline_prefix(self):
|
||||||
return os.path.join(settings.MEDIA_ROOT, self.path())
|
return os.path.join(settings.MEDIA_ROOT, self.path())
|
||||||
|
@ -566,11 +576,15 @@ class Stream(models.Model):
|
||||||
self.media.name = os.path.join(os.path.dirname(self.source.media.name), self.name())
|
self.media.name = os.path.join(os.path.dirname(self.source.media.name), self.name())
|
||||||
target = self.media.path
|
target = self.media.path
|
||||||
info = ox.avinfo(media)
|
info = ox.avinfo(media)
|
||||||
if extract.stream(media, target, self.name(), info):
|
ok, error = extract.stream(media, target, self.name(), info)
|
||||||
|
if ok:
|
||||||
self.available = True
|
self.available = True
|
||||||
else:
|
else:
|
||||||
self.media = None
|
self.media = None
|
||||||
self.available = False
|
self.available = False
|
||||||
|
self.error = error
|
||||||
|
self.file.failed = True
|
||||||
|
self.file.save()
|
||||||
self.save()
|
self.save()
|
||||||
elif self.file.data:
|
elif self.file.data:
|
||||||
media = self.file.data.path
|
media = self.file.data.path
|
||||||
|
@ -581,11 +595,15 @@ class Stream(models.Model):
|
||||||
ffmpeg = ox.file.cmd('ffmpeg')
|
ffmpeg = ox.file.cmd('ffmpeg')
|
||||||
if ffmpeg == 'ffmpeg':
|
if ffmpeg == 'ffmpeg':
|
||||||
ffmpeg = None
|
ffmpeg = None
|
||||||
if extract.stream(media, target, self.name(), info, ffmpeg):
|
ok, error = extract.stream(media, target, self.name(), info, ffmpeg)
|
||||||
|
if ok:
|
||||||
self.available = True
|
self.available = True
|
||||||
else:
|
else:
|
||||||
self.media = None
|
self.media = None
|
||||||
self.available = False
|
self.available = False
|
||||||
|
self.error = error
|
||||||
|
self.file.failed = True
|
||||||
|
self.file.save()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
def make_timeline(self):
|
def make_timeline(self):
|
||||||
|
|
|
@ -81,11 +81,12 @@ pandora.ui.mediaView = function(options, self) {
|
||||||
format: function(value, data) {
|
format: function(value, data) {
|
||||||
return $('<img>')
|
return $('<img>')
|
||||||
.attr({
|
.attr({
|
||||||
src: ['uploading', 'queued', 'encoding'].indexOf(data.state) > -1
|
src: ['uploading', 'queued', 'encoding', 'failed'].indexOf(data.state) > -1
|
||||||
? Ox.UI.getImageURL('symbol' + {
|
? Ox.UI.getImageURL('symbol' + {
|
||||||
'uploading': 'Upload',
|
'uploading': 'Upload',
|
||||||
'queued': 'Data',
|
'queued': 'Data',
|
||||||
'encoding': 'Sync'
|
'encoding': 'Sync',
|
||||||
|
'failed': 'Warning'
|
||||||
}[data.state])
|
}[data.state])
|
||||||
: data.wanted
|
: data.wanted
|
||||||
? Ox.UI.getImageURL('symbolUp')
|
? Ox.UI.getImageURL('symbolUp')
|
||||||
|
@ -103,11 +104,12 @@ pandora.ui.mediaView = function(options, self) {
|
||||||
title: Ox._('Status'),
|
title: Ox._('Status'),
|
||||||
titleImage: 'check',
|
titleImage: 'check',
|
||||||
tooltip: function (data) {
|
tooltip: function (data) {
|
||||||
return ['uploading', 'queued', 'encoding'].indexOf(data.state) > -1
|
return ['uploading', 'queued', 'encoding', 'failed'].indexOf(data.state) > -1
|
||||||
? Ox._({
|
? Ox._({
|
||||||
'uploading': 'Video is currently uploaded to server',
|
'uploading': 'Video is currently uploaded to server',
|
||||||
'queued': 'Waiting for server to process video',
|
'queued': 'Waiting for server to process video',
|
||||||
'encoding': 'Processing video on server'
|
'encoding': 'Processing video on server',
|
||||||
|
'failed': 'Encoding failed'
|
||||||
}[data.state])
|
}[data.state])
|
||||||
: data.instances.filter(function(i) {return i.ignore; }).length > 0
|
: data.instances.filter(function(i) {return i.ignore; }).length > 0
|
||||||
? Ox._('Use this file')
|
? Ox._('Use this file')
|
||||||
|
@ -234,7 +236,7 @@ pandora.ui.mediaView = function(options, self) {
|
||||||
query: self.filesQuery
|
query: self.filesQuery
|
||||||
}), callback);
|
}), callback);
|
||||||
},
|
},
|
||||||
keys: ['state', 'instances', 'wanted'],
|
keys: ['state', 'instances', 'wanted', 'error'],
|
||||||
scrollbarVisible: true,
|
scrollbarVisible: true,
|
||||||
sort: [{key: 'path', operator: '+'}],
|
sort: [{key: 'path', operator: '+'}],
|
||||||
unique: 'id'
|
unique: 'id'
|
||||||
|
@ -242,6 +244,37 @@ pandora.ui.mediaView = function(options, self) {
|
||||||
.bindEvent({
|
.bindEvent({
|
||||||
click: function(data) {
|
click: function(data) {
|
||||||
if (data.key == 'selected') {
|
if (data.key == 'selected') {
|
||||||
|
var value = self.$filesList.value(data.id);
|
||||||
|
console.log(data, value);
|
||||||
|
if (value.state == 'failed') {
|
||||||
|
var $dialog = Ox.Dialog({
|
||||||
|
buttons: [
|
||||||
|
Ox.Button({
|
||||||
|
id: 'close',
|
||||||
|
title: Ox._('Close')
|
||||||
|
})
|
||||||
|
.bindEvent({
|
||||||
|
click: function() {
|
||||||
|
$dialog.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
|
closeButton: true,
|
||||||
|
content: $('<code>').append(
|
||||||
|
$('<pre>')
|
||||||
|
.addClass('OxSelectable')
|
||||||
|
.css({margin: '16px'})
|
||||||
|
.text(value.error)
|
||||||
|
),
|
||||||
|
height: Math.round((window.innerHeight - 48) * 0.9),
|
||||||
|
keys: {enter: 'close', escape: 'close'},
|
||||||
|
maximizeButton: true,
|
||||||
|
removeOnClose: true,
|
||||||
|
title: 'Encoding Failed',
|
||||||
|
width: Math.round(window.innerWidth * 0.9)
|
||||||
|
})
|
||||||
|
.open();
|
||||||
|
} else {
|
||||||
var ignored = self.$filesList.value(data.id, 'instances')
|
var ignored = self.$filesList.value(data.id, 'instances')
|
||||||
.filter(function(i) {return i.ignore; }).length > 0;
|
.filter(function(i) {return i.ignore; }).length > 0;
|
||||||
pandora.api.editMedia({
|
pandora.api.editMedia({
|
||||||
|
@ -254,6 +287,7 @@ pandora.ui.mediaView = function(options, self) {
|
||||||
self.$filesList.reloadList();
|
self.$filesList.reloadList();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'delete': function(data) {
|
'delete': function(data) {
|
||||||
var ids = data.ids.filter(function(id) {
|
var ids = data.ids.filter(function(id) {
|
||||||
|
|
Loading…
Reference in a new issue