Clean up dead code, consolidate duplication, fix redundancies
Remove 9 dead methods, 6 unused constants, and redundant ReaderWriterLockSlim from MetadataCache. Consolidate repeated patterns into HasChapters, IsPlayable, and ToLowerString helpers. Extract shared API methods in SRFApiClient. Move variant manifest rewriting from controller to StreamProxyService. Make Auto quality distinct from HD. Update README architecture section.
This commit is contained in:
@@ -23,7 +23,7 @@ Then install "SRF Play" from the plugin catalog.
|
||||
- Support for all Swiss broadcasting units (SRF, RTS, RSI, RTR, SWI)
|
||||
- Automatic content expiration handling
|
||||
- Latest and trending content discovery
|
||||
- Quality selection (Auto, SD, HD)
|
||||
- Quality selection (Auto lets CDN decide, SD prefers 480p/360p, HD prefers 1080p/720p)
|
||||
- HLS streaming support with Akamai token authentication
|
||||
- Proxy support for routing traffic through alternate gateways
|
||||
- Smart caching with reduced TTL for upcoming livestreams
|
||||
@@ -126,7 +126,7 @@ The compiled plugin will be in `bin/Debug/net8.0/`
|
||||
## Configuration
|
||||
|
||||
- **Business Unit**: Select the Swiss broadcasting unit (default: SRF)
|
||||
- **Quality Preference**: Choose video quality (Auto/SD/HD)
|
||||
- **Quality Preference**: Choose video quality — Auto (first available, CDN decides), SD, or HD
|
||||
- **Content Refresh Interval**: How often to check for new content (1-168 hours)
|
||||
- **Expiration Check Interval**: How often to check for expired content (1-168 hours)
|
||||
- **Cache Duration**: How long to cache metadata (5-1440 minutes)
|
||||
@@ -154,49 +154,78 @@ If you encounter issues with the plugin:
|
||||
```
|
||||
Jellyfin.Plugin.SRFPlay/
|
||||
├── Api/
|
||||
│ ├── Models/ # API response models
|
||||
│ │ ├── MediaComposition.cs
|
||||
│ │ ├── Chapter.cs
|
||||
│ │ ├── Resource.cs
|
||||
│ ├── Models/ # API response models
|
||||
│ │ ├── MediaComposition.cs # Root composition (HasChapters helper)
|
||||
│ │ ├── Chapter.cs # Video/episode chapter with resources
|
||||
│ │ ├── Resource.cs # Stream URL entry (IsPlayable helper)
|
||||
│ │ ├── Show.cs
|
||||
│ │ ├── Episode.cs
|
||||
│ │ └── PlayV3/ # Play v3 API models
|
||||
│ │ └── PlayV3/ # Play v3 API models
|
||||
│ │ ├── PlayV3Show.cs
|
||||
│ │ ├── PlayV3Topic.cs
|
||||
│ │ ├── PlayV3Video.cs
|
||||
│ │ ├── PlayV3TvProgram.cs
|
||||
│ │ └── PlayV3TvProgramGuideResponse.cs
|
||||
│ └── SRFApiClient.cs # HTTP client for SRF API
|
||||
│ │ ├── PlayV3Response.cs
|
||||
│ │ ├── PlayV3DirectResponse.cs
|
||||
│ │ └── PlayV3DataContainer.cs
|
||||
│ ├── SRFApiClient.cs # HTTP client for SRF APIs
|
||||
│ ├── ISRFApiClientFactory.cs # Factory interface
|
||||
│ └── SRFApiClientFactory.cs # Factory implementation
|
||||
├── Channels/
|
||||
│ └── SRFPlayChannel.cs # Channel implementation
|
||||
│ └── SRFPlayChannel.cs # Channel implementation
|
||||
├── Configuration/
|
||||
│ ├── PluginConfiguration.cs
|
||||
│ └── configPage.html
|
||||
├── Constants/
|
||||
│ └── ApiEndpoints.cs # API base URLs and endpoint constants
|
||||
├── Controllers/
|
||||
│ └── StreamProxyController.cs # HLS proxy endpoints (master/variant/segment)
|
||||
├── Services/
|
||||
│ ├── StreamUrlResolver.cs # HLS stream resolution & authentication
|
||||
│ ├── MetadataCache.cs # Caching layer
|
||||
│ ├── ContentExpirationService.cs # Expiration management
|
||||
│ ├── ContentRefreshService.cs # Content discovery
|
||||
│ └── CategoryService.cs # Topic/category management
|
||||
│ ├── Interfaces/ # Service contracts
|
||||
│ │ ├── IStreamProxyService.cs
|
||||
│ │ ├── IStreamUrlResolver.cs
|
||||
│ │ ├── IMediaCompositionFetcher.cs
|
||||
│ │ ├── IMediaSourceFactory.cs
|
||||
│ │ ├── IMetadataCache.cs
|
||||
│ │ ├── IContentRefreshService.cs
|
||||
│ │ ├── IContentExpirationService.cs
|
||||
│ │ └── ICategoryService.cs
|
||||
│ ├── StreamProxyService.cs # HLS proxy: auth, manifest rewriting, segments
|
||||
│ ├── StreamUrlResolver.cs # Stream selection & Akamai authentication
|
||||
│ ├── MediaCompositionFetcher.cs # Cached API fetcher
|
||||
│ ├── MediaSourceFactory.cs # Jellyfin MediaSourceInfo builder
|
||||
│ ├── MetadataCache.cs # Thread-safe ConcurrentDictionary cache
|
||||
│ ├── ContentExpirationService.cs
|
||||
│ ├── ContentRefreshService.cs
|
||||
│ └── CategoryService.cs
|
||||
├── Providers/
|
||||
│ ├── SRFSeriesProvider.cs # Series metadata
|
||||
│ ├── SRFEpisodeProvider.cs # Episode metadata
|
||||
│ ├── SRFImageProvider.cs # Image fetching
|
||||
│ └── SRFMediaProvider.cs # Playback URLs
|
||||
│ ├── SRFSeriesProvider.cs # Series metadata
|
||||
│ ├── SRFEpisodeProvider.cs # Episode metadata
|
||||
│ ├── SRFImageProvider.cs # Image fetching
|
||||
│ └── SRFMediaProvider.cs # Playback URLs
|
||||
├── Utilities/
|
||||
│ ├── Extensions.cs # BusinessUnit.ToLowerString() extension
|
||||
│ ├── MimeTypeHelper.cs # Content-type detection
|
||||
│ ├── PlaceholderImageGenerator.cs
|
||||
│ └── UrnHelper.cs # URN parsing utilities
|
||||
├── ScheduledTasks/
|
||||
│ ├── ContentRefreshTask.cs # Periodic content refresh
|
||||
│ └── ExpirationCheckTask.cs # Periodic expiration check
|
||||
├── ServiceRegistrator.cs # DI registration
|
||||
└── Plugin.cs # Main plugin entry point
|
||||
│ ├── ContentRefreshTask.cs # Periodic content refresh
|
||||
│ └── ExpirationCheckTask.cs # Periodic expiration check
|
||||
├── ServiceRegistrator.cs # DI registration
|
||||
└── Plugin.cs # Main plugin entry point
|
||||
```
|
||||
|
||||
### Key Components
|
||||
|
||||
1. **API Client**: Handles all HTTP requests to SRF Integration Layer and Play v3 API
|
||||
2. **Channel**: SRF Play channel with Latest, Trending, and Live Sports folders
|
||||
3. **Stream Resolver**: Extracts and selects optimal HLS streams with Akamai authentication
|
||||
4. **Configuration**: User-configurable settings via Jellyfin dashboard
|
||||
5. **Metadata Cache**: Thread-safe caching with dynamic TTL for livestreams
|
||||
6. **Content Providers**: Jellyfin integration for series, episodes, images, and media sources
|
||||
7. **Scheduled Tasks**: Automatic content refresh and expiration management
|
||||
8. **Service Layer**: Content discovery, expiration handling, stream resolution, and category management
|
||||
1. **API Client** (`SRFApiClient`): HTTP requests to SRF Integration Layer and Play v3 API, with proxy support
|
||||
2. **Channel** (`SRFPlayChannel`): SRF Play channel with Latest, Trending, and Live Sports folders
|
||||
3. **Stream Proxy** (`StreamProxyService` + `StreamProxyController`): HLS proxy that handles Akamai token auth, manifest URL rewriting, deferred authentication, and token refresh for both VOD and livestreams
|
||||
4. **Stream Resolver** (`StreamUrlResolver`): Selects optimal HLS stream by quality preference, filters DRM content
|
||||
5. **Metadata Cache** (`MetadataCache`): Thread-safe `ConcurrentDictionary` cache with dynamic TTL for livestreams
|
||||
6. **Media Composition Fetcher** (`MediaCompositionFetcher`): Cached wrapper around API client for media composition requests
|
||||
7. **Content Providers** (`SRFSeriesProvider`, `SRFEpisodeProvider`, `SRFImageProvider`, `SRFMediaProvider`): Jellyfin integration for series, episodes, images, and media sources
|
||||
8. **Scheduled Tasks**: Automatic content refresh and expiration management
|
||||
9. **Utilities**: Business unit extensions, MIME type helpers, URN parsing, placeholder image generation
|
||||
|
||||
## Important Notes
|
||||
|
||||
@@ -249,7 +278,9 @@ See LICENSE file for details.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
This plugin was developed with inspiration from the excellent [Kodi SRG SSR addon](https://github.com/goggle/script.module.srgssr) by [@goggle](https://github.com/goggle). The Kodi addon served as a fantastic reference for understanding the SRG SSR API structure, authentication mechanisms, and handling of scheduled livestreams.
|
||||
This plugin was developed partly using [Claude Code](https://docs.anthropic.com/en/docs/claude-code) by Anthropic.
|
||||
|
||||
Inspired by the excellent [Kodi SRG SSR addon](https://github.com/goggle/script.module.srgssr) by [@goggle](https://github.com/goggle), which served as a fantastic reference for understanding the SRG SSR API structure, authentication mechanisms, and handling of scheduled livestreams.
|
||||
|
||||
## References
|
||||
|
||||
|
||||
Reference in New Issue
Block a user