mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-04 14:14:29 -04:00
Improve video resolution filtering and classification logic (#13332)
This commit is contained in:
parent
e84826297d
commit
1c190f7952
@ -1309,34 +1309,39 @@ public sealed class BaseItemRepository
|
|||||||
JellyfinDbContext context,
|
JellyfinDbContext context,
|
||||||
InternalItemsQuery filter)
|
InternalItemsQuery filter)
|
||||||
{
|
{
|
||||||
|
const int HDWidth = 1200;
|
||||||
|
const int UHDWidth = 3800;
|
||||||
|
const int UHDHeight = 2100;
|
||||||
|
|
||||||
var minWidth = filter.MinWidth;
|
var minWidth = filter.MinWidth;
|
||||||
var maxWidth = filter.MaxWidth;
|
var maxWidth = filter.MaxWidth;
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
|
|
||||||
if (filter.IsHD.HasValue)
|
if (filter.IsHD.HasValue || filter.Is4K.HasValue)
|
||||||
{
|
{
|
||||||
const int Threshold = 1200;
|
bool includeSD = false;
|
||||||
if (filter.IsHD.Value)
|
bool includeHD = false;
|
||||||
{
|
bool include4K = false;
|
||||||
minWidth = Threshold;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
maxWidth = Threshold - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filter.Is4K.HasValue)
|
if (filter.IsHD.HasValue && !filter.IsHD.Value)
|
||||||
{
|
|
||||||
const int Threshold = 3800;
|
|
||||||
if (filter.Is4K.Value)
|
|
||||||
{
|
{
|
||||||
minWidth = Threshold;
|
includeSD = true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (filter.IsHD.HasValue && filter.IsHD.Value)
|
||||||
{
|
{
|
||||||
maxWidth = Threshold - 1;
|
includeHD = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter.Is4K.HasValue && filter.Is4K.Value)
|
||||||
|
{
|
||||||
|
include4K = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
baseQuery = baseQuery.Where(e =>
|
||||||
|
(includeSD && e.Width < HDWidth) ||
|
||||||
|
(includeHD && e.Width >= HDWidth && !(e.Width >= UHDWidth || e.Height >= UHDHeight)) ||
|
||||||
|
(include4K && (e.Width >= UHDWidth || e.Height >= UHDHeight)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minWidth.HasValue)
|
if (minWidth.HasValue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user