fix default options
This commit is contained in:
parent
3f9280e0ba
commit
4e767b7268
1 changed files with 9 additions and 4 deletions
13
render.py
13
render.py
|
|
@ -377,6 +377,9 @@ def write_subtitles(data, folder, options):
|
||||||
if options.get("subtitle_format") == "srt":
|
if options.get("subtitle_format") == "srt":
|
||||||
srt = ox.srt.encode(data)
|
srt = ox.srt.encode(data)
|
||||||
write_if_new(str(path), srt, 'b')
|
write_if_new(str(path), srt, 'b')
|
||||||
|
path = folder / "front.ass"
|
||||||
|
if os.path.exists(path):
|
||||||
|
os.unlink(path)
|
||||||
else:
|
else:
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
|
|
@ -386,7 +389,8 @@ def write_subtitles(data, folder, options):
|
||||||
|
|
||||||
|
|
||||||
def render(root, scene, prefix='', options=None):
|
def render(root, scene, prefix='', options=None):
|
||||||
if options is None: options = {}
|
if options is None:
|
||||||
|
options = {}
|
||||||
fps = 24
|
fps = 24
|
||||||
files = []
|
files = []
|
||||||
scene_duration = int(get_scene_duration(scene) * fps)
|
scene_duration = int(get_scene_duration(scene) * fps)
|
||||||
|
|
@ -903,7 +907,7 @@ def load_defaults(options):
|
||||||
path = os.path.join(options["prefix"], "options.json")
|
path = os.path.join(options["prefix"], "options.json")
|
||||||
if os.path.exists(path):
|
if os.path.exists(path):
|
||||||
with open(path) as fd:
|
with open(path) as fd:
|
||||||
defaults = json.loads(fd)
|
defaults = json.load(fd)
|
||||||
for key in defaults:
|
for key in defaults:
|
||||||
if key not in options:
|
if key not in options:
|
||||||
options[key] = defaults[key]
|
options[key] = defaults[key]
|
||||||
|
|
@ -939,8 +943,8 @@ def ass_encode(subs, options):
|
||||||
langs = options["lang"].split(',')
|
langs = options["lang"].split(',')
|
||||||
else:
|
else:
|
||||||
langs = list(subs[0]["values"])
|
langs = list(subs[0]["values"])
|
||||||
print('ass_encode', langs, options)
|
#print('ass_encode', langs, options)
|
||||||
print(subs)
|
#print(subs)
|
||||||
|
|
||||||
header = '''[Script Info]
|
header = '''[Script Info]
|
||||||
ScriptType: v4.00+
|
ScriptType: v4.00+
|
||||||
|
|
@ -1092,6 +1096,7 @@ def generate_clips(options):
|
||||||
import item.models
|
import item.models
|
||||||
import itemlist.models
|
import itemlist.models
|
||||||
|
|
||||||
|
options = load_defaults(options)
|
||||||
prefix = options['prefix']
|
prefix = options['prefix']
|
||||||
lang, tlang = parse_lang(options["lang"])
|
lang, tlang = parse_lang(options["lang"])
|
||||||
if options['censored']:
|
if options['censored']:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue