Refactor: Improve movie linking and player logic

Co-authored-by: mathieumoran1 <[email protected]>
This commit is contained in:
Cursor Agent
2025-12-22 22:37:41 +00:00
co-authored by mathieumoran1
parent c207a03f39
commit f655dabc36
3 changed files with 42 additions and 19 deletions
+6 -1
View File
@@ -130,7 +130,7 @@ router.get("/stats", verifyToken, async (req, res) => {
// Fetch movies (optionally filtered by year)
const allMovies = await Movie.find({ year })
.select("imdb_id title poster rating category year")
.select("imdb_id title poster rating category year vod_link player_mode video_src embed_src video_file")
.lean();
const totalMoviesCount = allMovies.length;
@@ -158,6 +158,11 @@ router.get("/stats", verifyToken, async (req, res) => {
rating: movie.rating || "",
category: movie.category || "",
year: Number.isInteger(movie.year) ? movie.year : year,
vod_link: movie.vod_link || "",
player_mode: movie.player_mode || "auto",
video_src: movie.video_src || "",
embed_src: movie.embed_src || "",
video_file: movie.video_file || "",
watchedDate: wm?.watchedDate ? new Date(wm.watchedDate).toISOString() : null,
};
})