export subtitles

This commit is contained in:
j 2024-02-01 14:52:46 +01:00
parent 89e215d93a
commit a333d73305

View file

@ -0,0 +1,25 @@
import json
import os
import subprocess
from django.core.management.base import BaseCommand
from django.conf import settings
class Command(BaseCommand):
help = 'export all subtitles for translations'
def add_arguments(self, parser):
pass
def handle(self, **options):
import annotation.models
import item.models
for i in item.models.Item.objects.filter(data__type__contains='Voice Over').order_by('sort__title'):
print("## %s %s" % (i.get("title"), i.public_id))
for sub in i.annotations.all().filter(layer='subtitles').exclude(value='').order_by("start"):
if not sub.languages:
print(sub.value.strip() + "\n")
print("\n\n\n")