From aca99f71c1bd04664866d95a8a232271522e51bb Mon Sep 17 00:00:00 2001 From: tanvithomare Date: Wed, 7 Jan 2026 13:42:30 -0800 Subject: [PATCH] Added looping feature to cache videos --- server.py | 6 ++--- static/cache.html | 64 ++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/server.py b/server.py index 06c23e5..5facdf2 100644 --- a/server.py +++ b/server.py @@ -187,7 +187,7 @@ def stop_all_videos(): # terminate a parent process and all its child processes using a specified signal. -def kill_child_processes(parent_pid, sig=signal.SIGKILL): +def kill_child_processes(parent_pid, sig=signal.SIGILL): try: parent = psutil.Process(parent_pid) parent.send_signal(sig) @@ -412,7 +412,7 @@ async def state(): @app.post("/play/file") -async def play_file(file_path: str = "cache", title: str = None, thumbnail: str = None): +async def play_file(file_path: str = "cache", title: str = None, thumbnail: str = None, loop: bool = False): try: # check if we are going to play all videos or a single video in the cache @@ -427,7 +427,7 @@ async def play_file(file_path: str = "cache", title: str = None, thumbnail: str args=( file_path, State.PLAYING, - False, + loop, title, thumbnail, ), diff --git a/static/cache.html b/static/cache.html index 4c9234a..cb6d0ca 100644 --- a/static/cache.html +++ b/static/cache.html @@ -17,11 +17,14 @@

Cache Storage