diff --git a/pandora/archive/migrations/0005_auto_20180804_1554.py b/pandora/archive/migrations/0005_auto_20180804_1554.py deleted file mode 100644 index 43291125..00000000 --- a/pandora/archive/migrations/0005_auto_20180804_1554.py +++ /dev/null @@ -1,22 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.13 on 2018-08-04 15:54 -from __future__ import unicode_literals - -import django.core.serializers.json -from django.db import migrations, models -import oxdjango.fields - - -class Migration(migrations.Migration): - - dependencies = [ - ('archive', '0004_jsonfield'), - ] - - operations = [ - migrations.AddField( - model_name='stream', - name='flags', - field=oxdjango.fields.JSONField(default=dict, editable=False, encoder=django.core.serializers.json.DjangoJSONEncoder), - ), - ] diff --git a/pandora/archive/models.py b/pandora/archive/models.py index ec0986e9..0e0d5c84 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -521,7 +521,7 @@ class File(models.Model): n += 1 profile = '%sp.%s' % (resolution, config['formats'][0]) target = os.path.join(tmp, language + '_' + profile) - ok, error = extract.stream(media, target, profile, info, audio_track=i+1, flags=self.flags) + ok, error = extract.stream(media, target, profile, info, audio_track=i+1) if ok: tinfo = ox.avinfo(target) del tinfo['path'] @@ -691,7 +691,6 @@ class Stream(models.Model): available = models.BooleanField(default=False) oshash = models.CharField(max_length=16, null=True, db_index=True) info = JSONField(default=dict, editable=False) - flags = JSONField(default=dict, editable=False) duration = models.FloatField(default=0) aspect_ratio = models.FloatField(default=0) @@ -751,7 +750,7 @@ class Stream(models.Model): self.media.name = self.path(self.name()) target = self.media.path info = ox.avinfo(media) - ok, error = extract.stream(media, target, self.name(), info, flags=self.flags) + ok, error = extract.stream(media, target, self.name(), info) # file could have been moved while encoding # get current version from db and update _self = Stream.objects.get(id=self.id) diff --git a/pandora/item/models.py b/pandora/item/models.py index 7ee4efa8..fe7ad08a 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -1032,16 +1032,9 @@ class Item(models.Model): elif sort_type == 'date': value = self.get(source) if isinstance(value, string_types): - value_ = None - for fmt in ('%Y-%m-%d', '%Y-%m', '%Y'): - try: - value_ = datetime_safe.datetime.strptime(value, fmt) - except ValueError: - pass - else: - continue - if value_ is not None: - set_value(s, name, value_) + value = datetime_safe.datetime.strptime(value, '%Y-%m-%d') + set_value(s, name, value) + s.save() def update_facet(self, key): diff --git a/static/js/documentInfoView.js b/static/js/documentInfoView.js index 9d6c1010..99da3df5 100644 --- a/static/js/documentInfoView.js +++ b/static/js/documentInfoView.js @@ -412,8 +412,11 @@ pandora.ui.documentInfoView = function(data) { function formatValue(key, value) { var ret; - if (key == 'date' && (!value || value.split('-').length < 4)) { - ret = pandora.formatDate(value); + if (key == 'date') { + ret = value ? Ox.formatDate(value, + ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], + true + ) : ''; } else if (nameKeys.indexOf(key) > -1) { ret = formatLink(value.split(', '), key); } else if (listKeys.indexOf(key) > -1) { diff --git a/static/js/editor.js b/static/js/editor.js index da85b5b1..9e9cb826 100644 --- a/static/js/editor.js +++ b/static/js/editor.js @@ -26,7 +26,6 @@ pandora.ui.editor = function(data) { enableSetPosterFrame: !pandora.site.media.importFrames && data.editable, enableSubtitles: ui.videoSubtitles, find: ui.itemFind, - findLayer: pandora.user.ui._findState.key, getFrameURL: function(position) { return pandora.getMediaURL('/' + ui.item + '/' + ui.videoResolution + 'p' + position + '.jpg?' + data.modified); }, diff --git a/static/js/infoView.padma.js b/static/js/infoView.padma.js index 3bc49b35..7a88f66b 100644 --- a/static/js/infoView.padma.js +++ b/static/js/infoView.padma.js @@ -594,7 +594,19 @@ pandora.ui.infoView = function(data) { function formatValue(key, value) { var ret; if (key == 'date' && (!value || value.split('-').length < 4)) { - ret = pandora.formatDate(value); + if (!value) { + ret = '' + } else if (Ox.contains(value, ':') && value.split('-').length == 3) { + ret = Ox.formatDate(value, + ['', '', '%B %e, %Y %H:%M', '%B %e, %Y %H:%M:%S'][value.split(':').length], + false + ); + } else { + ret = Ox.formatDate(value, + ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], + true + ); + } } else if (listKeys.indexOf(key) > -1) { ret = value.split(', '); } else { diff --git a/static/js/utils.js b/static/js/utils.js index 097d7e4f..22612883 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -1115,27 +1115,6 @@ pandora.formatDocumentKey = function(key, data, size) { return value; } -pandora.formatDate = function(value) { - var ret; - if (!value) { - ret = '' - } else if (Ox.contains(value, ':') && value.split('-').length == 3) { - ret = Ox.formatDate(value, - ['', '', '%B %e, %Y %H:%M', '%B %e, %Y %H:%M:%S'][value.split(':').length], - false - ); - } else { - ret = Ox.formatDate(value, - ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], - true - ); - } - if (ret.trim() == 'NaN') { - ret = value; - } - return ret; -} - pandora.getAllItemsTitle = function(section) { section = section || pandora.user.ui.section; return {