Merge branch 'master' into network-rewrite

This commit is contained in:
Shadowghost
2023-03-03 10:42:24 +01:00
102 changed files with 1210 additions and 680 deletions

View File

@@ -554,7 +554,7 @@ namespace MediaBrowser.Controller.Entities
public string OfficialRating { get; set; }
[JsonIgnore]
public int InheritedParentalRatingValue { get; set; }
public int? InheritedParentalRatingValue { get; set; }
/// <summary>
/// Gets or sets the critic rating.
@@ -1534,12 +1534,6 @@ namespace MediaBrowser.Controller.Entities
}
var maxAllowedRating = user.MaxParentalAgeRating;
if (maxAllowedRating is null)
{
return true;
}
var rating = CustomRatingForComparison;
if (string.IsNullOrEmpty(rating))
@@ -1549,12 +1543,13 @@ namespace MediaBrowser.Controller.Entities
if (string.IsNullOrEmpty(rating))
{
Logger.LogDebug("{0} has no parental rating set.", Name);
return !GetBlockUnratedValue(user);
}
var value = LocalizationManager.GetRatingLevel(rating);
// Could not determine the integer value
// Could not determine rating level
if (!value.HasValue)
{
var isAllowed = !GetBlockUnratedValue(user);
@@ -1567,7 +1562,7 @@ namespace MediaBrowser.Controller.Entities
return isAllowed;
}
return value.Value <= maxAllowedRating.Value;
return !maxAllowedRating.HasValue || value.Value <= maxAllowedRating.Value;
}
public int? GetInheritedParentalRatingValue()
@@ -1627,10 +1622,10 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
/// Gets the block unrated value.
/// Gets a bool indicating if access to the unrated item is blocked or not.
/// </summary>
/// <param name="user">The configuration.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
/// <returns><c>true</c> if blocked, <c>false</c> otherwise.</returns>
protected virtual bool GetBlockUnratedValue(User user)
{
// Don't block plain folders that are unrated. Let the media underneath get blocked
@@ -2517,7 +2512,7 @@ namespace MediaBrowser.Controller.Entities
var item = this;
var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? 0;
var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? null;
if (inheritedParentalRatingValue != item.InheritedParentalRatingValue)
{
item.InheritedParentalRatingValue = inheritedParentalRatingValue;

View File

@@ -308,6 +308,11 @@ namespace MediaBrowser.Controller.Entities.TV
id.SeriesDisplayOrder = series.DisplayOrder;
}
if (Season is not null)
{
id.SeasonProviderIds = Season.ProviderIds;
}
id.IsMissingEpisode = IsMissingEpisode;
id.IndexNumberEnd = IndexNumberEnd;

View File

@@ -71,6 +71,21 @@ namespace MediaBrowser.Controller.MediaEncoding
"m4v",
};
// Set max transcoding channels for encoders that can't handle more than a set amount of channels
// AAC, FLAC, ALAC, libopus, libvorbis encoders all support at least 8 channels
private static readonly Dictionary<string, int> _audioTranscodeChannelLookup = new(StringComparer.OrdinalIgnoreCase)
{
{ "wmav2", 2 },
{ "libmp3lame", 2 },
{ "libfdk_aac", 6 },
{ "aac_at", 6 },
{ "ac3", 6 },
{ "eac3", 6 },
{ "dca", 6 },
{ "mlp", 6 },
{ "truehd", 6 },
};
public EncodingHelper(
IApplicationPaths appPaths,
IMediaEncoder mediaEncoder,
@@ -2231,25 +2246,14 @@ namespace MediaBrowser.Controller.MediaEncoding
if (isTranscodingAudio)
{
// Set max transcoding channels for encoders that can't handle more than a set amount of channels
// AAC, FLAC, ALAC, libopus, libvorbis encoders all support at least 8 channels
int transcoderChannelLimit = GetAudioEncoder(state) switch
var audioEncoder = GetAudioEncoder(state);
if (!_audioTranscodeChannelLookup.TryGetValue(audioEncoder, out var transcoderChannelLimit))
{
string audioEncoder when audioEncoder.Equals("wmav2", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("libmp3lame", StringComparison.OrdinalIgnoreCase) => 2,
string audioEncoder when audioEncoder.Equals("libfdk_aac", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("aac_at", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("ac3", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("eac3", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("dts", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("mlp", StringComparison.OrdinalIgnoreCase)
|| audioEncoder.Equals("truehd", StringComparison.OrdinalIgnoreCase) => 6,
// Set default max transcoding channels to 8 to prevent encoding errors due to asking for too many channels
_ => 8,
};
// Set default max transcoding channels to 8 to prevent encoding errors due to asking for too many channels.
transcoderChannelLimit = 8;
}
// Set resultChannels to minimum between resultChannels, TranscodingMaxAudioChannels, transcoderChannelLimit
resultChannels = transcoderChannelLimit < resultChannels ? transcoderChannelLimit : resultChannels ?? transcoderChannelLimit;
if (request.TranscodingMaxAudioChannels < resultChannels)
@@ -4228,12 +4232,12 @@ namespace MediaBrowser.Controller.MediaEncoding
subFilters.Add(subTextSubtitlesFilter);
}
subFilters.Add("hwupload=derive_device=vulkan:extra_hw_frames=16");
// prefer vaapi hwupload to vulkan hwupload,
// Mesa RADV does not support a dedicated transfer queue.
subFilters.Add("hwupload=derive_device=vaapi,format=vaapi,hwmap=derive_device=vulkan");
overlayFilters.Add("overlay_vulkan=eof_action=endall:shortest=1:repeatlast=0");
// explicitly sync using libplacebo.
overlayFilters.Add("libplacebo=format=nv12:upscaler=none:downscaler=none");
overlayFilters.Add("scale_vulkan=format=nv12");
// OUTPUT vaapi(nv12/bgra) surface(vram)
// reverse-mapping via vaapi-vulkan interop.

View File

@@ -232,6 +232,11 @@ namespace MediaBrowser.Controller.Net
// TODO Investigate and properly fix.
Logger.LogError(ex, "Object Disposed");
}
catch (Exception ex)
{
// TODO Investigate and properly fix.
Logger.LogError(ex, "Error disposing websocket");
}
lock (_activeConnections)
{

View File

@@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Persistence
/// </summary>
/// <param name="items">The items.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void SaveItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken);
void SaveItems(IReadOnlyList<BaseItem> items, CancellationToken cancellationToken);
void SaveImages(BaseItem item);

View File

@@ -12,10 +12,13 @@ namespace MediaBrowser.Controller.Providers
public EpisodeInfo()
{
SeriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
SeasonProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
}
public Dictionary<string, string> SeriesProviderIds { get; set; }
public Dictionary<string, string> SeasonProviderIds { get; set; }
public int? IndexNumberEnd { get; set; }
public bool IsMissingEpisode { get; set; }

View File

@@ -26,6 +26,7 @@ namespace MediaBrowser.Controller.Providers
ReplaceAllMetadata = copy.ReplaceAllMetadata;
EnableRemoteContentProbe = copy.EnableRemoteContentProbe;
IsAutomated = copy.IsAutomated;
ImageRefreshMode = copy.ImageRefreshMode;
ReplaceAllImages = copy.ReplaceAllImages;
ReplaceImages = copy.ReplaceImages;

View File

@@ -1,5 +1,3 @@
#nullable disable
#pragma warning disable CS1591
using System;