pull/13332/merge
theguymadmax 3 weeks ago committed by GitHub
commit 3a261cb93d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -82,6 +82,7 @@ public class ItemsController : BaseJellyfinApiController
/// <param name="parentIndexNumber">Optional filter by parent index number.</param>
/// <param name="hasParentalRating">Optional filter by items that have or do not have a parental rating.</param>
/// <param name="isHd">Optional filter by items that are HD or not.</param>
/// <param name="isSd">Optional filter by items that are SD or not.</param>
/// <param name="is4K">Optional filter by items that are 4K or not.</param>
/// <param name="locationTypes">Optional. If specified, results will be filtered based on LocationType. This allows multiple, comma delimited.</param>
/// <param name="excludeLocationTypes">Optional. If specified, results will be filtered based on the LocationType. This allows multiple, comma delimited.</param>
@ -172,6 +173,7 @@ public class ItemsController : BaseJellyfinApiController
[FromQuery] int? parentIndexNumber,
[FromQuery] bool? hasParentalRating,
[FromQuery] bool? isHd,
[FromQuery] bool? isSd,
[FromQuery] bool? is4K,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] locationTypes,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] excludeLocationTypes,
@ -350,6 +352,7 @@ public class ItemsController : BaseJellyfinApiController
HasThemeVideo = hasThemeVideo,
HasTrailer = hasTrailer,
IsHD = isHd,
IsSD = isSd,
Is4K = is4K,
Tags = tags,
OfficialRatings = officialRatings,
@ -548,6 +551,7 @@ public class ItemsController : BaseJellyfinApiController
/// <param name="parentIndexNumber">Optional filter by parent index number.</param>
/// <param name="hasParentalRating">Optional filter by items that have or do not have a parental rating.</param>
/// <param name="isHd">Optional filter by items that are HD or not.</param>
/// <param name="isSd">Optional filter by items that are SD or not.</param>
/// <param name="is4K">Optional filter by items that are 4K or not.</param>
/// <param name="locationTypes">Optional. If specified, results will be filtered based on LocationType. This allows multiple, comma delimited.</param>
/// <param name="excludeLocationTypes">Optional. If specified, results will be filtered based on the LocationType. This allows multiple, comma delimited.</param>
@ -639,6 +643,7 @@ public class ItemsController : BaseJellyfinApiController
[FromQuery] int? parentIndexNumber,
[FromQuery] bool? hasParentalRating,
[FromQuery] bool? isHd,
[FromQuery] bool? isSd,
[FromQuery] bool? is4K,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] locationTypes,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] excludeLocationTypes,
@ -726,6 +731,7 @@ public class ItemsController : BaseJellyfinApiController
parentIndexNumber,
hasParentalRating,
isHd,
isSd,
is4K,
locationTypes,
excludeLocationTypes,

@ -42,6 +42,7 @@ public class TrailersController : BaseJellyfinApiController
/// <param name="parentIndexNumber">Optional filter by parent index number.</param>
/// <param name="hasParentalRating">Optional filter by items that have or do not have a parental rating.</param>
/// <param name="isHd">Optional filter by items that are HD or not.</param>
/// <param name="isSd">Optional filter by items that are SD or not.</param>
/// <param name="is4K">Optional filter by items that are 4K or not.</param>
/// <param name="locationTypes">Optional. If specified, results will be filtered based on LocationType. This allows multiple, comma delimited.</param>
/// <param name="excludeLocationTypes">Optional. If specified, results will be filtered based on the LocationType. This allows multiple, comma delimited.</param>
@ -130,6 +131,7 @@ public class TrailersController : BaseJellyfinApiController
[FromQuery] int? parentIndexNumber,
[FromQuery] bool? hasParentalRating,
[FromQuery] bool? isHd,
[FromQuery] bool? isSd,
[FromQuery] bool? is4K,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] locationTypes,
[FromQuery, ModelBinder(typeof(CommaDelimitedCollectionModelBinder))] LocationType[] excludeLocationTypes,
@ -220,6 +222,7 @@ public class TrailersController : BaseJellyfinApiController
parentIndexNumber,
hasParentalRating,
isHd,
isSd,
is4K,
locationTypes,
excludeLocationTypes,

@ -1307,33 +1307,47 @@ public sealed class BaseItemRepository
JellyfinDbContext context,
InternalItemsQuery filter)
{
const int HDWidth = 1200;
const int UHDWidth = 3800;
const int UHDHeight = 2100;
var minWidth = filter.MinWidth;
var maxWidth = filter.MaxWidth;
var now = DateTime.UtcNow;
if (filter.IsHD.HasValue)
{
const int Threshold = 1200;
if (filter.IsHD.Value)
{
minWidth = Threshold;
baseQuery = baseQuery.Where(e => e.Width >= HDWidth && !(e.Width >= UHDWidth || e.Height >= UHDHeight));
}
else
{
maxWidth = Threshold - 1;
baseQuery = baseQuery.Where(e => e.Width <= (HDWidth - 1));
}
}
if (filter.Is4K.HasValue)
{
const int Threshold = 3800;
if (filter.Is4K.Value)
{
minWidth = Threshold;
baseQuery = baseQuery.Where(e => e.Width >= UHDWidth || e.Height >= UHDHeight);
}
else
{
baseQuery = baseQuery.Where(e => e.Width < UHDWidth && e.Height < UHDHeight);
}
}
if (filter.IsSD.HasValue)
{
if (filter.IsSD.Value)
{
baseQuery = baseQuery.Where(e => e.Width <= (HDWidth - 1));
}
else
{
maxWidth = Threshold - 1;
baseQuery = baseQuery.Where(e => e.Width >= HDWidth);
}
}

@ -1212,6 +1212,11 @@ namespace MediaBrowser.Controller.Entities
return false;
}
if (request.IsSD.HasValue)
{
return false;
}
if (request.IsLocked.HasValue)
{
return false;

@ -140,6 +140,8 @@ namespace MediaBrowser.Controller.Entities
public bool? IsHD { get; set; }
public bool? IsSD { get; set; }
public bool? IsLocked { get; set; }
public bool? IsPlaceHolder { get; set; }

Loading…
Cancel
Save