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
User=pandora
Group=pandora
Nice=19
Nice=-15
WorkingDirectory=/srv/pandora/pandora
ExecStart=/srv/pandora/pandora/manage.py infinity

View file

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