The single net8.0 build compiled against Jellyfin 10.9.11 still loads on
10.11 and 12, so channels and browsing keep working, but 10.11 changed
APIs in ways that only fail at runtime. A binary audit of the DLL against
the real server assemblies found 9 broken references on both 10.11 and
12 (none on 10.9/10.10):
- TaskTriggerInfo.Type became an enum. GetDefaultTriggers throws, so
Jellyfin silently gives every SRF task a 24h fallback trigger. The
recording scheduler therefore ran about once a day and scheduled
recordings never started.
- ILibraryManager.GetItemList changed its return type: the expiration
check crashed on every run.
- Jellyfin.Data.Entities.User moved (IUserManager.Users, GetUserData,
SaveUserData, PlaybackProgressEventArgs.Users): resume cleanup returned
500 and the playback-stop guard threw on every stop.
Jellyfin 12 also rejects the legacy X-Emby-Token header with an empty
401, which the recordings UI surfaced as "Unexpected end of JSON input".
The pages now send Authorization: MediaBrowser Token="...", verified on
10.9, 10.11 and 12.
The plugin now multi-targets net8.0/net9.0/net10.0 against Jellyfin
10.9.11/10.11.0/12.0.0 (the oldest package of each line, so each DLL
loads on every patch release of it), with JELLYFIN_10_11_OR_GREATER and
JELLYFIN_12_OR_GREATER for the differences. Trigger construction moves
into Utilities/TaskTriggers so the version switch lives in one place.
.gitea/scripts/build-plugins.sh builds one zip per generation. jprm has
no targetAbi flag, so it rewrites build.yaml per flavour and restores
it. Jellyfin installs the highest version whose targetAbi it satisfies,
so the flavour code goes into the last version segment:
release v1.2.0 -> 1.2.0.9 / 1.2.0.11 / 1.2.0.12
nightly -> 1.0.<date>.<run>09 / 11 / 12
The PR, nightly and release workflows use the script and publish one
manifest entry per zip. Verified end to end against a three-entry
manifest: 10.11 installs the .11 build, 12.1 installs the .12 build.
The existing .NET 10 builder image builds all three unchanged.
Supporting changes: the test project multi-targets too, because jprm
publishes the whole solution for one framework at a time, and it drops
its Microsoft.Extensions.Logging 8.0.1 pin, which is a NU1605 downgrade
under the newer Jellyfin packages. CA1873 (new in the .NET 10 analyzers)
is silenced beside CA1848. The release manifest step checks out
origin/master like the nightly does since 7e1973a.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
111 lines
3.7 KiB
C#
111 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
|
using Jellyfin.Plugin.SRFPlay.Utilities;
|
|
using MediaBrowser.Model.Tasks;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Jellyfin.Plugin.SRFPlay.ScheduledTasks;
|
|
|
|
/// <summary>
|
|
/// Scheduled task for refreshing SRF Play content.
|
|
/// </summary>
|
|
public class ContentRefreshTask : IScheduledTask
|
|
{
|
|
private readonly ILogger<ContentRefreshTask> _logger;
|
|
private readonly IContentRefreshService _contentRefreshService;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ContentRefreshTask"/> class.
|
|
/// </summary>
|
|
/// <param name="logger">The logger instance.</param>
|
|
/// <param name="contentRefreshService">The content refresh service.</param>
|
|
public ContentRefreshTask(
|
|
ILogger<ContentRefreshTask> logger,
|
|
IContentRefreshService contentRefreshService)
|
|
{
|
|
_logger = logger;
|
|
_contentRefreshService = contentRefreshService;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public string Name => "Refresh SRF Play Content";
|
|
|
|
/// <inheritdoc />
|
|
public string Description => "Refreshes latest and trending content from SRF Play";
|
|
|
|
/// <inheritdoc />
|
|
public string Category => "SRF Play";
|
|
|
|
/// <inheritdoc />
|
|
public string Key => "SRFPlayContentRefresh";
|
|
|
|
/// <inheritdoc />
|
|
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
|
|
{
|
|
_logger.LogInformation("Starting SRF Play content refresh task");
|
|
progress?.Report(0);
|
|
|
|
try
|
|
{
|
|
var config = Plugin.Instance?.Configuration;
|
|
if (config == null)
|
|
{
|
|
_logger.LogWarning("Plugin configuration not available");
|
|
return;
|
|
}
|
|
|
|
if (!config.EnableLatestContent && !config.EnableTrendingContent)
|
|
{
|
|
_logger.LogInformation("Content refresh is disabled in configuration");
|
|
progress?.Report(100);
|
|
return;
|
|
}
|
|
|
|
// Refresh content for every business unit (one channel per unit).
|
|
var units = System.Enum.GetValues<Configuration.BusinessUnit>();
|
|
foreach (var unit in units)
|
|
{
|
|
var businessUnit = unit.ToLowerString();
|
|
|
|
if (config.EnableLatestContent)
|
|
{
|
|
_logger.LogInformation("Refreshing latest content for {BusinessUnit}", businessUnit);
|
|
progress?.Report(25);
|
|
await _contentRefreshService.RefreshLatestContentAsync(businessUnit, cancellationToken).ConfigureAwait(false);
|
|
}
|
|
|
|
if (config.EnableTrendingContent)
|
|
{
|
|
_logger.LogInformation("Refreshing trending content for {BusinessUnit}", businessUnit);
|
|
progress?.Report(75);
|
|
await _contentRefreshService.RefreshTrendingContentAsync(businessUnit, cancellationToken).ConfigureAwait(false);
|
|
}
|
|
}
|
|
|
|
progress?.Report(100);
|
|
_logger.LogInformation("SRF Play content refresh task completed successfully");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Error during SRF Play content refresh task");
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
|
{
|
|
var config = Plugin.Instance?.Configuration;
|
|
var intervalHours = config?.ContentRefreshIntervalHours ?? 6;
|
|
|
|
// Run every X hours as configured
|
|
return new[]
|
|
{
|
|
TaskTriggers.Interval(TimeSpan.FromHours(intervalHours))
|
|
};
|
|
}
|
|
}
|