add metadata

This commit is contained in:
j 2021-10-11 15:33:24 +01:00
parent f211375bbe
commit 844af58b1d
3 changed files with 13 additions and 1 deletions

View file

@ -8,6 +8,11 @@
<h2>{{ film.data.director|join:", "|safe }}</h2> <h2>{{ film.data.director|join:", "|safe }}</h2>
{% endcomment %} {% endcomment %}
<p>{{ film.data.summary|safe }}</p> <p>{{ film.data.summary|safe }}</p>
<div class="details">
Runtime: {{ film.duration }},
Year: {{ film.data.date}},
Artist Bio: {{ film.data.bio|safe }}
</div>
</div> </div>
<video src="{{ settings.TIMELINE_PREFIX }}{{ film.padma_id }}/loop.mp4" autoplay loop muted></video> <video src="{{ settings.TIMELINE_PREFIX }}{{ film.padma_id }}/loop.mp4" autoplay loop muted></video>

View file

@ -16,7 +16,10 @@ class Command(BaseCommand):
'query': { 'query': {
'conditions': [{'key': 'groups', 'value': options['group'], 'operator': '=='}] 'conditions': [{'key': 'groups', 'value': options['group'], 'operator': '=='}]
}, },
'keys': ['id', 'title', 'director', 'summary', 'source', 'sourcedescription', 'date', 'location'], 'keys': [
'id', 'title', 'director', 'summary', 'source', 'sourcedescription', 'date', 'location',
'duration'
],
'range': [0, 1000] 'range': [0, 1000]
} }
for item in api.find(**query)['data']['items']: for item in api.find(**query)['data']['items']:

View file

@ -4,6 +4,8 @@ from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
from django.db import models from django.db import models
import ox
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
User = get_user_model() User = get_user_model()
@ -31,6 +33,8 @@ class Film(models.Model):
from ..text.models import Text from ..text.models import Text
return Text.objects.filter(data__item=self.padma_id) return Text.objects.filter(data__item=self.padma_id)
def duration(self):
return ox.format_timecode(self.data['duration'])[:-4]
class Edit(models.Model): class Edit(models.Model):
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True)