Merge branch 'main' of https://github.com/john-david3/cs3305-team11
This commit is contained in:
@@ -1,10 +1,11 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState } from "react";
|
||||||
import Input from "./Input";
|
import Input from "./Input";
|
||||||
import { Search as SearchIcon } from "lucide-react";
|
import { Search as SearchIcon } from "lucide-react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
|
|
||||||
const SearchBar: React.FC = () => {
|
const SearchBar: React.FC = () => {
|
||||||
const [searchQuery, setSearchQuery] = useState("");
|
const [searchQuery, setSearchQuery] = useState("");
|
||||||
|
<<<<<<< HEAD
|
||||||
//const [debouncedQuery, setDebouncedQuery] = useState(searchQuery);
|
//const [debouncedQuery, setDebouncedQuery] = useState(searchQuery);
|
||||||
const navigate = useNavigate();
|
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>) => {
|
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
setSearchQuery(e.target.value);
|
setSearchQuery(e.target.value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
|
if (e.key === "Enter") {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="search-bar" className="flex items-center">
|
<div id="search-bar" className="flex items-center">
|
||||||
<Input
|
<Input
|
||||||
@@ -63,12 +92,18 @@ const SearchBar: React.FC = () => {
|
|||||||
placeholder="Search..."
|
placeholder="Search..."
|
||||||
value={searchQuery}
|
value={searchQuery}
|
||||||
onChange={handleSearchChange}
|
onChange={handleSearchChange}
|
||||||
|
<<<<<<< HEAD
|
||||||
onKeyDown={handleKeyPress}
|
onKeyDown={handleKeyPress}
|
||||||
extraClasses="pr-[30px] focus:outline-none focus:border-purple-500 focus:w-[30vw]"
|
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" />
|
<SearchIcon className="-translate-x-[28px] top-1/2 h-6 w-6 text-white" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ rtmp {
|
|||||||
hls_nested on;
|
hls_nested on;
|
||||||
hls_fragment 5s;
|
hls_fragment 5s;
|
||||||
hls_playlist_length 60s;
|
hls_playlist_length 60s;
|
||||||
|
hls_fragment_naming system;
|
||||||
hls_cleanup off;
|
hls_cleanup off;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = [f for f in listdir(stream_path) if f.endswith(".ts")]
|
||||||
ts_files.sort()
|
ts_files.sort()
|
||||||
|
print(ts_files)
|
||||||
|
|
||||||
# Create temp file listing all ts files
|
# Create temp file listing all ts files
|
||||||
with open(f"{stream_path}/list.txt", "w") as f:
|
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
|
# Remove ts files
|
||||||
for ts_file in ts_files:
|
for ts_file in ts_files:
|
||||||
remove(f"{stream_path}/{ts_file}")
|
remove(f"{stream_path}/{ts_file}")
|
||||||
|
# Remove m3u8 file
|
||||||
|
remove(f"{stream_path}/index.m3u8")
|
||||||
Reference in New Issue
Block a user