Merge branch 'master' into externalid-type

This commit is contained in:
Mark Monteiro
2020-05-17 13:50:44 -04:00
677 changed files with 16588 additions and 10190 deletions

View File

@@ -59,6 +59,7 @@ namespace MediaBrowser.Model.Activity
/// Gets or sets the user primary image tag.
/// </summary>
/// <value>The user primary image tag.</value>
[Obsolete("UserPrimaryImageTag is not used.")]
public string UserPrimaryImageTag { get; set; }
/// <summary>

View File

@@ -1,6 +1,9 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Model.Events;
using MediaBrowser.Model.Querying;
@@ -10,10 +13,15 @@ namespace MediaBrowser.Model.Activity
{
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
void Create(ActivityLogEntry entry);
void Create(ActivityLog entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, int? startIndex, int? limit);
Task CreateAsync(ActivityLog entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? hasUserId, int? x, int? y);
QueryResult<ActivityLogEntry> GetPagedResult(int? startIndex, int? limit);
QueryResult<ActivityLogEntry> GetPagedResult(
Func<IQueryable<ActivityLog>, IQueryable<ActivityLog>> func,
int? startIndex,
int? limit);
}
}

View File

@@ -1,14 +0,0 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity
{
public interface IActivityRepository
{
void Create(ActivityLogEntry entry);
QueryResult<ActivityLogEntry> GetActivityLogEntries(DateTime? minDate, bool? z, int? startIndex, int? limit);
}
}

View File

@@ -40,6 +40,7 @@ namespace MediaBrowser.Model.Configuration
VaapiDevice = "/dev/dri/renderD128";
H264Crf = 23;
H265Crf = 28;
DeinterlaceMethod = "yadif";
EnableHardwareEncoding = true;
EnableSubtitleExtraction = true;
HardwareDecodingCodecs = new string[] { "h264", "vc1" };

View File

