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>
96 lines
3.2 KiB
C#
96 lines
3.2 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 checking and removing expired SRF Play content.
|
|
/// </summary>
|
|
public class ExpirationCheckTask : IScheduledTask
|
|
{
|
|
private readonly ILogger<ExpirationCheckTask> _logger;
|
|
private readonly IContentExpirationService _expirationService;
|
|
private readonly IStreamProxyService _streamProxyService;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="ExpirationCheckTask"/> class.
|
|
/// </summary>
|
|
/// <param name="logger">The logger instance.</param>
|
|
/// <param name="expirationService">The content expiration service.</param>
|
|
/// <param name="streamProxyService">The stream proxy service.</param>
|
|
public ExpirationCheckTask(
|
|
ILogger<ExpirationCheckTask> logger,
|
|
IContentExpirationService expirationService,
|
|
IStreamProxyService streamProxyService)
|
|
{
|
|
_logger = logger;
|
|
_expirationService = expirationService;
|
|
_streamProxyService = streamProxyService;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public string Name => "Check SRF Play Content Expiration";
|
|
|
|
/// <inheritdoc />
|
|
public string Description => "Checks for expired SRF Play content and removes it from the library";
|
|
|
|
/// <inheritdoc />
|
|
public string Category => "SRF Play";
|
|
|
|
/// <inheritdoc />
|
|
public string Key => "SRFPlayExpirationCheck";
|
|
|
|
/// <inheritdoc />
|
|
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
|
|
{
|
|
_logger.LogInformation("Starting SRF Play expiration check task");
|
|
progress?.Report(0);
|
|
|
|
try
|
|
{
|
|
var config = Plugin.Instance?.Configuration;
|
|
if (config == null)
|
|
{
|
|
_logger.LogWarning("Plugin configuration not available");
|
|
return;
|
|
}
|
|
|
|
// Check and remove expired content
|
|
progress?.Report(25);
|
|
var removedCount = await _expirationService.CheckAndRemoveExpiredContentAsync(cancellationToken).ConfigureAwait(false);
|
|
|
|
// Clean up old stream proxy mappings
|
|
progress?.Report(75);
|
|
_streamProxyService.CleanupOldMappings();
|
|
|
|
progress?.Report(100);
|
|
_logger.LogInformation("SRF Play expiration check task completed. Removed {Count} expired items", removedCount);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_logger.LogError(ex, "Error during SRF Play expiration check task");
|
|
throw;
|
|
}
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
|
{
|
|
var config = Plugin.Instance?.Configuration;
|
|
var intervalHours = config?.ExpirationCheckIntervalHours ?? 24;
|
|
|
|
// Run daily at 3 AM or every X hours as configured
|
|
return new[]
|
|
{
|
|
TaskTriggers.Daily(TimeSpan.FromHours(3)),
|
|
TaskTriggers.Interval(TimeSpan.FromHours(intervalHours))
|
|
};
|
|
}
|
|
}
|