Check both tags for the episode itself and its parents.

Signed-off-by: gnattu <gnattuoc@me.com>
pull/11416/head
gnattu 1 month ago
parent fdde4b4a94
commit 477e3a2ec1

@ -4194,7 +4194,20 @@ namespace Emby.Server.Implementations.Data
{
int index = 0;
string includedTags = string.Join(',', query.IncludeInheritedTags.Select(_ => paramName + index++));
whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)");
// Episodes do store inherit tags from their parents in the database, and the tag may be still required by the client.
// In addtion to the tags for the episodes themselves, we need to manually query its parent (the season)'s tags as well.
if (includeTypes.Length == 1 && includeTypes.FirstOrDefault() is BaseItemKind.Episode)
{
whereClauses.Add("(" +
"(select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null" +
" OR " +
"(select CleanValue from ItemValues where ItemId=ParentId and Type=6 and cleanvalue in (" + includedTags + ")) is not null" +
")");
}
else
{
whereClauses.Add("((select CleanValue from ItemValues where ItemId=Guid and Type=6 and cleanvalue in (" + includedTags + ")) is not null)");
}
}
else
{

Loading…
Cancel
Save