feat: 5-Jahres-Filter für Streaming Top10, Endpoint für komplette TMDb-Provider-Liste DE

This commit is contained in:
2026-06-19 08:19:51 +02:00
parent 6d652e292f
commit 2dbbf65e43

View File

@@ -507,17 +507,30 @@ router.get('/streaming/:providerId', authenticate, async (req, res) => {
const provider = STREAMING_PROVIDERS.find(p => p.id === req.params.providerId); const provider = STREAMING_PROVIDERS.find(p => p.id === req.params.providerId);
if (!provider) return res.status(404).json({ error: 'Unbekannter Anbieter' }); if (!provider) return res.status(404).json({ error: 'Unbekannter Anbieter' });
const discoverParams = { // Nur Titel der letzten 5 Jahre
const minYear = new Date().getFullYear() - 5;
const minDate = `${minYear}-01-01`;
const movieParams = {
watch_region: 'DE', watch_region: 'DE',
with_watch_providers: provider.tmdbId, with_watch_providers: provider.tmdbId,
with_watch_monetization_types: 'flatrate', with_watch_monetization_types: 'flatrate',
sort_by: 'popularity.desc', sort_by: 'popularity.desc',
'vote_count.gte': 10, 'vote_count.gte': 10,
'primary_release_date.gte': minDate,
};
const tvParams = {
watch_region: 'DE',
with_watch_providers: provider.tmdbId,
with_watch_monetization_types: 'flatrate',
sort_by: 'popularity.desc',
'vote_count.gte': 10,
'first_air_date.gte': minDate,
}; };
const [movieResults, tvResults, genreMap] = await Promise.all([ const [movieResults, tvResults, genreMap] = await Promise.all([
tmdb('/discover/movie', discoverParams), tmdb('/discover/movie', movieParams),
tmdb('/discover/tv', { ...discoverParams, first_air_date_year: undefined }), tmdb('/discover/tv', tvParams),
getGenreMap(), getGenreMap(),
]); ]);
@@ -638,6 +651,23 @@ router.post('/favorites/:id/acknowledge', authenticate, requireAdmin, (req, res)
res.json({ ok: true }); res.json({ ok: true });
}); });
// Admin: ALLE verfügbaren Watch-Provider für Deutschland live von TMDb holen
router.get('/streaming/all-providers', authenticate, requireAdmin, async (req, res) => {
try {
const [movieProv, tvProv] = await Promise.all([
tmdb('/watch/providers/movie', { watch_region: 'DE' }),
tmdb('/watch/providers/tv', { watch_region: 'DE' }),
]);
const merged = {};
for (const p of [...(movieProv.results||[]), ...(tvProv.results||[])]) {
merged[p.provider_id] = { id: p.provider_id, name: p.provider_name, logo: p.logo_path,
priority: p.display_priorities?.DE ?? p.display_priority ?? 999 };
}
const list = Object.values(merged).sort((a,b) => a.priority - b.priority);
res.json(list);
} catch(e) { res.status(500).json({ error: e.message }); }
});
router.get('/settings', authenticate, requireAdmin, (req, res) => res.json({ configured: !!getToken() })); router.get('/settings', authenticate, requireAdmin, (req, res) => res.json({ configured: !!getToken() }));
router.put('/settings', authenticate, requireAdmin, (req, res) => { router.put('/settings', authenticate, requireAdmin, (req, res) => {
const { tmdb_token } = req.body; const { tmdb_token } = req.body;