Browse Source

ignore unreliable anamorphic flag from jellyfin (#2306)

pull/2307/head
Jason Dove 5 days ago committed by GitHub
parent
commit
5e463758da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

17
ErsatzTV.Infrastructure/Jellyfin/JellyfinApiClient.cs

@ -857,21 +857,20 @@ public class JellyfinApiClient : IJellyfinApiClient
int height = videoStream.Height ?? 1; int height = videoStream.Height ?? 1;
var isAnamorphic = false; var isAnamorphic = false;
if (videoStream.IsAnamorphic.HasValue) if (!string.IsNullOrWhiteSpace(videoStream.AspectRatio) && videoStream.AspectRatio.Contains(':'))
{
isAnamorphic = videoStream.IsAnamorphic.Value;
}
else if (!string.IsNullOrWhiteSpace(videoStream.AspectRatio) && videoStream.AspectRatio.Contains(':'))
{ {
// if width/height != aspect ratio, is anamorphic // if width/height != aspect ratio, is anamorphic
double resolutionRatio = width / (double)height; double resolutionRatio = width / (double)height;
string[] split = videoStream.AspectRatio.Split(":"); string[] split = videoStream.AspectRatio.Split(":");
var num = double.Parse(split[0], CultureInfo.InvariantCulture); if (double.TryParse(split[0], NumberStyles.Any, CultureInfo.InvariantCulture, out var num) &&
var den = double.Parse(split[1], CultureInfo.InvariantCulture); double.TryParse(split[1], NumberStyles.Any, CultureInfo.InvariantCulture, out var den) &&
double aspectRatio = num / den; den != 0)
{
double displayRatio = num / den;
isAnamorphic = Math.Abs(resolutionRatio - aspectRatio) > 0.01d; isAnamorphic = Math.Abs(resolutionRatio - displayRatio) > 0.01d;
}
} }
var version = new MediaVersion var version = new MediaVersion

Loading…
Cancel
Save