Refactor movie playback and add clickability to stats
Co-authored-by: mathieumoran1 <[email protected]>
This commit is contained in:
co-authored by
mathieumoran1
parent
d98c802a40
commit
c207a03f39
@@ -361,16 +361,6 @@ router.post("/add", async (req, res) => {
|
||||
if (normalizedMode === null) {
|
||||
return res.status(400).json({ message: "player_mode invalide (auto|video|embed)" });
|
||||
}
|
||||
if (
|
||||
!hasAnySourceIncludingFile({
|
||||
vod_link: normalizedVod || "",
|
||||
video_src: normalizedVideo || "",
|
||||
embed_src: normalizedEmbed || "",
|
||||
video_file: normalizedFile || "",
|
||||
})
|
||||
) {
|
||||
return res.status(400).json({ message: "Ajoute au moins une source (VOD / video_src / embed_src)." });
|
||||
}
|
||||
|
||||
// Fetch movie details from OMDb API
|
||||
let movieDetails;
|
||||
@@ -584,17 +574,6 @@ router.put("/:id", async (req, res) => {
|
||||
if (poster !== undefined) movie.poster = poster;
|
||||
}
|
||||
|
||||
if (
|
||||
!hasAnySourceIncludingFile({
|
||||
vod_link: movie.vod_link || "",
|
||||
video_src: movie.video_src || "",
|
||||
embed_src: movie.embed_src || "",
|
||||
video_file: movie.video_file || "",
|
||||
})
|
||||
) {
|
||||
return res.status(400).json({ message: "Ajoute au moins une source (VOD / video_src / embed_src / video_file)." });
|
||||
}
|
||||
|
||||
await movie.save();
|
||||
cacheClear();
|
||||
return res.status(200).json(movie);
|
||||
|
||||
@@ -151,6 +151,7 @@ router.get("/stats", verifyToken, async (req, res) => {
|
||||
const movie = movieByImdbId.get(imdbId);
|
||||
if (!movie) return null;
|
||||
return {
|
||||
movieId: movie?._id ? String(movie._id) : null,
|
||||
imdb_id: movie.imdb_id,
|
||||
title: movie.title || "",
|
||||
poster: movie.poster || "",
|
||||
|
||||
Reference in New Issue
Block a user