Merge remote-tracking branch 'upstream/master' into library_scan_speed

This commit is contained in:
Gary Wilber
2020-11-08 11:51:40 -08:00
400 changed files with 5814 additions and 8346 deletions

View File

@@ -1,10 +1,10 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Events;
using Jellyfin.Data.Queries;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity
@@ -15,11 +15,13 @@ namespace MediaBrowser.Model.Activity
Task CreateAsync(ActivityLog entry);
QueryResult<ActivityLogEntry> GetPagedResult(int? startIndex, int? limit);
Task<QueryResult<ActivityLogEntry>> GetPagedResultAsync(ActivityLogQuery query);
QueryResult<ActivityLogEntry> GetPagedResult(
Func<IQueryable<ActivityLog>, IQueryable<ActivityLog>> func,
int? startIndex,
int? limit);
/// <summary>
/// Remove all activity logs before the specified date.
/// </summary>
/// <param name="startDate">Activity log start date.</param>
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
Task CleanAsync(DateTime startDate);
}
}

View File

@@ -9,6 +9,10 @@ namespace MediaBrowser.Model.Configuration
public string TranscodingTempPath { get; set; }
public string FallbackFontPath { get; set; }
public bool EnableFallbackFont { get; set; }
public double DownMixAudioBoost { get; set; }
public int MaxMuxingQueueSize { get; set; }
@@ -69,6 +73,7 @@ namespace MediaBrowser.Model.Configuration
public EncodingOptions()
{
EnableFallbackFont = false;
DownMixAudioBoost = 2;
MaxMuxingQueueSize = 2048;
EnableThrottling = false;

View File

@@ -25,8 +25,6 @@ namespace MediaBrowser.Model.Configuration
public bool EnableInternetProviders { get; set; }
public bool ImportMissingEpisodes { get; set; }
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableEmbeddedTitles { get; set; }

View File

@@ -271,6 +271,10 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
public string[] KnownProxies { get; set; }
/// Gets or sets the number of days we should retain activity logs.
/// </summary>
public int? ActivityLogRetentionDays { get; set; }
/// <summary>
/// Gets or sets the how the library scan fans out.
/// </summary>
@@ -391,8 +395,9 @@ namespace MediaBrowser.Model.Configuration
SlowResponseThresholdMs = 500;
CorsHosts = new[] { "*" };
KnownProxies = Array.Empty<string>();
LibraryMetadataRefreshConcurrency = 0;
ActivityLogRetentionDays = 30;
LibraryScanFanoutConcurrency = 0;
LibraryMetadataRefreshConcurrency = 0;
}
}

View File

