migrate srt2fcp to python3

This commit is contained in:
j 2018-09-09 14:16:02 +02:00
parent 00521c3dc4
commit 9c8d1ffabd

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python3
from __future__ import division
import sys import sys
import os import os
from optparse import OptionParser from optparse import OptionParser
@ -8,15 +8,17 @@ import shutil
import math import math
import time import time
import json import json
import urllib import urllib.request
import urllib.parse
import urllib.error
import xml.sax.saxutils import xml.sax.saxutils
import ox import ox
import Image from PIL import Image
base = os.path.abspath(os.path.dirname(__file__)) base = os.path.abspath(os.path.dirname(__file__))
generator_template = u'''<generatoritem id="Text"> generator_template = '''<generatoritem id="Text">
<name>Text</name> <name>Text</name>
<duration>3000</duration> <duration>3000</duration>
<rate> <rate>
@ -175,12 +177,12 @@ generator_template = u'''<generatoritem id="Text">
</generatoritem> </generatoritem>
''' '''
fcp_header = u'''<?xml version="1.0" encoding="UTF-8"?> fcp_header = '''<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xmeml> <!DOCTYPE xmeml>
<xmeml version="5">''' <xmeml version="5">'''
fcp_footer = u'''</xmeml>''' fcp_footer = '''</xmeml>'''
sequence_template = u''' sequence_template = '''
<sequence id="%(id)s "> <sequence id="%(id)s ">
<uuid>72DC4146-6224-4400-BAAC-2AB6E0D3D292</uuid> <uuid>72DC4146-6224-4400-BAAC-2AB6E0D3D292</uuid>
<updatebehavior>add</updatebehavior> <updatebehavior>add</updatebehavior>
@ -306,7 +308,7 @@ class Fcp:
start = int(s['in'] * fcp.fps) start = int(s['in'] * fcp.fps)
end = int(s['out'] * fcp.fps) end = int(s['out'] * fcp.fps)
if start < duration: if start < duration:
print "warning", start, '<', duration, value print("warning", start, '<', duration, value)
start = duration start = duration
duration = end duration = end