@@ -15,11 +15,15 @@ namespace MediaBrowser.Model.Configuration
private string _baseUrl;
/// <summary>
/// Gets or sets a value indicating whether [enable u pn p].
/// Gets or sets a value indicating whether to enable automatic port forwarding.
/// </summary>
/// <value><c>true</c> if [enable u pn p]; otherwise, <c>false</c>.</value>
public bool EnableUPnP { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to enable prometheus metrics exporting.
/// </summary>
public bool EnableMetrics { get; set; }
/// <summary>
/// Gets or sets the public mapped port.
/// </summary>
@@ -45,17 +49,24 @@ namespace MediaBrowser.Model.Configuration
public int HttpsPortNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [use HTTPS].
/// Gets or sets a value indicating whether to use HTTPS.
/// </summary>
/// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value>
/// <remarks>
/// In order for HTTPS to be used, in addition to setting this to true, valid values must also be
/// provided for <see cref="CertificatePath"/> and <see cref="CertificatePassword"/>.
/// </remarks>
public bool EnableHttps { get; set; }
public bool EnableNormalizedItemByNameIds { get; set; }
/// <summary>
/// Gets or sets the value pointing to the file system where the ssl certificate is located..
/// Gets or sets the filesystem path of an X.509 certificate to use for SSL.
/// </summary>
/// <value>The value pointing to the file system where the ssl certificate is located..</value>
public string CertificatePath { get; set; }
/// <summary>
/// Gets or sets the password required to access the X.509 certificate data in the file specified by <see cref="CertificatePath"/>.
/// </summary>
public string CertificatePassword { get; set; }
/// <summary>
@@ -65,8 +76,9 @@ namespace MediaBrowser.Model.Configuration
public bool IsPortAuthorized { get; set; }
public bool AutoRunWebApp { get; set; }
public bool EnableRemoteAccess { get; set; }
public bool CameraUploadUpgraded { get; set; }
public bool CollectionsUpgraded { get; set; }
/// <summary>
@@ -82,6 +94,7 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value>The metadata path.</value>
public string MetadataPath { get; set; }
public string MetadataNetworkPath { get; set; }
/// <summary>
@@ -148,9 +161,9 @@ namespace MediaBrowser.Model.Configuration
public bool EnableDashboardResponseCaching { get; set; }
/// <summary>
/// Allows the dashboard to be served from a custom path.
/// Gets or sets a custom path to serve the dashboard from.
/// </summary>
/// <value>The dashboard source path.</value>
/// <value>The dashboard source path, or null if the default path should be used.</value>
public string DashboardSourcePath { get; set; }
/// <summary>
@@ -204,15 +217,26 @@ namespace MediaBrowser.Model.Configuration
public int RemoteClientBitrateLimit { get; set; }
public bool EnableFolderView { get; set; }
public bool EnableGroupingIntoCollections { get; set; }
public bool DisplaySpecialsWithinSeasons { get; set; }
public string[] LocalNetworkSubnets { get; set; }
public string[] LocalNetworkAddresses { get; set; }
public string[] CodecsUsed { get; set; }
public bool IgnoreVirtualInterfaces { get; set; }
public bool EnableExternalContentInSuggestions { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the server should force connections over HTTPS.
/// </summary>
public bool RequireHttps { get; set; }
public bool IsBehindProxy { get; set; }
public bool EnableNewOmdbSupport { get; set; }
public string[] RemoteIPFilter { get; set; }
@@ -247,6 +271,7 @@ namespace MediaBrowser.Model.Configuration
PublicHttpsPort = DefaultHttpsPort;
HttpServerPortNumber = DefaultHttpPort;
HttpsPortNumber = DefaultHttpsPort;
EnableMetrics = false;
EnableHttps = false;
EnableDashboardResponseCaching = true;
EnableCaseSensitiveItemIds = true;
@@ -254,7 +279,7 @@ namespace MediaBrowser.Model.Configuration
AutoRunWebApp = true;
EnableRemoteAccess = true;
EnableUPnP = true;
EnableUPnP = false;
MinResumePct = 5;
MaxResumePct = 90;

View File

@@ -0,0 +1,9 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Devices
{
public class DeviceOptions
{
public string CustomName { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Devices
{
public class DevicesOptions
{
public string[] EnabledCameraUploadDevices { get; set; }
public string CameraUploadPath { get; set; }
public bool EnableCameraUploadSubfolders { get; set; }
public DevicesOptions()
{
EnabledCameraUploadDevices = Array.Empty<string>();
}
}
public class DeviceOptions
{
public string CustomName { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
#pragma warning disable CS1591
using System;
using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Model.Diagnostics
{
public interface IProcess : IDisposable
{
event EventHandler Exited;
void Kill();
bool WaitForExit(int timeMs);
Task<bool> WaitForExitAsync(int timeMs);
int ExitCode { get; }
void Start();
StreamWriter StandardInput { get; }
StreamReader StandardError { get; }
StreamReader StandardOutput { get; }
ProcessOptions StartInfo { get; }
}
}

View File

@@ -1,24 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Diagnostics
{
public interface IProcessFactory
{
IProcess Create(ProcessOptions options);
}
public class ProcessOptions
{
public string FileName { get; set; }
public string Arguments { get; set; }
public string WorkingDirectory { get; set; }
public bool CreateNoWindow { get; set; }
public bool UseShellExecute { get; set; }
public bool EnableRaisingEvents { get; set; }
public bool ErrorDialog { get; set; }
public bool RedirectStandardError { get; set; }
public bool RedirectStandardInput { get; set; }
public bool RedirectStandardOutput { get; set; }
public bool IsHidden { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{
@@ -57,7 +57,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var val in codec)
{
if (ListHelper.ContainsIgnoreCase(codecs, val))
if (codecs.Contains(val, StringComparer.OrdinalIgnoreCase))
{
return true;
}

View File

@@ -1,8 +1,8 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Globalization;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
@@ -167,9 +167,7 @@ namespace MediaBrowser.Model.Dlna
switch (condition.Condition)
{
case ProfileConditionType.EqualsAny:
{
return ListHelper.ContainsIgnoreCase(expected.Split('|'), currentValue);
}
return expected.Split('|').Contains(currentValue, StringComparer.OrdinalIgnoreCase);
case ProfileConditionType.Equals:
return string.Equals(currentValue, expected, StringComparison.OrdinalIgnoreCase);
case ProfileConditionType.NotEquals:

View File

@@ -1,8 +1,8 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{
@@ -45,7 +45,7 @@ namespace MediaBrowser.Model.Dlna
public static bool ContainsContainer(string profileContainers, string inputContainer)
{
var isNegativeList = false;
if (profileContainers != null && profileContainers.StartsWith("-"))
if (profileContainers != null && profileContainers.StartsWith("-", StringComparison.Ordinal))
{
isNegativeList = true;
profileContainers = profileContainers.Substring(1);
@@ -72,7 +72,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var container in allInputContainers)
{
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
if (profileContainers.Contains(container, StringComparer.OrdinalIgnoreCase))
{
return false;
}
@@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Dlna
foreach (var container in allInputContainers)
{
if (ListHelper.ContainsIgnoreCase(profileContainers, container))
if (profileContainers.Contains(container, StringComparer.OrdinalIgnoreCase))
{
return true;
}

View File

@@ -1,8 +1,8 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
@@ -93,14 +93,14 @@ namespace MediaBrowser.Model.Dlna
public DeviceProfile()
{
DirectPlayProfiles = new DirectPlayProfile[] { };
TranscodingProfiles = new TranscodingProfile[] { };
ResponseProfiles = new ResponseProfile[] { };
CodecProfiles = new CodecProfile[] { };
ContainerProfiles = new ContainerProfile[] { };
DirectPlayProfiles = Array.Empty<DirectPlayProfile>();
TranscodingProfiles = Array.Empty<TranscodingProfile>();
ResponseProfiles = Array.Empty<ResponseProfile>();
CodecProfiles = Array.Empty<CodecProfile>();
ContainerProfiles = Array.Empty<ContainerProfile>();
SubtitleProfiles = Array.Empty<SubtitleProfile>();
XmlRootAttributes = new XmlAttribute[] { };
XmlRootAttributes = Array.Empty<XmlAttribute>();
SupportedMediaTypes = "Audio,Photo,Video";
MaxStreamingBitrate = 8000000;
@@ -129,13 +129,14 @@ namespace MediaBrowser.Model.Dlna
continue;
}
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
return i;
}
return null;
}
@@ -155,7 +156,7 @@ namespace MediaBrowser.Model.Dlna
continue;
}
if (!ListHelper.ContainsIgnoreCase(i.GetAudioCodecs(), audioCodec ?? string.Empty))
if (!i.GetAudioCodecs().Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
@@ -185,7 +186,7 @@ namespace MediaBrowser.Model.Dlna
}
var audioCodecs = i.GetAudioCodecs();
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
if (audioCodecs.Length > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
@@ -288,13 +289,13 @@ namespace MediaBrowser.Model.Dlna
}
var audioCodecs = i.GetAudioCodecs();
if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))
if (audioCodecs.Length > 0 && !audioCodecs.Contains(audioCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}
var videoCodecs = i.GetVideoCodecs();
if (videoCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))
if (videoCodecs.Length > 0 && !videoCodecs.Contains(videoCodec ?? string.Empty, StringComparer.OrdinalIgnoreCase))
{
continue;
}

View File

@@ -25,12 +25,12 @@ namespace MediaBrowser.Model.Dlna
public bool SupportsVideoCodec(string codec)
{
return ContainerProfile.ContainsContainer(VideoCodec, codec);
return Type == DlnaProfileType.Video && ContainerProfile.ContainsContainer(VideoCodec, codec);
}
public bool SupportsAudioCodec(string codec)
{
return ContainerProfile.ContainsContainer(AudioCodec, codec);
return (Type == DlnaProfileType.Audio || Type == DlnaProfileType.Video) && ContainerProfile.ContainsContainer(AudioCodec, codec);
}
}
}

View File

@@ -1,7 +1,6 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{

View File

@@ -2,7 +2,6 @@
using System;
using System.Text.RegularExpressions;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{

View File

@@ -1,7 +1,8 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna
{
@@ -40,7 +41,7 @@ namespace MediaBrowser.Model.Dlna
}
var languages = GetLanguages();
return languages.Length == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);
return languages.Length == 0 || languages.Contains(subLanguage, StringComparer.OrdinalIgnoreCase);
}
}
}

View File

@@ -0,0 +1,48 @@
using System;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class PublicUserDto. Its goal is to show only public information about a user
/// </summary>
public class PublicUserDto : IItemDto
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has password.
/// </summary>
/// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
public bool HasPassword { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has configured password.
/// Note that in this case this method should not be here, but it is necessary when changing password at the
/// first login.
/// </summary>
/// <value><c>true</c> if this instance has configured password; otherwise, <c>false</c>.</value>
public bool HasConfiguredPassword { get; set; }
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
public double? PrimaryImageAspectRatio { get; set; }
/// <inheritdoc />
public override string ToString()
{
return Name ?? base.ToString();
}
}
}

View File

@@ -26,6 +26,7 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The image path.</value>
public string ImagePath { get; set; }
public DateTime ImageDateModified { get; set; }
public string ImageTag { get; set; }

View File

@@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value><c>true</c> if [show sidebar]; otherwise, <c>false</c>.</value>
public bool ShowSidebar { get; set; }
/// <summary>
/// Gets or sets the client
/// </summary>

View File

@@ -4,6 +4,7 @@ namespace MediaBrowser.Model.Entities
{
public enum ExtraType
{
Unknown = 0,
Clip = 1,
Trailer = 2,
BehindTheScenes = 3,

View File

@@ -34,8 +34,22 @@ namespace MediaBrowser.Model.Entities
/// <value>The language.</value>
public string Language { get; set; }
/// <summary>
/// Gets or sets the color transfer.
/// </summary>
/// <value>The color transfer.</value>
public string ColorTransfer { get; set; }
/// <summary>
/// Gets or sets the color primaries.
/// </summary>
/// <value>The color primaries.</value>
public string ColorPrimaries { get; set; }
/// <summary>
/// Gets or sets the color space.
/// </summary>
/// <value>The color space.</value>
public string ColorSpace { get; set; }
/// <summary>
@@ -44,11 +58,28 @@ namespace MediaBrowser.Model.Entities
/// <value>The comment.</value>
public string Comment { get; set; }
/// <summary>
/// Gets or sets the time base.
/// </summary>
/// <value>The time base.</value>
public string TimeBase { get; set; }
/// <summary>
/// Gets or sets the codec time base.
/// </summary>
/// <value>The codec time base.</value>
public string CodecTimeBase { get; set; }
/// <summary>
/// Gets or sets the title.
/// </summary>
/// <value>The title.</value>
public string Title { get; set; }
/// <summary>
/// Gets or sets the video range.
/// </summary>
/// <value>The video range.</value>
public string VideoRange
{
get
@@ -60,7 +91,8 @@ namespace MediaBrowser.Model.Entities
var colorTransfer = ColorTransfer;
if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase))
if (string.Equals(colorTransfer, "smpte2084", StringComparison.OrdinalIgnoreCase)
|| string.Equals(colorTransfer, "arib-std-b67", StringComparison.OrdinalIgnoreCase))
{
return "HDR";
}
@@ -69,9 +101,11 @@ namespace MediaBrowser.Model.Entities
}
}
public string localizedUndefined { get; set; }
public string localizedDefault { get; set; }
public string localizedForced { get; set; }
public string localizedUndefined { get; set; }
public string localizedDefault { get; set; }
public string localizedForced { get; set; }
public string DisplayTitle
{
@@ -197,34 +231,34 @@ namespace MediaBrowser.Model.Entities
{
if (i.IsInterlaced)
{
return "1440I";
return "1440i";
}
return "1440P";
return "1440p";
}
if (width >= 1900 || height >= 1000)
{
if (i.IsInterlaced)
{
return "1080I";
return "1080i";
}
return "1080P";
return "1080p";
}
if (width >= 1260 || height >= 700)
{
if (i.IsInterlaced)
{
return "720I";
return "720i";
}
return "720P";
return "720p";
}
if (width >= 700 || height >= 440)
{
if (i.IsInterlaced)
{
return "480I";
return "480i";
}
return "480P";
return "480p";
}
return "SD";

View File

@@ -20,7 +20,7 @@ namespace MediaBrowser.Model.Entities
}
/// <summary>
/// Gets a provider id
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
@@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Entities
}
/// <summary>
/// Gets a provider id
/// Gets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
@@ -53,7 +53,7 @@ namespace MediaBrowser.Model.Entities
}
/// <summary>
/// Sets a provider id
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
@@ -89,7 +89,7 @@ namespace MediaBrowser.Model.Entities
}
/// <summary>
/// Sets a provider id
/// Sets a provider id.
/// </summary>
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>

View File

@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Entities
/// The continuing.
/// </summary>
Continuing,
/// <summary>
/// The ended.
/// </summary>

View File

@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.Entities
/// The ascending.
/// </summary>
Ascending,
/// <summary>
/// The descending.
/// </summary>

View File

@@ -1,27 +0,0 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Extensions
{
// TODO: @bond remove
public static class ListHelper
{
public static bool ContainsIgnoreCase(string[] list, string value)
{
if (value == null)
{
throw new ArgumentNullException(nameof(value));
}
foreach (var item in list)
{
if (string.Equals(item, value, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}

View File

@@ -22,6 +22,11 @@ namespace MediaBrowser.Model.Extensions
return str;
}
#if NETSTANDARD2_0
char[] a = str.ToCharArray();
a[0] = char.ToUpperInvariant(a[0]);
return new string(a);
#else
return string.Create(
str.Length,
str,
@@ -33,6 +38,7 @@ namespace MediaBrowser.Model.Extensions
chars[i] = buf[i];
}
});
#endif
}
}
}

View File

@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.LiveTv
public SeriesTimerInfoDto()
{
ImageTags = new Dictionary<ImageType, string>();
Days = new DayOfWeek[] { };
Days = Array.Empty<DayOfWeek>();
Type = "SeriesTimer";
}

View File

@@ -1,4 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<!-- ProjectGuid is only included as a requirement for SonarQube analysis -->
<PropertyGroup>
<ProjectGuid>{7EEEB4BB-F3E8-48FC-B4C5-70F0FFF8329B}</ProjectGuid>
</PropertyGroup>
<PropertyGroup>
<Authors>Jellyfin Contributors</Authors>
@@ -8,7 +13,7 @@
</PropertyGroup>
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<TreatWarningsAsErrors Condition=" '$(Configuration)' == 'Release' ">true</TreatWarningsAsErrors>
@@ -16,9 +21,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.3" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Text.Json" Version="4.7.0" />
<PackageReference Include="System.Text.Json" Version="4.7.1" />
</ItemGroup>
<ItemGroup>
@@ -32,6 +37,9 @@
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="SmartAnalyzers.MultithreadingAnalyzer" Version="1.1.31" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Jellyfin.Data\Jellyfin.Data.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<CodeAnalysisRuleSet>../jellyfin.ruleset</CodeAnalysisRuleSet>

View File

@@ -17,112 +17,133 @@ namespace MediaBrowser.Model.Net
/// </summary>
private static readonly HashSet<string> _videoFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
".mkv",
".m2t",
".m2ts",
".img",
".iso",
".mk3d",
".ts",
".rmvb",
".mov",
".3gp",
".asf",
".avi",
".mpg",
".mpeg",
".wmv",
".mp4",
".divx",
".dvr-ms",
".wtv",
".f4v",
".flv",
".img",
".iso",
".m2t",
".m2ts",
".m2v",
".m4v",
".mk3d",
".mkv",
".mov",
".mp4",
".mpg",
".mpeg",
".mts",
".ogg",
".ogm",
".ogv",
".asf",
".m4v",
".flv",
".f4v",
".3gp",
".rec",
".ts",
".rmvb",
".webm",
".mts",
".m2v",
".rec"
".wmv",
".wtv",
};
// http://en.wikipedia.org/wiki/Internet_media_type
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
// http://www.iana.org/assignments/media-types/media-types.xhtml
// Add more as needed
private static readonly Dictionary<string, string> _mimeTypeLookup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
// Type application
{ ".7z", "application/x-7z-compressed" },
{ ".azw", "application/vnd.amazon.ebook" },
{ ".azw3", "application/vnd.amazon.ebook" },
{ ".cbz", "application/x-cbz" },
{ ".cbr", "application/epub+zip" },
{ ".eot", "application/vnd.ms-fontobject" },
{ ".epub", "application/epub+zip" },
{ ".js", "application/x-javascript" },
{ ".json", "application/json" },
{ ".map", "application/x-javascript" },
{ ".pdf", "application/pdf" },
{ ".ttml", "application/ttml+xml" },
{ ".m3u8", "application/x-mpegURL" },
{ ".map", "application/x-javascript" },
{ ".mobi", "application/x-mobipocket-ebook" },
{ ".xml", "application/xml" },
{ ".opf", "application/oebps-package+xml" },
{ ".pdf", "application/pdf" },
{ ".rar", "application/vnd.rar" },
{ ".srt", "application/x-subrip" },
{ ".ttml", "application/ttml+xml" },
{ ".wasm", "application/wasm" },
{ ".xml", "application/xml" },
{ ".zip", "application/zip" },
// Type image
{ ".bmp", "image/bmp" },
{ ".gif", "image/gif" },
{ ".ico", "image/vnd.microsoft.icon" },
{ ".jpg", "image/jpeg" },
{ ".jpeg", "image/jpeg" },
{ ".tbn", "image/jpeg" },
{ ".png", "image/png" },
{ ".gif", "image/gif" },
{ ".tiff", "image/tiff" },
{ ".webp", "image/webp" },
{ ".ico", "image/vnd.microsoft.icon" },
{ ".svg", "image/svg+xml" },
{ ".svgz", "image/svg+xml" },
{ ".tbn", "image/jpeg" },
{ ".tif", "image/tiff" },
{ ".tiff", "image/tiff" },
{ ".webp", "image/webp" },
// Type font
{ ".ttf" , "font/ttf" },
{ ".woff" , "font/woff" },
{ ".woff2" , "font/woff2" },
// Type text
{ ".ass", "text/x-ssa" },
{ ".ssa", "text/x-ssa" },
{ ".css", "text/css" },
{ ".csv", "text/csv" },
{ ".rtf", "text/rtf" },
{ ".txt", "text/plain" },
{ ".vtt", "text/vtt" },
// Type video
{ ".mpg", "video/mpeg" },
{ ".ogv", "video/ogg" },
{ ".mov", "video/quicktime" },
{ ".webm", "video/webm" },
{ ".mkv", "video/x-matroska" },
{ ".wmv", "video/x-ms-wmv" },
{ ".flv", "video/x-flv" },
{ ".avi", "video/x-msvideo" },
{ ".asf", "video/x-ms-asf" },
{ ".m4v", "video/x-m4v" },
{ ".m4s", "video/mp4" },
{ ".3gp", "video/3gpp" },
{ ".3g2", "video/3gpp2" },
{ ".asf", "video/x-ms-asf" },
{ ".avi", "video/x-msvideo" },
{ ".flv", "video/x-flv" },
{ ".mp4", "video/mp4" },
{ ".m4s", "video/mp4" },
{ ".m4v", "video/x-m4v" },
{ ".mpegts", "video/mp2t" },
{ ".mpg", "video/mpeg" },
{ ".mkv", "video/x-matroska" },
{ ".mov", "video/quicktime" },
{ ".mpd", "video/vnd.mpeg.dash.mpd" },
{ ".ogv", "video/ogg" },
{ ".ts", "video/mp2t" },
{ ".webm", "video/webm" },
{ ".wmv", "video/x-ms-wmv" },
// Type audio
{ ".mp3", "audio/mpeg" },
{ ".m4a", "audio/mp4" },
{ ".aac", "audio/mp4" },
{ ".webma", "audio/webm" },
{ ".wav", "audio/wav" },
{ ".wma", "audio/x-ms-wma" },
{ ".ogg", "audio/ogg" },
{ ".oga", "audio/ogg" },
{ ".opus", "audio/ogg" },
{ ".ac3", "audio/ac3" },
{ ".ape", "audio/x-ape" },
{ ".dsf", "audio/dsf" },
{ ".m4b", "audio/m4b" },
{ ".xsp", "audio/xsp" },
{ ".dsp", "audio/dsp" },
{ ".flac", "audio/flac" },
{ ".m4a", "audio/mp4" },
{ ".m4b", "audio/m4b" },
{ ".mid", "audio/midi" },
{ ".midi", "audio/midi" },
{ ".mp3", "audio/mpeg" },
{ ".oga", "audio/ogg" },
{ ".ogg", "audio/ogg" },
{ ".opus", "audio/ogg" },
{ ".vorbis", "audio/vorbis" },
{ ".wav", "audio/wav" },
{ ".webma", "audio/webm" },
{ ".wma", "audio/x-ms-wma" },
{ ".wv", "audio/x-wavpack" },
{ ".xsp", "audio/xsp" },
};
private static readonly Dictionary<string, string> _extensionLookup = CreateExtensionLookup();

