From ad1d2791c04ff0b54a15cc4a0523dc06e9cadea3 Mon Sep 17 00:00:00 2001 From: ThisBirchWood Date: Wed, 12 Feb 2025 13:27:17 +0000 Subject: [PATCH 1/3] UPDATE: HLS segments now named by timestamp, rather than sequential numbering --- nginx/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 9baa77f..020a04c 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -32,6 +32,7 @@ rtmp { hls_nested on; hls_fragment 5s; hls_playlist_length 60s; + hls_fragment_naming timestamp; hls_cleanup off; } } From 01d611c2271fc19fc6832d429c9ab17adce8e921 Mon Sep 17 00:00:00 2001 From: ThisBirchWood Date: Wed, 12 Feb 2025 13:45:56 +0000 Subject: [PATCH 2/3] PATCH: Fixed saved vods not saving in correct order, HLS segments save by system timestamp --- nginx/nginx.conf | 2 +- web_server/celery_tasks/__init__.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 020a04c..10a3b76 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -32,7 +32,7 @@ rtmp { hls_nested on; hls_fragment 5s; hls_playlist_length 60s; - hls_fragment_naming timestamp; + hls_fragment_naming system; hls_cleanup off; } } diff --git a/web_server/celery_tasks/__init__.py b/web_server/celery_tasks/__init__.py index 5a85441..1e6ae2c 100644 --- a/web_server/celery_tasks/__init__.py +++ b/web_server/celery_tasks/__init__.py @@ -34,6 +34,7 @@ def combine_ts_stream(stream_path, vods_path): """ ts_files = [f for f in listdir(stream_path) if f.endswith(".ts")] ts_files.sort() + print(ts_files) # Create temp file listing all ts files with open(f"{stream_path}/list.txt", "w") as f: @@ -61,3 +62,5 @@ def combine_ts_stream(stream_path, vods_path): # Remove ts files for ts_file in ts_files: remove(f"{stream_path}/{ts_file}") + # Remove m3u8 file + remove(f"{stream_path}/index.m3u8") \ No newline at end of file From 571cb9c0f570358236daeed97c2e969a85cd8d1e Mon Sep 17 00:00:00 2001 From: white <122345776@umail.ucc.ie> Date: Wed, 12 Feb 2025 13:49:51 +0000 Subject: [PATCH 3/3] UPDATE: Changed Search Bar to use button press instead of debouncing --- frontend/src/components/Layout/SearchBar.tsx | 60 ++++++++------------ 1 file changed, 25 insertions(+), 35 deletions(-) diff --git a/frontend/src/components/Layout/SearchBar.tsx b/frontend/src/components/Layout/SearchBar.tsx index 93f3da1..1a20502 100644 --- a/frontend/src/components/Layout/SearchBar.tsx +++ b/frontend/src/components/Layout/SearchBar.tsx @@ -1,50 +1,40 @@ -import React, { useState, useEffect } from "react"; +import React, { useState } from "react"; import Input from "./Input"; import { Search as SearchIcon } from "lucide-react"; const SearchBar: React.FC = () => { const [searchQuery, setSearchQuery] = useState(""); - const [debouncedQuery, setDebouncedQuery] = useState(searchQuery); - // Debounce the search query - useEffect(() => { - const timer = setTimeout(() => { - setDebouncedQuery(searchQuery); - }, 500); // Wait 500ms after user stops typing + const handleSearch = async () => { + if (searchQuery.trim()) { + try { + const response = await fetch("/api/search", { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ query: searchQuery }), + }); - return () => clearTimeout(timer); - }, [searchQuery]); - - // Perform search when debounced query changes - useEffect(() => { - if (debouncedQuery.trim()) { - const fetchSearchResults = async () => { - try { - const response = await fetch("/api/search", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ query: debouncedQuery }), // <-- Fixed payload - }); - - const data = await response.json(); - console.log("Search results:", data); - // Handle the search results here - } catch (error) { - console.error("Error performing search:", error); - } - }; - - fetchSearchResults(); // Call the async function + const data = await response.json(); + console.log("Search results:", data); + // Handle the search results here + } catch (error) { + console.error("Error performing search:", error); + } } - }, [debouncedQuery]); - + }; const handleSearchChange = (e: React.ChangeEvent) => { setSearchQuery(e.target.value); }; + const handleKeyDown = (e: React.KeyboardEvent) => { + if (e.key === "Enter") { + handleSearch(); + } + }; + return ( );