better way to calculate remove

This commit is contained in:
j 2024-03-19 11:48:36 +01:00
parent a229194d48
commit 01f669b61d
1 changed files with 12 additions and 2 deletions

View File

@ -308,6 +308,16 @@ def get_scene_duration(scene):
duration += clip['duration']
return duration
def get_offset_duration(prefix):
duration = 0
for root, folders, files in os.walk(prefix):
for f in files:
if f == 'scene.json':
path = os.path.join(root, f)
scene = json.load(open(path))
duration += get_scene_duration(scene)
return duration
def render(root, scene, prefix=''):
fps = 24
files = []
@ -656,8 +666,8 @@ def render_infinity(options):
if f.isdigit() and os.path.isdir(render_prefix + f) and state["offset"] > int(f) >= 100
]
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