set defaults
This commit is contained in:
parent
38a893aae7
commit
e31df1790c
1 changed files with 10 additions and 5 deletions
15
render.py
15
render.py
|
|
@ -885,19 +885,24 @@ def render_infinity(options):
|
||||||
prefix = options['prefix']
|
prefix = options['prefix']
|
||||||
duration = int(options['duration'])
|
duration = int(options['duration'])
|
||||||
|
|
||||||
|
defaults = {
|
||||||
|
"offset": 100,
|
||||||
|
"max-items": 30,
|
||||||
|
"no_video": False,
|
||||||
|
}
|
||||||
state_f = os.path.join(prefix, "infinity.json")
|
state_f = os.path.join(prefix, "infinity.json")
|
||||||
if os.path.exists(state_f):
|
if os.path.exists(state_f):
|
||||||
with open(state_f) as fd:
|
with open(state_f) as fd:
|
||||||
state = json.load(fd)
|
state = json.load(fd)
|
||||||
else:
|
else:
|
||||||
state = {
|
state = {}
|
||||||
"offset": 100,
|
|
||||||
"max-items": 30,
|
|
||||||
"no_video": False,
|
|
||||||
}
|
|
||||||
for key in ("prefix", "duration", "debug", "single_file", "keep_audio", "stereo_downmix"):
|
for key in ("prefix", "duration", "debug", "single_file", "keep_audio", "stereo_downmix"):
|
||||||
state[key] = options[key]
|
state[key] = options[key]
|
||||||
|
|
||||||
|
for key in defaults:
|
||||||
|
if key not in state:
|
||||||
|
state[key] = defaults[key]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
render_prefix = state["prefix"] + "/render/"
|
render_prefix = state["prefix"] + "/render/"
|
||||||
current = [
|
current = [
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue