Merge branch 'master' into network-rewrite

This commit is contained in:
Shadowghost
2023-02-15 22:40:07 +01:00
353 changed files with 25992 additions and 27536 deletions

View File

@@ -118,7 +118,7 @@ namespace MediaBrowser.Model.Dlna
var transcodeReasons = directPlayInfo.TranscodeReasons;
var inputAudioChannels = audioStream?.Channels;
var inputAudioBitrate = audioStream?.BitDepth;
var inputAudioBitrate = audioStream?.BitRate;
var inputAudioSampleRate = audioStream?.SampleRate;
var inputAudioBitDepth = audioStream?.BitDepth;
@@ -143,7 +143,7 @@ namespace MediaBrowser.Model.Dlna
{
if (tcProfile.Type == playlistItem.MediaType
&& tcProfile.Context == options.Context
&& _transcoderSupport.CanEncodeToAudioCodec(transcodingProfile.AudioCodec ?? tcProfile.Container))
&& _transcoderSupport.CanEncodeToAudioCodec(tcProfile.AudioCodec ?? tcProfile.Container))
{
transcodingProfile = tcProfile;
break;

View File

@@ -1,111 +0,0 @@
#nullable disable
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ImageOptions.
/// </summary>
public class ImageOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="ImageOptions" /> class.
/// </summary>
public ImageOptions()
{
EnableImageEnhancers = true;
}
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
public ImageType ImageType { get; set; }
/// <summary>
/// Gets or sets the index of the image.
/// </summary>
/// <value>The index of the image.</value>
public int? ImageIndex { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the width of the max.
/// </summary>
/// <value>The width of the max.</value>
public int? MaxWidth { get; set; }
/// <summary>
/// Gets or sets the height of the max.
/// </summary>
/// <value>The height of the max.</value>
public int? MaxHeight { get; set; }
/// <summary>
/// Gets or sets the quality.
/// </summary>
/// <value>The quality.</value>
public int? Quality { get; set; }
/// <summary>
/// Gets or sets the image tag.
/// If set this will result in strong, unconditional response caching.
/// </summary>
/// <value>The hash.</value>
public string Tag { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [crop whitespace].
/// </summary>
/// <value><c>null</c> if [crop whitespace] contains no value, <c>true</c> if [crop whitespace]; otherwise, <c>false</c>.</value>
public bool? CropWhitespace { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable image enhancers].
/// </summary>
/// <value><c>true</c> if [enable image enhancers]; otherwise, <c>false</c>.</value>
public bool EnableImageEnhancers { get; set; }
/// <summary>
/// Gets or sets the format.
/// </summary>
/// <value>The format.</value>
public ImageFormat? Format { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [add played indicator].
/// </summary>
/// <value><c>true</c> if [add played indicator]; otherwise, <c>false</c>.</value>
public bool AddPlayedIndicator { get; set; }
/// <summary>
/// Gets or sets the percent played.
/// </summary>
/// <value>The percent played.</value>
public int? PercentPlayed { get; set; }
/// <summary>
/// Gets or sets the un played count.
/// </summary>
/// <value>The un played count.</value>
public int? UnPlayedCount { get; set; }
/// <summary>
/// Gets or sets the color of the background.
/// </summary>
/// <value>The color of the background.</value>
public string BackgroundColor { get; set; }
}
}

View File

@@ -33,14 +33,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
<PackageReference Include="MimeTypes" Version="2.4.0">
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="MimeTypes">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Text.Json" Version="7.0.1" />
<PackageReference Include="System.Globalization" />
<PackageReference Include="System.Text.Json" />
</ItemGroup>
<ItemGroup>
@@ -49,13 +49,13 @@
<!-- Code Analyzers-->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.4">
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="SerilogAnalyzer" Version="0.15.0" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
<PackageReference Include="SerilogAnalyzer" PrivateAssets="All" />
<PackageReference Include="StyleCop.Analyzers" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="../Jellyfin.Data/Jellyfin.Data.csproj" />

View File

@@ -1,11 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Notifications
{
public enum NotificationLevel
{
Normal = 0,
Warning = 1,
Error = 2
}
}

View File

@@ -1,55 +0,0 @@
#pragma warning disable CA1819 // Properties should not return arrays
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Notifications
{
public class NotificationOption
{
public NotificationOption(string type)
{
Type = type;
DisabledServices = Array.Empty<string>();
DisabledMonitorUsers = Array.Empty<string>();
SendToUsers = Array.Empty<string>();
}
public NotificationOption()
{
DisabledServices = Array.Empty<string>();
DisabledMonitorUsers = Array.Empty<string>();
SendToUsers = Array.Empty<string>();
}
public string? Type { get; set; }
/// <summary>
/// Gets or sets user Ids to not monitor (it's opt out).
/// </summary>
public string[] DisabledMonitorUsers { get; set; }
/// <summary>
/// Gets or sets user Ids to send to (if SendToUserMode == Custom).
/// </summary>
public string[] SendToUsers { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="NotificationOption"/> is enabled.
/// </summary>
/// <value><c>true</c> if enabled; otherwise, <c>false</c>.</value>
public bool Enabled { get; set; }
/// <summary>
/// Gets or sets the disabled services.
/// </summary>
/// <value>The disabled services.</value>
public string[] DisabledServices { get; set; }
/// <summary>
/// Gets or sets the send to user mode.
/// </summary>
/// <value>The send to user mode.</value>
public SendToUserType SendToUserMode { get; set; }
}
}

View File

@@ -1,131 +0,0 @@
#nullable disable
#pragma warning disable CS1591
using System;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
namespace MediaBrowser.Model.Notifications
{
public class NotificationOptions
{
public NotificationOptions()
{
Options = new[]
{
new NotificationOption(NotificationType.TaskFailed.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.ServerRestartRequired.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.ApplicationUpdateAvailable.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.ApplicationUpdateInstalled.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.PluginUpdateInstalled.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.PluginUninstalled.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.InstallationFailed.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.PluginInstalled.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.PluginError.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
},
new NotificationOption(NotificationType.UserLockedOut.ToString())
{
Enabled = true,
SendToUserMode = SendToUserType.Admins
}
};
}
public NotificationOption[] Options { get; set; }
public NotificationOption GetOptions(string type)
{
foreach (NotificationOption i in Options)
{
if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase))
{
return i;
}
}
return null;
}
public bool IsEnabled(string type)
{
NotificationOption opt = GetOptions(type);
return opt is not null && opt.Enabled;
}
public bool IsServiceEnabled(string service, string notificationType)
{
NotificationOption opt = GetOptions(notificationType);
return opt is null
|| !opt.DisabledServices.Contains(service, StringComparison.OrdinalIgnoreCase);
}
public bool IsEnabledToMonitorUser(string type, Guid userId)
{
NotificationOption opt = GetOptions(type);
return opt is not null
&& opt.Enabled
&& !opt.DisabledMonitorUsers.Contains(userId.ToString("N"), StringComparison.OrdinalIgnoreCase);
}
public bool IsEnabledToSendToUser(string type, string userId, User user)
{
NotificationOption opt = GetOptions(type);
if (opt is not null && opt.Enabled)
{
if (opt.SendToUserMode == SendToUserType.All)
{
return true;
}
if (opt.SendToUserMode == SendToUserType.Admins && user.HasPermission(PermissionKind.IsAdministrator))
{
return true;
}
return opt.SendToUsers.Contains(userId, StringComparison.OrdinalIgnoreCase);
}
return false;
}
}
}

View File

@@ -1,35 +0,0 @@
#nullable disable
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Notifications
{
public class NotificationRequest
{
public NotificationRequest()
{
UserIds = Array.Empty<Guid>();
Date = DateTime.UtcNow;
}
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public NotificationLevel Level { get; set; }
public Guid[] UserIds { get; set; }
public DateTime Date { get; set; }
/// <summary>
/// Gets or sets the corresponding type name used in configuration. Not for display.
/// </summary>
public string NotificationType { get; set; }
public SendToUserType? SendToUserMode { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Notifications
{
public class NotificationTypeInfo
{
public string Type { get; set; }
public string Name { get; set; }
public bool Enabled { get; set; }
public string Category { get; set; }
public bool IsBasedOnUserEvent { get; set; }
}
}

View File

@@ -1,11 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Notifications
{
public enum SendToUserType
{
All = 0,
Admins = 1,
Custom = 2
}
}

View File

@@ -1,12 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.System
{
public enum OperatingSystemId
{
Windows,
Linux,
Darwin,
BSD
}
}

View File

@@ -1,6 +1,8 @@
#nullable disable
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.System
{
public class PublicSystemInfo
@@ -32,7 +34,8 @@ namespace MediaBrowser.Model.System
/// Gets or sets the operating system.
/// </summary>
/// <value>The operating system.</value>
public string OperatingSystem { get; set; }
[Obsolete("This is no longer set")]
public string OperatingSystem { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the id.

View File

@@ -42,7 +42,8 @@ namespace MediaBrowser.Model.System
/// Gets or sets the display name of the operating system.
/// </summary>
/// <value>The display name of the operating system.</value>
public string OperatingSystemDisplayName { get; set; }
[Obsolete("This is no longer set")]
public string OperatingSystemDisplayName { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the package name.
@@ -137,6 +138,7 @@ namespace MediaBrowser.Model.System
[Obsolete("This isn't set correctly anymore")]
public FFmpegLocation EncoderLocation { get; set; }
public Architecture SystemArchitecture { get; set; }
[Obsolete("This is no longer set")]
public Architecture SystemArchitecture { get; set; } = Architecture.X64;
}
}

View File

@@ -13,6 +13,7 @@ namespace MediaBrowser.Model.Users
public UserPolicy()
{
IsHidden = true;
EnableCollectionManagement = false;
EnableContentDeletion = false;
EnableContentDeletionFromFolders = Array.Empty<string>();
@@ -35,6 +36,7 @@ namespace MediaBrowser.Model.Users
EnableSharedDeviceControl = true;
BlockedTags = Array.Empty<string>();
AllowedTags = Array.Empty<string>();
BlockUnratedItems = Array.Empty<UnratedItem>();
EnableUserPreferenceAccess = true;
@@ -72,6 +74,12 @@ namespace MediaBrowser.Model.Users
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
public bool IsHidden { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can manage collections.
/// </summary>
/// <value><c>true</c> if this instance is hidden; otherwise, <c>false</c>.</value>
public bool EnableCollectionManagement { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is disabled.
/// </summary>
@@ -86,6 +94,8 @@ namespace MediaBrowser.Model.Users
public string[] BlockedTags { get; set; }
public string[] AllowedTags { get; set; }
public bool EnableUserPreferenceAccess { get; set; }
public AccessSchedule[] AccessSchedules { get; set; }