Compare commits

..

No commits in common. "a229194d48a3a0759111b995715095db207644a2" and "6e4e8ca7a615f824255f49357d8a0320409dbc05" have entirely different histories.

2 changed files with 10 additions and 10 deletions

View file

@ -7,7 +7,7 @@ Type=simple
Restart=always Restart=always
User=pandora User=pandora
Group=pandora Group=pandora
Nice=19 Nice=-15
WorkingDirectory=/srv/pandora/pandora WorkingDirectory=/srv/pandora/pandora
ExecStart=/srv/pandora/pandora/manage.py infinity ExecStart=/srv/pandora/pandora/manage.py infinity

View file

@ -635,6 +635,7 @@ def update_m3u(render_prefix, exclude=[]):
def render_infinity(options): def render_infinity(options):
prefix = options['prefix'] prefix = options['prefix']
duration = int(options['duration']) duration = int(options['duration'])
base = int(options['offset'])
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):
@ -643,8 +644,7 @@ def render_infinity(options):
else: else:
state = { state = {
"offset": 100, "offset": 100,
"max-items": 30, "max-items": 30
"no_video": False,
} }
for key in ("prefix", "duration"): for key in ("prefix", "duration"):
state[key] = options[key] state[key] = options[key]
@ -653,19 +653,19 @@ def render_infinity(options):
render_prefix = state["prefix"] + "/render/" render_prefix = state["prefix"] + "/render/"
current = [ current = [
f for f in os.listdir(render_prefix) f for f in os.listdir(render_prefix)
if f.isdigit() and os.path.isdir(render_prefix + f) and state["offset"] > int(f) >= 100 if f.isdigit() and os.path.isdir(render_prefix + f)
] ]
if len(current) > state["max-items"]: if len(current) > state["max-items"]:
current = list(reversed(ox.sorted_strings(current))) current = ox.sorted_strings(current)
remove = list(reversed(current[-state["max-items"]:])) remove = current[-state["max-items"]:]
update_m3u(render_prefix, exclude=remove) update_m3u(render_prefix, exclude=remove)
for folder in remove: for folder in remove:
folder = render_prefix + folder folder = render_prefix + folder
print("remove", folder) print("remove", folder)
shutil.rmtree(folder) #shutil.rmtree(folder)
cmd = ["ssh", "front", "rm", "-rf", folder] cmd = ["ssh", "front", "rm", "-r", folder]
#print(cmd) print(cmd)
subprocess.check_call(cmd) #subprocess.check_call(cmd)
render_all(state) render_all(state)
path = "%s%s/" % (render_prefix, state["offset"]) path = "%s%s/" % (render_prefix, state["offset"])
cmd = ['rsync', '-a', path, "front:" + path] cmd = ['rsync', '-a', path, "front:" + path]