View File

@@ -1,5 +1,8 @@
#pragma warning disable CS1591
using System;
namespace MediaBrowser.Model.Net
{
/// <summary>
@@ -13,7 +16,9 @@ namespace MediaBrowser.Model.Net
/// </summary>
/// <value>The type of the message.</value>
public string MessageType { get; set; }
public string MessageId { get; set; }
public Guid MessageId { get; set; }
public string ServerId { get; set; }
/// <summary>
@@ -22,5 +27,4 @@ namespace MediaBrowser.Model.Net
/// <value>The data.</value>
public T Data { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Extensions;
using System.Linq;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Model.Notifications
@@ -81,8 +81,12 @@ namespace MediaBrowser.Model.Notifications
{
foreach (NotificationOption i in Options)
{
if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase)) return i;
if (string.Equals(type, i.Type, StringComparison.OrdinalIgnoreCase))
{
return i;
}
}
return null;
}
@@ -98,7 +102,7 @@ namespace MediaBrowser.Model.Notifications
NotificationOption opt = GetOptions(notificationType);
return opt == null ||
!ListHelper.ContainsIgnoreCase(opt.DisabledServices, service);
!opt.DisabledServices.Contains(service, StringComparer.OrdinalIgnoreCase);
}
public bool IsEnabledToMonitorUser(string type, Guid userId)
@@ -106,7 +110,7 @@ namespace MediaBrowser.Model.Notifications
NotificationOption opt = GetOptions(type);
return opt != null && opt.Enabled &&
!ListHelper.ContainsIgnoreCase(opt.DisabledMonitorUsers, userId.ToString(""));
!opt.DisabledMonitorUsers.Contains(userId.ToString(""), StringComparer.OrdinalIgnoreCase);
}
public bool IsEnabledToSendToUser(string type, string userId, UserPolicy userPolicy)
@@ -125,7 +129,7 @@ namespace MediaBrowser.Model.Notifications
return true;
}
return ListHelper.ContainsIgnoreCase(opt.SendToUsers, userId);
return opt.SendToUsers.Contains(userId, StringComparer.OrdinalIgnoreCase);
}
return false;

View File

@@ -8,17 +8,17 @@ namespace MediaBrowser.Model.Services
{
/// <summary>
/// Order in which Request Filters are executed.
/// &lt;0 Executed before global request filters
/// &gt;0 Executed after global request filters
/// &lt;0 Executed before global request filters.
/// &gt;0 Executed after global request filters.
/// </summary>
int Priority { get; }
/// <summary>
/// The request filter is executed before the service.
/// </summary>
/// <param name="req">The http request wrapper</param>
/// <param name="res">The http response wrapper</param>
/// <param name="requestDto">The request DTO</param>
/// <param name="req">The http request wrapper.</param>
/// <param name="res">The http response wrapper.</param>
/// <param name="requestDto">The request DTO.</param>
void RequestFilter(IRequest req, HttpResponse res, object requestDto);
}
}

View File

@@ -26,8 +26,6 @@ namespace MediaBrowser.Model.System
/// </summary>
public class SystemInfo : PublicSystemInfo
{
public PackageVersionClass SystemUpdateLevel { get; set; }
/// <summary>
/// Gets or sets the display name of the operating system.
/// </summary>
@@ -117,24 +115,6 @@ namespace MediaBrowser.Model.System
/// <value>The transcode path.</value>
public string TranscodingTempPath { get; set; }
/// <summary>
/// Gets or sets the HTTP server port number.
/// </summary>
/// <value>The HTTP server port number.</value>
public int HttpServerPortNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable HTTPS].
/// </summary>
/// <value><c>true</c> if [enable HTTPS]; otherwise, <c>false</c>.</value>
public bool SupportsHttps { get; set; }
/// <summary>
/// Gets or sets the HTTPS server port number.
/// </summary>
/// <value>The HTTPS server port number.</value>
public int HttpsPortNumber { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has update available.
/// </summary>

View File

@@ -1,29 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class CheckForUpdateResult.
/// </summary>
public class CheckForUpdateResult
{
/// <summary>
/// Gets or sets a value indicating whether this instance is update available.
/// </summary>
/// <value><c>true</c> if this instance is update available; otherwise, <c>false</c>.</value>
public bool IsUpdateAvailable { get; set; }
/// <summary>
/// Gets or sets the available version.
/// </summary>
/// <value>The available version.</value>
public string AvailableVersion
{
get => Package != null ? Package.versionStr : "0.0.0.1";
set { } // need this for the serializer
}
/// <summary>
/// Get or sets package information for an available update
/// </summary>
public PackageVersionInfo Package { get; set; }
}
}

