Compare commits
2 commits
6e4e8ca7a6
...
a229194d48
Author | SHA1 | Date | |
---|---|---|---|
a229194d48 | |||
3d5293e7de |
2 changed files with 10 additions and 10 deletions
|
@ -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
|
||||
|
||||
|
|
18
render.py
18
render.py
|
@ -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]
|
||||
|
|
Loading…
Reference in a new issue