Add channel queries to series (#13356)

Currently, the IChannel interface can deliver channel result folders which are interpreted as series and seasons. However, Jellyfin does not query for the contents of these folders when viewing said serie of season. This results in empty series in the API.
This commit is contained in:
Kevin Jilissen 2025-03-28 01:06:10 +01:00 committed by GitHub
parent 07f07ba6bc
commit 9f70578997
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 52 additions and 2 deletions

View File

@ -23,6 +23,7 @@ using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
@ -1683,7 +1684,7 @@ namespace MediaBrowser.Controller.Entities
public virtual string GetClientTypeName()
{
if (IsFolder && SourceType == SourceType.Channel && this is not Channel)
if (IsFolder && SourceType == SourceType.Channel && this is not Channel && this is not Season && this is not Series)
{
return "ChannelFolderItem";
}

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading;
using Jellyfin.Data.Enums;
using Jellyfin.Database.Implementations.Entities;
using Jellyfin.Extensions;
@ -152,6 +153,21 @@ namespace MediaBrowser.Controller.Entities.TV
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
{
if (SourceType == SourceType.Channel)
{
try
{
query.Parent = this;
query.ChannelIds = new[] { ChannelId };
return ChannelManager.GetChannelItemsInternal(query, new Progress<double>(), CancellationToken.None).GetAwaiter().GetResult();
}
catch
{
// Already logged at lower levels
return new QueryResult<BaseItem>();
}
}
if (query.User is null)
{
return base.GetItemsInternal(query);

View File

@ -226,6 +226,21 @@ namespace MediaBrowser.Controller.Entities.TV
{
var user = query.User;
if (SourceType == SourceType.Channel)
{
try
{
query.Parent = this;
query.ChannelIds = [ChannelId];
return ChannelManager.GetChannelItemsInternal(query, new Progress<double>(), CancellationToken.None).GetAwaiter().GetResult();
}
catch
{
// Already logged at lower levels
return new QueryResult<BaseItem>();
}
}
if (query.Recursive)
{
var seriesKey = GetUniqueSeriesKey(this);
@ -372,7 +387,25 @@ namespace MediaBrowser.Controller.Entities.TV
query.IsMissing = false;
}
var allItems = LibraryManager.GetItemList(query);
IReadOnlyList<BaseItem> allItems;
if (SourceType == SourceType.Channel)
{
try
{
query.Parent = parentSeason;
query.ChannelIds = [ChannelId];
allItems = [.. ChannelManager.GetChannelItemsInternal(query, new Progress<double>(), CancellationToken.None).GetAwaiter().GetResult().Items];
}
catch
{
// Already logged at lower levels
return [];
}
}
else
{
allItems = LibraryManager.GetItemList(query);
}
return GetSeasonEpisodes(parentSeason, user, allItems, options, shouldIncludeMissingEpisodes);
}