Compare commits
2 commits
b43e9f64e3
...
f550f92f64
| Author | SHA1 | Date | |
|---|---|---|---|
| f550f92f64 | |||
| a40ccbaac9 |
2 changed files with 12 additions and 9 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python3
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
|
||||||
import lxml
|
import lxml
|
||||||
|
|
@ -39,5 +39,5 @@ for g in tree.xpath('//generatoritem'):
|
||||||
'in': _start/fps, 'out': (_end-1)/fps, 'value': value
|
'in': _start/fps, 'out': (_end-1)/fps, 'value': value
|
||||||
})
|
})
|
||||||
|
|
||||||
with open(target, 'w') as f:
|
with open(target, 'wb') as f:
|
||||||
f.write(ox.srt.encode(data))
|
f.write(ox.srt.encode(data))
|
||||||
|
|
|
||||||
17
srt2fcp.py
17
srt2fcp.py
|
|
@ -18,7 +18,7 @@ from PIL import Image
|
||||||
|
|
||||||
base = os.path.abspath(os.path.dirname(__file__))
|
base = os.path.abspath(os.path.dirname(__file__))
|
||||||
|
|
||||||
generator_template = '''<generatoritem id="Text">
|
generator_template = '''<generatoritem id="Text%(id)s">
|
||||||
<name>Text</name>
|
<name>Text</name>
|
||||||
<duration>3000</duration>
|
<duration>3000</duration>
|
||||||
<rate>
|
<rate>
|
||||||
|
|
@ -219,18 +219,18 @@ sequence_template = '''
|
||||||
</rate>
|
</rate>
|
||||||
<colordepth>24</colordepth>
|
<colordepth>24</colordepth>
|
||||||
<codec>
|
<codec>
|
||||||
<name>Apple DV - PAL</name>
|
<name>Apple ProRes 422</name>
|
||||||
<appspecificdata>
|
<appspecificdata>
|
||||||
<appname>Final Cut Pro</appname>
|
<appname>Final Cut Pro</appname>
|
||||||
<appmanufacturer>Apple Inc.</appmanufacturer>
|
<appmanufacturer>Apple Inc.</appmanufacturer>
|
||||||
<appversion>7.0</appversion>
|
<appversion>7.0</appversion>
|
||||||
<data>
|
<data>
|
||||||
<qtcodec>
|
<qtcodec>
|
||||||
<codecname>Apple DV - PAL</codecname>
|
<codecname>Apple ProRes 422</codecname>
|
||||||
<codectypename>DV - PAL</codectypename>
|
<codectypename>Apple ProRes 422</codectypename>
|
||||||
<codectypecode>dvcp</codectypecode>
|
<codectypecode>apcn</codectypecode>
|
||||||
<codecvendorcode>appl</codecvendorcode>
|
<codecvendorcode>appl</codecvendorcode>
|
||||||
<spatialquality>1023</spatialquality>
|
<spatialquality>1024</spatialquality>
|
||||||
<temporalquality>0</temporalquality>
|
<temporalquality>0</temporalquality>
|
||||||
<keyframerate>0</keyframerate>
|
<keyframerate>0</keyframerate>
|
||||||
<datarate>0</datarate>
|
<datarate>0</datarate>
|
||||||
|
|
@ -294,6 +294,7 @@ class Fcp:
|
||||||
fontsize = 18
|
fontsize = 18
|
||||||
font = 'Courier New'
|
font = 'Courier New'
|
||||||
#font = 'Lucida Grande'
|
#font = 'Lucida Grande'
|
||||||
|
gid = 0
|
||||||
|
|
||||||
def __init__(self, size=None, font=None):
|
def __init__(self, size=None, font=None):
|
||||||
if size is not None:
|
if size is not None:
|
||||||
|
|
@ -329,8 +330,10 @@ class Fcp:
|
||||||
})
|
})
|
||||||
|
|
||||||
def sub(self, start, end, text):
|
def sub(self, start, end, text):
|
||||||
text = xml.sax.saxutils.escape('\n'.join(text).strip()).replace('\n', ' ')
|
self.gid += 1
|
||||||
|
text = xml.sax.saxutils.escape('\n'.join(text).strip()).replace('\n', ' ')
|
||||||
return generator_template % {
|
return generator_template % {
|
||||||
|
'id': self.gid,
|
||||||
'start': start,
|
'start': start,
|
||||||
'end': end,
|
'end': end,
|
||||||
'duration': end-start,
|
'duration': end-start,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue