Files
OverSnitch/src/lib/radarr.ts
Josh Wright 4b2c82cf90 Add Radarr/Sonarr links and richer metadata to alert detail
- Thread titleSlug through RadarrMovie/SonarrSeries → MediaEntry →
  AlertCandidate, building a direct mediaUrl server-side at alert
  generation time (RADARR_URL/movie/slug, SONARR_URL/series/slug)
- Alert detail page: single-column full-width layout, metadata chips
  row showing opened/closed dates, media type, and a "View in Radarr/
  Sonarr" external link button when available
- Comments section sits below the full-width overview card

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 11:50:23 -04:00

20 lines
583 B
TypeScript

import { RadarrMovie, MediaEntry } from "@/lib/types";
export async function buildRadarrMap(): Promise<Map<number, MediaEntry>> {
const res = await fetch(`${process.env.RADARR_URL}/api/v3/movie`, {
headers: { "X-Api-Key": process.env.RADARR_API! },
});
if (!res.ok) {
throw new Error(`Radarr API error: ${res.status} ${res.statusText}`);
}
const movies: RadarrMovie[] = await res.json();
return new Map(
movies.map((m) => [
m.tmdbId,
{ title: m.title, titleSlug: m.titleSlug, sizeOnDisk: m.sizeOnDisk, available: m.isAvailable },
])
);
}