Compare commits

..

2 commits

Author SHA1 Message Date
j
a229194d48 actually cleanup, only remove renders in infinity range 2024-03-19 10:12:15 +01:00
j
3d5293e7de lower priority 2024-03-19 10:11:40 +01:00
2 changed files with 10 additions and 10 deletions

View file

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

View file

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