Skip to content

Add eager caching system for series data#286

Closed
firestaerter3 wants to merge 208 commits intoKevinjil:masterfrom
firestaerter3:pr/eager-caching-system
Closed

Add eager caching system for series data#286
firestaerter3 wants to merge 208 commits intoKevinjil:masterfrom
firestaerter3:pr/eager-caching-system

Conversation

@firestaerter3
Copy link

@firestaerter3 firestaerter3 commented Jan 29, 2026

Summary

Pre-fetches and caches all series data at plugin startup for instant browsing. Also includes TVDb metadata integration for improved artwork.

Dependencies

This PR must be merged AFTER PR #283 (Flat View) because both modify SeriesChannel.cs and Plugin.cs. Merging out of order will cause conflicts.

Merge order: #283 → this PR

Features

Core Caching

  • New SeriesCacheService for managing cached series data
  • Configurable cache enable/disable toggle
  • Background cache refresh with progress logging
  • Automatic cache population on plugin startup

Database Synchronization

  • Delta-based sync: only adds/updates/removes changed items
  • Populates Jellyfin database after cache refresh
  • Clear Cache button triggers proper Jellyfin DB cleanup

Scheduled Refresh

  • Configurable auto-refresh interval (default: 60 minutes)
  • Manual refresh via UI button
  • Scheduled task integration for periodic updates

TVDb Metadata Integration

  • Lookup series on TVDb during cache refresh
  • Replace low-quality provider artwork with TVDb images
  • Title Override Map for series that can't be found by name search
  • Format: SeriesTitle=TVDbID (one per line in config)

Error Handling

  • RetryHandler for transient API failures
  • FailureTrackingService to skip consistently failing series
  • Graceful degradation when cache is unavailable

UI Updates

  • Cache refresh button with progress display
  • Enable/disable caching checkbox
  • Refresh interval configuration
  • TVDb enable/disable toggle
  • Title override map text area

Files Changed (14 files)

New files:

  • Service/SeriesCacheService.cs - Core caching service with TVDb lookup
  • Service/FailureTrackingService.cs - Track failing series
  • Service/RetryHandler.cs - HTTP retry logic
  • Tasks/SeriesCacheRefreshTask.cs - Scheduled refresh task

Modified files:

  • Plugin.cs - Initialize cache service
  • PluginConfiguration.cs - Cache and TVDb settings
  • SeriesChannel.cs - Use cached data
  • PluginServiceRegistrator.cs - DI registration
  • TaskService.cs - Task management
  • StreamService.cs - Logging improvements
  • XtreamController.cs - Cache API endpoints
  • Xtream.js, XtreamSeries.html, XtreamSeries.js - UI

Testing

  • Tested with 200+ series library
  • Verified delta sync only updates changed items
  • Confirmed cache survives plugin restarts
  • Tested manual and scheduled refresh
  • Tested TVDb artwork replacement

Backward Compatibility

  • Caching is disabled by default
  • TVDb lookup is enabled by default (uses Jellyfin's existing TVDb plugin)
  • Existing functionality unchanged when caching disabled
  • Opt-in feature via configuration

Kevinjil and others added 30 commits May 24, 2022 16:24
What is working:
- Get VOD stream information
- Stream VOD
- Get IPTV stream information
- Stream IPTV
- Get Series stream information
- Stream Series
Include generation of a plugin repository using GitHub pages.
Bump action version.
Restore the build action in the publish workflow.
Configuration is only possible via the XML document. No interface for
the configuration has been written. The current state only lists the
channels with pictures and is able to play the stream. Program guide is
not implemented.
Change build target to Jellyfin v10.8.* release.
For some reason, content is not shown in the folders when the folder
type is set. This requires additional debugging at a later moment.
Kevinjil and others added 27 commits October 21, 2025 20:44
Removing them forces Jellyfin to use the metadata provider to get correct season and episode images
This allows for faster buffering and transcode starting, as the upstream
server often sends some buffered data before the clients connect.
The error handler ignores deserialization errors on nullable properties.
We can mark all properties which are not strictly neccessary for the
functionality of this plugin as nullable, and improve the user
experience by having less failures in loading content.

We might have to refactor the xtream client to include logging, as
errors are now silently ignored.
No functional changes intended with this commit.
No functional changes intended.
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v5...v6)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Dependency Injection was smart enough to insert a http client, s.t. our
implementation for creating one was never called. Remove the constructor
and make the plugin responsible of initializing the user agent.
In Jellyfin 10.11.x, `Live TV` is no longer displayed under the
category. The upstream repository uses `LiveTV`, so let's try that and
see if it ends up on the correct category.
Bumps [shogo82148/actions-upload-release-asset](https://github.com/shogo82148/actions-upload-release-asset) from 1.9.1 to 1.9.2.
- [Release notes](https://github.com/shogo82148/actions-upload-release-asset/releases)
- [Commits](shogo82148/actions-upload-release-asset@v1.9.1...v1.9.2)

---
updated-dependencies:
- dependency-name: shogo82148/actions-upload-release-asset
  dependency-version: 1.9.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v6...v7)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pre-fetches and caches all series, seasons, and episodes data at plugin
startup, enabling instant browsing without waiting for API calls.

## Features

### Core Caching
- New SeriesCacheService for managing cached series data
- Configurable cache enable/disable toggle
- Background cache refresh with progress logging
- Automatic cache population on plugin startup

### Database Synchronization
- Delta-based sync: only adds/updates/removes changed items
- Populates Jellyfin database after cache refresh
- Clear Cache button triggers proper Jellyfin DB cleanup

### Scheduled Refresh
- Configurable auto-refresh interval (default: 60 minutes)
- Manual refresh via UI button
- Scheduled task integration for periodic updates

### Error Handling
- RetryHandler for transient API failures
- FailureTrackingService to skip consistently failing series
- Graceful degradation when cache is unavailable

### UI Updates
- Cache refresh button with progress display
- Enable/disable caching checkbox
- Refresh interval configuration
- Fixed authentication headers for refresh API calls

## Dependencies

**This PR must be merged AFTER PR #283 (Flat View)** because:
- Both modify SeriesChannel.cs and Plugin.cs
- Caching integrates with flat view data retrieval
- Merging out of order will cause conflicts

**Merge order:** PR #283 → this PR

## Files Changed (14 files)
- New: SeriesCacheService.cs, FailureTrackingService.cs, RetryHandler.cs
- New: Tasks/SeriesCacheRefreshTask.cs
- Modified: Plugin.cs, PluginConfiguration.cs, SeriesChannel.cs
- Modified: PluginServiceRegistrator.cs, TaskService.cs, StreamService.cs
- Modified: XtreamController.cs, Xtream.js, XtreamSeries.html, XtreamSeries.js

## Testing
- Tested with 200+ series library
- Verified delta sync only updates changed items
- Confirmed cache survives plugin restarts
- Tested manual and scheduled refresh

## Backward Compatibility
- Caching disabled by default
- Existing functionality unchanged when disabled
- Opt-in feature via configuration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants