v0.2: All videos folder, shared watched state, release-order sorting, official icon, OAuth plumbing, docs
Some checks failed
release / build-release (push) Has been cancelled
Some checks failed
release / build-release (push) Has been cancelled
- per-creator "All videos" folder (release order across sub-channels); sub-channel copies use cpost: ids and UserDataMirror keeps played/resume state in sync - SortNameUpdater forces release-order sort names so every client lists newest first by default - official Floatplane icon as channel image (Primary only — a channel Thumb hid video thumbnails in Continue Watching) and as 16:9 plugin thumbnail; one-time image replacement on upgrade - OAuth device-flow login (FloatplaneAuthService + settings UI); needs a Floatplane client id; Turnstile verified domain-bound so password login inside Jellyfin is impossible - generic install.sh (linuxserver / official image / native), thumb.png in package + manifest - README rewritten for a general audience, doc/usage.md with screenshots, 60 tests Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,14 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using Jellyfin.Data.Enums;
|
||||
using Jellyfin.Plugin.Floatplane.Channel;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -14,12 +21,23 @@ namespace Jellyfin.Plugin.Floatplane.Tasks;
|
||||
/// </summary>
|
||||
public class FloatplaneSyncTask : IScheduledTask, IConfigurableScheduledTask
|
||||
{
|
||||
/// <summary>Bump when Resources/logo.png changes so existing installs get the new channel image.</summary>
|
||||
public const int ChannelImageVersion = 3;
|
||||
|
||||
private readonly CatalogService _catalog;
|
||||
private readonly SortNameUpdater _sortNames;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IProviderManager _providerManager;
|
||||
private readonly IFileSystem _fileSystem;
|
||||
private readonly ILogger<FloatplaneSyncTask> _logger;
|
||||
|
||||
public FloatplaneSyncTask(CatalogService catalog, ILogger<FloatplaneSyncTask> logger)
|
||||
public FloatplaneSyncTask(CatalogService catalog, SortNameUpdater sortNames, ILibraryManager libraryManager, IProviderManager providerManager, IFileSystem fileSystem, ILogger<FloatplaneSyncTask> logger)
|
||||
{
|
||||
_catalog = catalog;
|
||||
_sortNames = sortNames;
|
||||
_libraryManager = libraryManager;
|
||||
_providerManager = providerManager;
|
||||
_fileSystem = fileSystem;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -50,6 +68,58 @@ public class FloatplaneSyncTask : IScheduledTask, IConfigurableScheduledTask
|
||||
_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);
|
||||
await UpdateChannelImageIfNeededAsync(cancellationToken).ConfigureAwait(false);
|
||||
await _sortNames.UpdateAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Jellyfin stores the channel's image once, so when the plugin ships a new logo the
|
||||
/// stored Primary is replaced explicitly (a metadata refresh does not replace it), and
|
||||
/// Thumb/Backdrop images from earlier versions are removed because video cards inherit
|
||||
/// the parent thumb in "Continue watching". Runs once per <see cref="ChannelImageVersion"/>.
|
||||
/// </summary>
|
||||
private async Task UpdateChannelImageIfNeededAsync(CancellationToken ct)
|
||||
{
|
||||
var cfg = Plugin.Instance?.Configuration;
|
||||
if (cfg == null || cfg.ChannelImageVersion >= ChannelImageVersion)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var channels = _libraryManager.GetItemList(new InternalItemsQuery
|
||||
{
|
||||
IncludeItemTypes = [BaseItemKind.Channel],
|
||||
Name = "Floatplane"
|
||||
});
|
||||
foreach (var channel in channels)
|
||||
{
|
||||
foreach (var type in new[] { ImageType.Thumb, ImageType.Backdrop, ImageType.Logo })
|
||||
{
|
||||
while (channel.HasImage(type))
|
||||
{
|
||||
await channel.DeleteImageAsync(type, 0).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
using var stream = typeof(Plugin).Assembly.GetManifestResourceStream("Jellyfin.Plugin.Floatplane.Resources.logo.png");
|
||||
if (stream != null)
|
||||
{
|
||||
await _providerManager.SaveImage(channel, stream, "image/png", ImageType.Primary, null, ct).ConfigureAwait(false);
|
||||
await _libraryManager.UpdateItemAsync(channel, channel.GetParent(), ItemUpdateType.ImageUpdate, ct).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
_logger.LogInformation("Updated channel image for {Name} (logo v{Version})", channel.Name, ChannelImageVersion);
|
||||
}
|
||||
|
||||
cfg.ChannelImageVersion = ChannelImageVersion;
|
||||
Plugin.Instance!.SaveConfiguration();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Could not update the channel image");
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user