export subtitles
This commit is contained in:
parent
89e215d93a
commit
a333d73305
1 changed files with 25 additions and 0 deletions
25
management/commands/export_subtitles.py
Normal file
25
management/commands/export_subtitles.py
Normal 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")
|
||||||
|
|
Loading…
Reference in a new issue