View File

@@ -8,10 +8,10 @@ namespace MediaBrowser.Model.Updates
public class InstallationInfo
{
/// <summary>
/// Gets or sets the id.
/// Gets or sets the guid.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <value>The guid.</value>
public string Guid { get; set; }
/// <summary>
/// Gets or sets the name.
@@ -19,22 +19,10 @@ namespace MediaBrowser.Model.Updates
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the assembly guid.
/// </summary>
/// <value>The guid of the assembly.</value>
public string AssemblyGuid { get; set; }
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public string Version { get; set; }
/// <summary>
/// Gets or sets the update class.
/// </summary>
/// <value>The update class.</value>
public PackageVersionClass UpdateClass { get; set; }
}
}

View File

@@ -8,12 +8,6 @@ namespace MediaBrowser.Model.Updates
/// </summary>
public class PackageInfo
{
/// <summary>
/// The internal id of this package.
/// </summary>
/// <value>The id.</value>
public string id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
@@ -21,59 +15,17 @@ namespace MediaBrowser.Model.Updates
public string name { get; set; }
/// <summary>
/// Gets or sets the short description.
/// Gets or sets a long description of the plugin containing features or helpful explanations.
/// </summary>
/// <value>The short description.</value>
public string shortDescription { get; set; }
/// <value>The description.</value>
public string description { get; set; }
/// <summary>
/// Gets or sets the overview.
/// Gets or sets a short overview of what the plugin does.
/// </summary>
/// <value>The overview.</value>
public string overview { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is premium.
/// </summary>
/// <value><c>true</c> if this instance is premium; otherwise, <c>false</c>.</value>
public bool isPremium { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is adult only content.
/// </summary>
/// <value><c>true</c> if this instance is adult; otherwise, <c>false</c>.</value>
public bool adult { get; set; }
/// <summary>
/// Gets or sets the rich desc URL.
/// </summary>
/// <value>The rich desc URL.</value>
public string richDescUrl { get; set; }
/// <summary>
/// Gets or sets the thumb image.
/// </summary>
/// <value>The thumb image.</value>
public string thumbImage { get; set; }
/// <summary>
/// Gets or sets the preview image.
/// </summary>
/// <value>The preview image.</value>
public string previewImage { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string type { get; set; }
/// <summary>
/// Gets or sets the target filename.
/// </summary>
/// <value>The target filename.</value>
public string targetFilename { get; set; }
/// <summary>
/// Gets or sets the owner.
/// </summary>
@@ -87,90 +39,24 @@ namespace MediaBrowser.Model.Updates
public string category { get; set; }
/// <summary>
/// Gets or sets the catalog tile color.
/// </summary>
/// <value>The owner.</value>
public string tileColor { get; set; }
/// <summary>
/// Gets or sets the feature id of this package (if premium).
/// </summary>
/// <value>The feature id.</value>
public string featureId { get; set; }
/// <summary>
/// Gets or sets the registration info for this package (if premium).
/// </summary>
/// <value>The registration info.</value>
public string regInfo { get; set; }
/// <summary>
/// Gets or sets the price for this package (if premium).
/// </summary>
/// <value>The price.</value>
public float price { get; set; }
/// <summary>
/// Gets or sets the target system for this plug-in (Server, MBTheater, MBClassic).
/// </summary>
/// <value>The target system.</value>
public PackageTargetSystem targetSystem { get; set; }
/// <summary>
/// The guid of the assembly associated with this package (if a plug-in).
/// The guid of the assembly associated with this plugin.
/// This is used to identify the proper item for automatic updates.
/// </summary>
/// <value>The name.</value>
public string guid { get; set; }
/// <summary>
/// Gets or sets the total number of ratings for this package.
/// </summary>
/// <value>The total ratings.</value>
public int? totalRatings { get; set; }
/// <summary>
/// Gets or sets the average rating for this package .
/// </summary>
/// <value>The rating.</value>
public float avgRating { get; set; }
/// <summary>
/// Gets or sets whether or not this package is registered.
/// </summary>
/// <value>True if registered.</value>
public bool isRegistered { get; set; }
/// <summary>
/// Gets or sets the expiration date for this package.
/// </summary>
/// <value>Expiration Date.</value>
public DateTime expDate { get; set; }
/// <summary>
/// Gets or sets the versions.
/// </summary>
/// <value>The versions.</value>
public IReadOnlyList<PackageVersionInfo> versions { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable in application store].
/// </summary>
/// <value><c>true</c> if [enable in application store]; otherwise, <c>false</c>.</value>
public bool enableInAppStore { get; set; }
/// <summary>
/// Gets or sets the installs.
/// </summary>
/// <value>The installs.</value>
public int installs { get; set; }
public IReadOnlyList<VersionInfo> versions { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PackageInfo"/> class.
/// </summary>
public PackageInfo()
{
versions = Array.Empty<PackageVersionInfo>();
versions = Array.Empty<VersionInfo>();
}
}
}

View File

@@ -1,23 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Enum PackageType.
/// </summary>
public enum PackageTargetSystem
{
/// <summary>
/// Server.
/// </summary>
Server,
/// <summary>
/// MB Theater.
/// </summary>
MBTheater,
/// <summary>
/// MB Classic.
/// </summary>
MBClassic
}
}

View File

@@ -1,23 +0,0 @@
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Enum PackageVersionClass.
/// </summary>
public enum PackageVersionClass
{
/// <summary>
/// The release.
/// </summary>
Release = 0,
/// <summary>
/// The beta.
/// </summary>
Beta = 1,
/// <summary>
/// The dev.
/// </summary>
Dev = 2
}
}

View File

@@ -1,96 +0,0 @@
#pragma warning disable CS1591
using System;
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class PackageVersionInfo.
/// </summary>
public class PackageVersionInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string name { get; set; }
/// <summary>
/// Gets or sets the guid.
/// </summary>
/// <value>The guid.</value>
public string guid { get; set; }
/// <summary>
/// Gets or sets the version STR.
/// </summary>
/// <value>The version STR.</value>
public string versionStr { get; set; }
/// <summary>
/// The _version
/// </summary>
private Version _version;
/// <summary>
/// Gets or sets the version.
/// Had to make this an interpreted property since Protobuf can't handle Version
/// </summary>
/// <value>The version.</value>
[JsonIgnore]
public Version Version
{
get
{
if (_version == null)
{
var ver = versionStr;
_version = new Version(string.IsNullOrEmpty(ver) ? "0.0.0.1" : ver);
}
return _version;
}
}
/// <summary>
/// Gets or sets the classification.
/// </summary>
/// <value>The classification.</value>
public PackageVersionClass classification { get; set; }
/// <summary>
/// Gets or sets the description.
/// </summary>
/// <value>The description.</value>
public string description { get; set; }
/// <summary>
/// Gets or sets the required version STR.
/// </summary>
/// <value>The required version STR.</value>
public string requiredVersionStr { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string sourceUrl { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string checksum { get; set; }
/// <summary>
/// Gets or sets the target filename.
/// </summary>
/// <value>The target filename.</value>
public string targetFilename { get; set; }
public string infoUrl { get; set; }
public string runtimes { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using System;
namespace MediaBrowser.Model.Updates
{
/// <summary>
/// Class PackageVersionInfo.
/// </summary>
public class VersionInfo
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string name { get; set; }
/// <summary>
/// Gets or sets the guid.
/// </summary>
/// <value>The guid.</value>
public string guid { get; set; }
/// <summary>
/// Gets or sets the version.
/// </summary>
/// <value>The version.</value>
public Version version { get; set; }
/// <summary>
/// Gets or sets the changelog for this version.
/// </summary>
/// <value>The changelog.</value>
public string changelog { get; set; }
/// <summary>
/// Gets or sets the ABI that this version was built against.
/// </summary>
/// <value>The target ABI version.</value>
public string targetAbi { get; set; }
/// <summary>
/// Gets or sets the source URL.
/// </summary>
/// <value>The source URL.</value>
public string sourceUrl { get; set; }
/// <summary>
/// Gets or sets a checksum for the binary.
/// </summary>
/// <value>The checksum.</value>
public string checksum { get; set; }
/// <summary>
/// Gets or sets the target filename for the downloaded binary.
/// </summary>
/// <value>The target filename.</value>
public string filename { get; set; }
}
}