fix: address copilot review comments on playlist season PR

- Gate PlaylistIndex numbering on having a real playlist id so Unsorted
  videos get IndexNumber = null instead of 0, matching the enum docs
  and config UI text.
- Remove unused using Microsoft.Extensions.Logging from Video.cs.
- Stop catching OperationCanceledException in PlaylistCache.RefreshAsync
  and GetPlaylistSortDateAsync so cancellation propagates instead of
  silently falling back to upload year grouping.

Note: AI Generated Commit
This commit is contained in:
7hr08ik 2026-08-10 16:28:07 +01:00
parent 6d1dcf5c54
commit 114bf981a4
2 changed files with 3 additions and 4 deletions

View File

@ -199,7 +199,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
{
playlists = await taApi.GetPlaylists().ConfigureAwait(false);
}
catch (Exception ex) when (ex is HttpRequestException or OperationCanceledException or JsonException)
catch (Exception ex) when (ex is HttpRequestException or JsonException)
{
// Failure policy: keep whatever is cached and let callers fall back to upload year
// grouping. A partial migration is worse than no migration.
@ -443,7 +443,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
return video.Published;
}
}
catch (Exception ex) when (ex is HttpRequestException or OperationCanceledException or JsonException)
catch (Exception ex) when (ex is HttpRequestException or JsonException)
{
_logger.LogDebug(ex, "Could not resolve a sort date for playlist {PlaylistId}.", playlist.Id);
}

View File

@ -9,7 +9,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
@ -153,7 +152,7 @@ namespace Jellyfin.Plugin.TubeArchivistMetadata.TubeArchivist
IndexNumber = Plugin.Instance?.Configuration?.EpisodeNumberingScheme switch
{
NumberingScheme.YYYYMMDD => (Published.Year * 10000) + (Published.Month * 100) + Published.Day,
NumberingScheme.PlaylistIndex => playlistAssignment?.Index,
NumberingScheme.PlaylistIndex => !string.IsNullOrEmpty(playlistAssignment?.PlaylistId) ? playlistAssignment?.Index : null,
_ => null
},
SeriesName = Channel.Name,