From 844af58b1d9755e1cf967a182e9981827d4bb9de Mon Sep 17 00:00:00 2001 From: j Date: Mon, 11 Oct 2021 15:33:24 +0100 Subject: [PATCH] add metadata --- app/templates/film.html | 5 +++++ app/video/management/commands/load_titles.py | 5 ++++- app/video/models.py | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/templates/film.html b/app/templates/film.html index 1beb393..9dfd6f2 100644 --- a/app/templates/film.html +++ b/app/templates/film.html @@ -8,6 +8,11 @@

{{ film.data.director|join:", "|safe }}

{% endcomment %}

{{ film.data.summary|safe }}

+
+Runtime: {{ film.duration }}, +Year: {{ film.data.date}}, +Artist Bio: {{ film.data.bio|safe }} +
diff --git a/app/video/management/commands/load_titles.py b/app/video/management/commands/load_titles.py index 16c7bd1..4641328 100644 --- a/app/video/management/commands/load_titles.py +++ b/app/video/management/commands/load_titles.py @@ -16,7 +16,10 @@ class Command(BaseCommand): 'query': { '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] } for item in api.find(**query)['data']['items']: diff --git a/app/video/models.py b/app/video/models.py index c310c49..eb2be3a 100644 --- a/app/video/models.py +++ b/app/video/models.py @@ -4,6 +4,8 @@ from django.conf import settings from django.contrib.auth import get_user_model from django.db import models +import ox + logger = logging.getLogger(__name__) User = get_user_model() @@ -31,6 +33,8 @@ class Film(models.Model): from ..text.models import Text return Text.objects.filter(data__item=self.padma_id) + def duration(self): + return ox.format_timecode(self.data['duration'])[:-4] class Edit(models.Model): created = models.DateTimeField(auto_now_add=True)