@@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Dlna
/// <summary>
/// The application's configured quality setting.
/// </summary>
public long? MaxBitrate { get; set; }
public int? MaxBitrate { get; set; }
/// <summary>
/// Gets or sets the context.
@@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Dlna
/// Gets the maximum bitrate.
/// </summary>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
public long? GetMaxBitrate(bool isAudio)
public int? GetMaxBitrate(bool isAudio)
{
if (MaxBitrate.HasValue)
{

View File

@@ -38,7 +38,8 @@ namespace MediaBrowser.Model.Dlna
";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(
container,
width,
height);
@@ -160,7 +161,8 @@ namespace MediaBrowser.Model.Dlna
string dlnaflags = string.Format(CultureInfo.InvariantCulture, ";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(container,
ResponseProfile mediaProfile = _profile.GetVideoMediaProfile(
container,
audioCodec,
videoCodec,
width,
@@ -221,7 +223,8 @@ namespace MediaBrowser.Model.Dlna
private static string GetImageOrgPnValue(string container, int? width, int? height)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveImageFormat(container,
.ResolveImageFormat(
container,
width,
height);
@@ -231,7 +234,8 @@ namespace MediaBrowser.Model.Dlna
private static string GetAudioOrgPnValue(string container, int? audioBitrate, int? audioSampleRate, int? audioChannels)
{
MediaFormatProfile? format = new MediaFormatProfileResolver()
.ResolveAudioFormat(container,
.ResolveAudioFormat(
container,
audioBitrate,
audioSampleRate,
audioChannels);

View File

@@ -62,9 +62,9 @@ namespace MediaBrowser.Model.Dlna
public int? MaxIconHeight { get; set; }
public long? MaxStreamingBitrate { get; set; }
public int? MaxStreamingBitrate { get; set; }
public long? MaxStaticBitrate { get; set; }
public int? MaxStaticBitrate { get; set; }
public int? MusicStreamingTranscodingBitrate { get; set; }
@@ -277,7 +277,8 @@ namespace MediaBrowser.Model.Dlna
return null;
}
public ResponseProfile GetVideoMediaProfile(string container,
public ResponseProfile GetVideoMediaProfile(
string container,
string audioCodec,
string videoCodec,
int? width,

View File

@@ -455,9 +455,11 @@ namespace MediaBrowser.Model.Dlna
if (directPlayProfile == null)
{
_logger.LogInformation("Profile: {0}, No direct play profiles found for Path: {1}",
_logger.LogInformation(
"Profile: {0}, No audio direct play profiles found for {1} with codec {2}",
options.Profile.Name ?? "Unknown Profile",
item.Path ?? "Unknown path");
item.Path ?? "Unknown path",
audioStream.Codec ?? "Unknown codec");
return (Enumerable.Empty<PlayMethod>(), GetTranscodeReasonsFromDirectPlayProfile(item, null, audioStream, options.Profile.DirectPlayProfiles));
}
@@ -678,7 +680,8 @@ namespace MediaBrowser.Model.Dlna
bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || directPlayEligibilityResult.Item1);
bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || directStreamEligibilityResult.Item1);
_logger.LogInformation("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
_logger.LogInformation(
"Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
options.Profile.Name ?? "Unknown Profile",
item.Path ?? "Unknown path",
isEligibleForDirectPlay,
@@ -972,9 +975,11 @@ namespace MediaBrowser.Model.Dlna
if (directPlay == null)
{
_logger.LogInformation("Profile: {0}, No direct play profiles found for Path: {1}",
_logger.LogInformation(
"Profile: {0}, No video direct play profiles found for {1} with codec {2}",
profile.Name ?? "Unknown Profile",
mediaSource.Path ?? "Unknown path");
mediaSource.Path ?? "Unknown path",
videoStream.Codec ?? "Unknown codec");
return (null, GetTranscodeReasonsFromDirectPlayProfile(mediaSource, videoStream, audioStream, profile.DirectPlayProfiles));
}
@@ -1135,7 +1140,8 @@ namespace MediaBrowser.Model.Dlna
private void LogConditionFailure(DeviceProfile profile, string type, ProfileCondition condition, MediaSourceInfo mediaSource)
{
_logger.LogInformation("Profile: {0}, DirectPlay=false. Reason={1}.{2} Condition: {3}. ConditionValue: {4}. IsRequired: {5}. Path: {6}",
_logger.LogInformation(
"Profile: {0}, DirectPlay=false. Reason={1}.{2} Condition: {3}. ConditionValue: {4}. IsRequired: {5}. Path: {6}",
type,
profile.Name ?? "Unknown Profile",
condition.Property,
@@ -1340,7 +1346,8 @@ namespace MediaBrowser.Model.Dlna
if (itemBitrate > requestedMaxBitrate)
{
_logger.LogInformation("Bitrate exceeds {PlayBackMethod} limit: media bitrate: {MediaBitrate}, max bitrate: {MaxBitrate}",
_logger.LogInformation(
"Bitrate exceeds {PlayBackMethod} limit: media bitrate: {MediaBitrate}, max bitrate: {MaxBitrate}",
playMethod, itemBitrate, requestedMaxBitrate);
return false;
}

View File

@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Model.Extensions
{
/// <summary>
/// Extension methods for <see cref="IEnumerable{T}"/>.
/// </summary>
public static class EnumerableExtensions
{
/// <summary>
/// Orders <see cref="RemoteImageInfo"/> by requested language in descending order, prioritizing "en" over other non-matches.
/// </summary>
/// <param name="remoteImageInfos">The remote image infos.</param>
/// <param name="requestedLanguage">The requested language for the images.</param>
/// <returns>The ordered remote image infos.</returns>
public static IEnumerable<RemoteImageInfo> OrderByLanguageDescending(this IEnumerable<RemoteImageInfo> remoteImageInfos, string requestedLanguage)
{
var isRequestedLanguageEn = string.Equals(requestedLanguage, "en", StringComparison.OrdinalIgnoreCase);
return remoteImageInfos.OrderByDescending(i =>
{
if (string.Equals(requestedLanguage, i.Language, StringComparison.OrdinalIgnoreCase))
{
return 3;
}
if (!isRequestedLanguageEn && string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
{
return 2;
}
if (string.IsNullOrEmpty(i.Language))
{
return isRequestedLanguageEn ? 3 : 2;
}
return 0;
})
.ThenByDescending(i => i.CommunityRating ?? 0)
.ThenByDescending(i => i.VoteCount ?? 0);
}
}
}

View File

@@ -34,7 +34,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.9" />
<PackageReference Include="System.Globalization" Version="4.3.0" />
<PackageReference Include="System.Text.Json" Version="5.0.0-preview.8.20407.11" />
</ItemGroup>

View File

@@ -37,7 +37,7 @@ namespace MediaBrowser.Model.MediaInfo
public string PlaySessionId { get; set; }
public long? MaxStreamingBitrate { get; set; }
public int? MaxStreamingBitrate { get; set; }
public long? StartTimeTicks { get; set; }

View File

@@ -2,6 +2,7 @@
#pragma warning disable CS1591
using System;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Net
{
@@ -15,7 +16,7 @@ namespace MediaBrowser.Model.Net
/// Gets or sets the type of the message.
/// </summary>
/// <value>The type of the message.</value>
public string MessageType { get; set; }
public SessionMessageType MessageType { get; set; }
public Guid MessageId { get; set; }

View File

@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Session
{
public string[] PlayableMediaTypes { get; set; }
public string[] SupportedCommands { get; set; }
public GeneralCommandType[] SupportedCommands { get; set; }
public bool SupportsMediaControl { get; set; }
@@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Session
public ClientCapabilities()
{
PlayableMediaTypes = Array.Empty<string>();
SupportedCommands = Array.Empty<string>();
SupportedCommands = Array.Empty<GeneralCommandType>();
SupportsPersistentIdentifier = true;
}
}

View File

@@ -43,6 +43,11 @@ namespace MediaBrowser.Model.Session
Guide = 32,
ToggleStats = 33,
PlayMediaSource = 34,
PlayTrailers = 35
PlayTrailers = 35,
SetShuffleQueue = 36,
PlayState = 37,
PlayNext = 38,
ToggleOsdMenu = 39,
Play = 40
}
}

View File

@@ -0,0 +1,50 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Session
{
/// <summary>
/// The different kinds of messages that are used in the WebSocket api.
/// </summary>
public enum SessionMessageType
{
// Server -> Client
ForceKeepAlive,
GeneralCommand,
UserDataChanged,
Sessions,
Play,
SyncPlayCommand,
SyncPlayGroupUpdate,
PlayState,
RestartRequired,
ServerShuttingDown,
ServerRestarting,
LibraryChanged,
UserDeleted,
UserUpdated,
SeriesTimerCreated,
TimerCreated,
SeriesTimerCancelled,
TimerCancelled,
RefreshProgress,
ScheduledTaskEnded,
PackageInstallationCancelled,
PackageInstallationFailed,
PackageInstallationCompleted,
PackageInstalling,
PackageUninstalled,
ActivityLogEntry,
ScheduledTasksInfo,
// Client -> Server
ActivityLogEntryStart,
ActivityLogEntryStop,
SessionsStart,
SessionsStop,
ScheduledTasksInfoStart,
ScheduledTasksInfoStop,
// Shared
KeepAlive,
}
}

View File

@@ -0,0 +1,34 @@
using System;
namespace MediaBrowser.Model.Subtitles
{
/// <summary>
/// Class FontFile.
/// </summary>
public class FontFile
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
public long Size { get; set; }
/// <summary>
/// Gets or sets the date created.
/// </summary>
/// <value>The date created.</value>
public DateTime DateCreated { get; set; }
/// <summary>
/// Gets or sets the date modified.
/// </summary>
/// <value>The date modified.</value>
public DateTime DateModified { get; set; }
}
}

View File

@@ -43,7 +43,10 @@ namespace MediaBrowser.Model.System
/// <summary>
/// Gets or sets a value indicating whether the startup wizard is completed.
/// </summary>
/// <value>The startup completion status.</value>
public bool StartupWizardCompleted { get; set; }
/// <remarks>
/// Nullable for OpenAPI specification only to retain backwards compatibility in apiclients.
/// </remarks>
/// <value>The startup completion status.</value>]
public bool? StartupWizardCompleted { get; set; }
}
}

View File

@@ -92,6 +92,8 @@ namespace MediaBrowser.Model.Users
public int LoginAttemptsBeforeLockout { get; set; }
public int MaxActiveSessions { get; set; }
public bool EnablePublicSharing { get; set; }
public Guid[] BlockedMediaFolders { get; set; }
@@ -144,6 +146,8 @@ namespace MediaBrowser.Model.Users
LoginAttemptsBeforeLockout = -1;
MaxActiveSessions = 0;
EnableAllChannels = true;
EnabledChannels = Array.Empty<Guid>();