handle shows without season folders

This commit is contained in:
Garret Patti
2026-04-05 22:18:08 -04:00
parent 0c234b691e
commit 87a90a88bc
2 changed files with 31 additions and 2 deletions

View File

@@ -73,7 +73,15 @@ export default function TvView({ libraryId }: Props) {
setError(null)
fetch(`/api/tv?libraryId=${encodeURIComponent(libraryId)}&seriesId=${encodeURIComponent(s.id)}`)
.then((r) => r.json())
.then((data) => { setSeasons(data); setLoading(false) })
.then((data: TvSeason[]) => {
setSeasons(data)
setLoading(false)
// Flat series: a single synthetic season (id='.') means episodes live
// directly in the series folder — skip the seasons screen automatically.
if (data.length === 1 && data[0].id === '.') {
openSeason(data[0])
}
})
.catch(() => { setError('Failed to load seasons'); setLoading(false) })
}