updates UI

This commit is contained in:
mike
2026-07-01 03:46:10 +02:00
parent 145fa686e4
commit 970daeba31
5 changed files with 470 additions and 7 deletions

View File

@@ -26,6 +26,14 @@ def state_path(output_dir: str, group_id: str) -> str:
def load_state(output_dir: str, group_id: str) -> Optional[dict]:
try:
import database
db_state = database.load_turntable(group_id)
if db_state:
return db_state
except Exception as e:
print(f"[turntable_cache] DB load error: {e}")
p = state_path(output_dir, group_id)
if not os.path.exists(p):
return None
@@ -44,6 +52,12 @@ def save_state(output_dir: str, group_id: str, state: dict):
json.dump(state, f, indent=2)
os.replace(tmp, p) # atomic
try:
import database
database.save_turntable(group_id, state)
except Exception as e:
print(f"[turntable_cache] DB save error: {e}")
def init_state(
output_dir: str,
@@ -139,6 +153,12 @@ def delete_state(output_dir: str, group_id: str):
if os.path.isdir(d):
shutil.rmtree(d)
try:
import database
database.delete_turntable(group_id)
except Exception as e:
print(f"[turntable_cache] DB delete error: {e}")
def get_group_video(output_dir: str, group_id: str) -> Optional[str]:
"""Return the video path if the turntable is complete and the file exists."""