Files
jellyfin-plugin-floatplane/Jellyfin.Plugin.Floatplane/Tasks/FloatplaneSyncTask.cs
claude 9e33a343ab
Some checks failed
release / build-release (push) Has been cancelled
Floatplane channel plugin for Jellyfin 10.10.x: browse, HLS proxy, cookie session, CI release
- IChannel: creators -> sub-channels -> video posts (public listing API, search mapped)
- IRequiresMediaInfoCallback -> signed proxy URLs; stream controller rewrites HLS so the
  AES-128 key is fetched server-side with the session cookie, segments stay on the CDN
- delivery/info cached per token lifetime and throttled (~2/min)
- config page: paste sails.sid + validate, extra creators, quality, search test
- scripts/package.sh -> plugin folder + zip + md5 + manifest.json; Gitea release workflow
- research docs, HAR analysis (HAR itself gitignored), install-pi5.sh

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-25 09:42:27 +01:00

66 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Plugin.Floatplane.Channel;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Plugin.Floatplane.Tasks;
/// <summary>
/// Scheduled task: refresh creators/channels and warm the newest posts, then bump the
/// channel cache key so Jellyfin re-lists on the next browse. Found by type scanning.
/// </summary>
public class FloatplaneSyncTask : IScheduledTask, IConfigurableScheduledTask
{
private readonly CatalogService _catalog;
private readonly ILogger<FloatplaneSyncTask> _logger;
public FloatplaneSyncTask(CatalogService catalog, ILogger<FloatplaneSyncTask> logger)
{
_catalog = catalog;
_logger = logger;
}
/// <inheritdoc />
public string Name => "Refresh Floatplane catalogue";
/// <inheritdoc />
public string Key => "FloatplaneSync";
/// <inheritdoc />
public string Description => "Reloads subscribed creators, their channels and the newest videos from Floatplane.";
/// <inheritdoc />
public string Category => "Floatplane";
/// <inheritdoc />
public bool IsHidden => false;
/// <inheritdoc />
public bool IsEnabled => true;
/// <inheritdoc />
public bool IsLogged => true;
/// <inheritdoc />
public async Task ExecuteAsync(IProgress<double> progress, CancellationToken cancellationToken)
{
_logger.LogInformation("Floatplane sync started");
await _catalog.RefreshAsync(progress, cancellationToken).ConfigureAwait(false);
_logger.LogInformation("Floatplane sync finished: {Creators} creators, generation {Gen}", _catalog.Creators.Count, _catalog.Generation);
}
/// <inheritdoc />
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
{
var hours = Math.Clamp(Plugin.Instance?.Configuration.SyncIntervalHours ?? 6, 1, 168);
return
[
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerStartup },
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerInterval, IntervalTicks = TimeSpan.FromHours(hours).Ticks }
];
}
}