Skip to content

Commit

Permalink
fix: make sure specials are last (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Apr 7, 2024
1 parent 0cb2bbe commit a43f176
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion Shokofin/Providers/SeasonProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,25 @@ public async Task<MetadataResult<Season>> GetMetadata(SeasonInfo info, Cancellat
{
try {
var result = new MetadataResult<Season>();
if (!info.IndexNumber.HasValue || info.IndexNumber.HasValue && info.IndexNumber.Value == 0)
if (!info.IndexNumber.HasValue)
return result;

// Special handling of the "Specials" season (pun intended).
if (info.IndexNumber.Value == 0) {
// We're forcing the sort names to start with "ZZ" to make it
// always appear last in the UI.
var seasonName = info.Name;
result.Item = new Season {
Name = seasonName,
IndexNumber = info.IndexNumber,
SortName = $"ZZ - {seasonName}",
ForcedSortName = $"ZZ - {seasonName}",
};
result.HasMetadata = true;

return result;
}

if (!info.SeriesProviderIds.TryGetValue(ShokoSeriesId.Name, out var seriesId) || !info.IndexNumber.HasValue) {
Logger.LogDebug("Unable refresh Season {SeasonNumber} {SeasonName}", info.IndexNumber, info.Name);
return result;
Expand Down

0 comments on commit a43f176

Please sign in to comment.