This commit is contained in:
EvanLin3141
2025-02-12 14:43:07 +00:00
3 changed files with 40 additions and 1 deletions

View File

@@ -1,10 +1,11 @@
import React, { useState, useEffect } from "react";
import React, { useState } from "react";
import Input from "./Input";
import { Search as SearchIcon } from "lucide-react";
import { useNavigate } from "react-router-dom";
const SearchBar: React.FC = () => {
const [searchQuery, setSearchQuery] = useState("");
<<<<<<< HEAD
//const [debouncedQuery, setDebouncedQuery] = useState(searchQuery);
const navigate = useNavigate();
@@ -51,11 +52,39 @@ const SearchBar: React.FC = () => {
}
};
=======
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 }),
});
const data = await response.json();
console.log("Search results:", data);
// Handle the search results here
} catch (error) {
console.error("Error performing search:", error);
}
}
};
>>>>>>> 571cb9c0f570358236daeed97c2e969a85cd8d1e
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSearchQuery(e.target.value);
};
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter") {
handleSearch();
}
};
return (
<div id="search-bar" className="flex items-center">
<Input
@@ -63,12 +92,18 @@ const SearchBar: React.FC = () => {
placeholder="Search..."
value={searchQuery}
onChange={handleSearchChange}
<<<<<<< HEAD
onKeyDown={handleKeyPress}
extraClasses="pr-[30px] focus:outline-none focus:border-purple-500 focus:w-[30vw]"
/>
=======
onKeyDown={handleKeyDown}
extraClasses="pr-[30px] focus:outline-none focus:border-purple-500 focus:w-[30vw]"
/>
>>>>>>> 571cb9c0f570358236daeed97c2e969a85cd8d1e
<SearchIcon className="-translate-x-[28px] top-1/2 h-6 w-6 text-white" />
</div>
);

View File

@@ -32,6 +32,7 @@ rtmp {
hls_nested on;
hls_fragment 5s;
hls_playlist_length 60s;
hls_fragment_naming system;
hls_cleanup off;
}
}

View File

@@ -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")