use uuids
This commit is contained in:
parent
f8c15e6944
commit
9524720585
1 changed files with 11 additions and 8 deletions
19
srt2fcp.py
19
srt2fcp.py
|
@ -3,14 +3,15 @@
|
|||
import sys
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
import tempfile
|
||||
import shutil
|
||||
import math
|
||||
import time
|
||||
import json
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import math
|
||||
import shutil
|
||||
import tempfile
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import uuid
|
||||
import xml.sax.saxutils
|
||||
|
||||
import ox
|
||||
|
@ -172,7 +173,7 @@ generator_template = '''<generatoritem id="Text%(id)s">
|
|||
<mediatype>video</mediatype>
|
||||
</sourcetrack>
|
||||
<itemhistory>
|
||||
<uuid>BAA51DEC-ECB0-4879-9910-8E83B0EF7C1B</uuid>
|
||||
<uuid>$(uuid)s</uuid>
|
||||
</itemhistory>
|
||||
</generatoritem>
|
||||
'''
|
||||
|
@ -184,7 +185,7 @@ fcp_footer = '''</xmeml>'''
|
|||
|
||||
sequence_template = '''
|
||||
<sequence id="%(id)s ">
|
||||
<uuid>72DC4146-6224-4400-BAAC-2AB6E0D3D292</uuid>
|
||||
<uuid>$(uuid)s</uuid>
|
||||
<updatebehavior>add</updatebehavior>
|
||||
<name>%(id)s</name>
|
||||
<duration>%(duration)s</duration>
|
||||
|
@ -325,6 +326,7 @@ class Fcp:
|
|||
subs.append((start, end, value.split('\n')))
|
||||
self.sequences.append(sequence_template % {
|
||||
'id': os.path.splitext(os.path.basename(srt))[0],
|
||||
'uuid': str(uuid.uuid1()).upper(),
|
||||
'duration': duration,
|
||||
'subs': '\n'.join([self.sub(*s) for s in subs])
|
||||
})
|
||||
|
@ -334,6 +336,7 @@ class Fcp:
|
|||
text = xml.sax.saxutils.escape('\n'.join(text).strip()).replace('\n', ' ')
|
||||
return generator_template % {
|
||||
'id': self.gid,
|
||||
'uuid': str(uuid.uuid1()).upper(),
|
||||
'start': start,
|
||||
'end': end,
|
||||
'duration': end-start,
|
||||
|
|
Loading…
Reference in a new issue