This implementation adds comprehensive season support to the ContinueJS media tracking application for TV Shows and Anime. It handles the complexity of different API responses and provides a flexible system for tracking progress across seasons.
SeasonInfointerface handles multiple season representation formats- Supports both explicit season selection and automatic detection
- Handles API inconsistencies gracefully
- Anime (Jikan API): Extracts season info from titles + manual override
- TV Shows (TMDB API): Fetches detailed season information with episode counts
- Season Detection: Smart parsing of anime titles for season numbers
- Automatic Season Detection: For anime titles like "Attack on Titan Season 2"
- Manual Season Selection: For shows with multiple seasons
- Season Display: Shows current season and progress in cards
- Flexible Input: Manual season input for edge cases
// Example: Attack on Titan Season 2, Episode 5
"S2E5 of 12" instead of "Episode 17 of 25"extractSeasonFromAnimeTitle("Attack on Titan Season 2")
// → { seasonNumber: 2, cleanTitle: "Attack on Titan" }// Game of Thrones - User selects Season 3
// Progress shows: "S3E7 of 10" + "Season 3 of 8"- User searches "Attack on Titan"
- Results show "Attack on Titan Season 2"
- System detects season automatically
- Shows: "Season 2 (Spring 2017) • 12 episodes"
- Progress tracks as "S2E5 of 12"
- User searches "Game of Thrones"
- System fetches show details (8 seasons)
- User selects "Season 3" (10 episodes)
- Progress tracks as "S3E7 of 10 • Season 3 of 8"
- User has "Attack on Titan" Season 1 completed
- Adds Season 2 → automatically detects as separate season
- Both seasons tracked independently with proper progress
/lib/types.ts- AddedSeasonInfointerface and extended existing types/lib/season-utils.ts- Season detection, formatting, and progress utilities/api/media/show-details/[id]/route.ts- New endpoint for detailed show info/components/media/AddMediaDialog.tsx- Season selection UI/components/media/MediaCard.tsx- Season display in cards/components/media/EditMediaDialog.tsx- Season editing support/lib/media-utils.ts- Season-aware progress display
interface SeasonInfo {
currentSeason?: number; // Which season user is watching
totalSeasons?: number; // Total seasons available
seasonName?: string; // Custom name (e.g., "Final Season")
episodesInSeason?: number; // Episodes in current season
seasonYear?: number; // Year the season aired
seasonPeriod?: string; // Spring/Summer/Fall/Winter for anime
}// Anime API (Jikan) - Multiple entries per season
[
{ title: "Attack on Titan", season: "spring", year: 2013 },
{ title: "Attack on Titan Season 2", season: "spring", year: 2017 },
{ title: "Attack on Titan Season 3", season: "summer", year: 2018 }
]
// TV Show API (TMDB) - Single entry with season details
{
name: "Game of Thrones",
number_of_seasons: 8,
seasons: [
{ season_number: 1, episode_count: 10, name: "Season 1" },
{ season_number: 2, episode_count: 10, name: "Season 2" },
// ...
]
}- Accurate Progress Tracking - Users see exactly which episode of which season they're on
- API Flexibility - Works with different API response formats
- User Choice - Manual override for complex cases
- Backwards Compatibility - Existing media continues to work
- Future-Proof - Extensible for other media types with seasons
- Displays available seasons with episode counts
- Allows manual season number input
- Shows season metadata (year, period)
- Season badge with calendar icon
- Formatted season info (e.g., "Season 2 (2017)")
- Season-aware progress display
- Shows current season information
- Option to change season selection
- Season Auto-Progression - Automatically suggest next season when current is completed
- Season Collections - Group related seasons in UI
- Binge Progress - Track watching multiple seasons in sequence
- Season Recommendations - Suggest related seasons based on completion
- Season Analytics - Show watching patterns across seasons
This implementation provides a robust foundation for season tracking while maintaining simplicity and user control.