Merge branch 'jellyfin:master' into master

This commit is contained in:
Negulici-R. Barnabas
2022-11-13 15:29:16 +02:00
committed by GitHub
427 changed files with 5456 additions and 10225 deletions

View File

@@ -1,5 +1,4 @@
using System.Text.Json.Serialization;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Branding;

View File

@@ -5,7 +5,6 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
public enum EmbeddedSubtitleOptions
{
/// <summary>
/// Allow all embedded subs.
/// </summary>
@@ -26,5 +25,4 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
AllowNone = 3,
}
}

View File

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

View File

@@ -22,10 +22,10 @@ namespace MediaBrowser.Model.Configuration
HidePlayedInLatest = true;
PlayDefaultAudioTrack = true;
LatestItemsExcludes = Array.Empty<string>();
OrderedViews = Array.Empty<string>();
MyMediaExcludes = Array.Empty<string>();
GroupedFolders = Array.Empty<string>();
LatestItemsExcludes = Array.Empty<Guid>();
OrderedViews = Array.Empty<Guid>();
MyMediaExcludes = Array.Empty<Guid>();
GroupedFolders = Array.Empty<Guid>();
}
/// <summary>
@@ -48,7 +48,7 @@ namespace MediaBrowser.Model.Configuration
public bool DisplayMissingEpisodes { get; set; }
public string[] GroupedFolders { get; set; }
public Guid[] GroupedFolders { get; set; }
public SubtitlePlaybackMode SubtitleMode { get; set; }
@@ -56,11 +56,11 @@ namespace MediaBrowser.Model.Configuration
public bool EnableLocalPassword { get; set; }
public string[] OrderedViews { get; set; }
public Guid[] OrderedViews { get; set; }
public string[] LatestItemsExcludes { get; set; }
public Guid[] LatestItemsExcludes { get; set; }
public string[] MyMediaExcludes { get; set; }
public Guid[] MyMediaExcludes { get; set; }
public bool HidePlayedInLatest { get; set; }

View File

@@ -29,10 +29,7 @@ namespace MediaBrowser.Model.Cryptography
public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters)
{
if (id == null)
{
throw new ArgumentNullException(nameof(id));
}
ArgumentNullException.ThrowIfNull(id);
if (id.Length == 0)
{

View File

@@ -8,7 +8,7 @@ using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
public class ContentFeatureBuilder
public static class ContentFeatureBuilder
{
public static string BuildImageHeader(
DeviceProfile profile,
@@ -157,7 +157,7 @@ namespace MediaBrowser.Model.Dlna
flagValue |= DlnaFlags.ByteBasedSeek;
}
// Time based seek is curently disabled when streaming. On LG CX3 adding DlnaFlags.TimeBasedSeek and orgPn causes the DLNA playback to fail (format not supported). Further investigations are needed before enabling the remaining code paths.
// Time based seek is currently disabled when streaming. On LG CX3 adding DlnaFlags.TimeBasedSeek and orgPn causes the DLNA playback to fail (format not supported). Further investigations are needed before enabling the remaining code paths.
// else if (runtimeTicks.HasValue)
// {
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;

View File

@@ -436,9 +436,9 @@ namespace MediaBrowser.Model.Dlna
{
containerSupported = true;
videoSupported = videoStream != null && profile.SupportsVideoCodec(videoStream.Codec);
videoSupported = videoStream == null || profile.SupportsVideoCodec(videoStream.Codec);
audioSupported = audioStream != null && profile.SupportsAudioCodec(audioStream.Codec);
audioSupported = audioStream == null || profile.SupportsAudioCodec(audioStream.Codec);
if (videoSupported && audioSupported)
{
@@ -447,18 +447,17 @@ namespace MediaBrowser.Model.Dlna
}
}
var list = new List<TranscodeReason>();
if (!containerSupported)
{
reasons |= TranscodeReason.ContainerNotSupported;
}
if (videoStream != null && !videoSupported)
if (!videoSupported)
{
reasons |= TranscodeReason.VideoCodecNotSupported;
}
if (audioStream != null && !audioSupported)
if (!audioSupported)
{
reasons |= TranscodeReason.AudioCodecNotSupported;
}
@@ -565,10 +564,7 @@ namespace MediaBrowser.Model.Dlna
private StreamInfo BuildVideoItem(MediaSourceInfo item, VideoOptions options)
{
if (item == null)
{
throw new ArgumentNullException(nameof(item));
}
ArgumentNullException.ThrowIfNull(item);
StreamInfo playlistItem = new StreamInfo
{
@@ -590,21 +586,19 @@ namespace MediaBrowser.Model.Dlna
}
// Collect candidate audio streams
IEnumerable<MediaStream> candidateAudioStreams = audioStream == null ? Array.Empty<MediaStream>() : new[] { audioStream };
ICollection<MediaStream> candidateAudioStreams = audioStream == null ? Array.Empty<MediaStream>() : new[] { audioStream };
if (!options.AudioStreamIndex.HasValue || options.AudioStreamIndex < 0)
{
if (audioStream?.IsDefault == true)
{
candidateAudioStreams = item.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio && stream.IsDefault);
candidateAudioStreams = item.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio && stream.IsDefault).ToArray();
}
else
{
candidateAudioStreams = item.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio && stream.Language == audioStream?.Language);
candidateAudioStreams = item.MediaStreams.Where(stream => stream.Type == MediaStreamType.Audio && stream.Language == audioStream?.Language).ToArray();
}
}
candidateAudioStreams = candidateAudioStreams.ToArray();
var videoStream = item.VideoStream;
var directPlayBitrateEligibility = IsBitrateEligibleForDirectPlayback(item, options.GetMaxBitrate(false) ?? 0, options, PlayMethod.DirectPlay);
@@ -1060,7 +1054,7 @@ namespace MediaBrowser.Model.Dlna
MediaSourceInfo mediaSource,
MediaStream videoStream,
MediaStream audioStream,
IEnumerable<MediaStream> candidateAudioStreams,
ICollection<MediaStream> candidateAudioStreams,
MediaStream subtitleStream,
bool isEligibleForDirectPlay,
bool isEligibleForDirectStream)
@@ -1091,9 +1085,6 @@ namespace MediaBrowser.Model.Dlna
bool? isInterlaced = videoStream?.IsInterlaced;
string videoCodecTag = videoStream?.CodecTag;
bool? isAvc = videoStream?.IsAVC;
// Audio
var defaultLanguage = audioStream?.Language ?? string.Empty;
var defaultMarked = audioStream?.IsDefault ?? false;
TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : mediaSource.Timestamp;
int? packetLength = videoStream?.PacketLength;
@@ -1125,7 +1116,7 @@ namespace MediaBrowser.Model.Dlna
.SelectMany(codecProfile => checkVideoConditions(codecProfile.Conditions)));
// Check audiocandidates profile conditions
var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => CheckVideoAudioStreamDirectPlay(options, mediaSource, container, audioStream, defaultLanguage, defaultMarked));
var audioStreamMatches = candidateAudioStreams.ToDictionary(s => s, audioStream => CheckVideoAudioStreamDirectPlay(options, mediaSource, container, audioStream));
TranscodeReason subtitleProfileReasons = 0;
if (subtitleStream != null)
@@ -1182,14 +1173,18 @@ namespace MediaBrowser.Model.Dlna
}
// Check audio codec
var selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));
if (selectedAudioStream == null)
MediaStream selectedAudioStream = null;
if (candidateAudioStreams.Any())
{
directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported;
}
else
{
audioCodecProfileReasons = audioStreamMatches.GetValueOrDefault(selectedAudioStream);
selectedAudioStream = candidateAudioStreams.FirstOrDefault(audioStream => directPlayProfile.SupportsAudioCodec(audioStream.Codec));
if (selectedAudioStream == null)
{
directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported;
}
else
{
audioCodecProfileReasons = audioStreamMatches.GetValueOrDefault(selectedAudioStream);
}
}
var failureReasons = directPlayProfileReasons | containerProfileReasons | subtitleProfileReasons;
@@ -1242,10 +1237,10 @@ namespace MediaBrowser.Model.Dlna
return (Profile: null, PlayMethod: null, AudioStreamIndex: null, TranscodeReasons: failureReasons);
}
private TranscodeReason CheckVideoAudioStreamDirectPlay(VideoOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream, string language, bool isDefault)
private TranscodeReason CheckVideoAudioStreamDirectPlay(VideoOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream)
{
var profile = options.Profile;
var audioFailureConditions = GetProfileConditionsForVideoAudio(profile.CodecProfiles, container, audioStream.Codec, audioStream.Channels, audioStream.BitRate, audioStream.SampleRate, audioStream.BitDepth, audioStream.Profile, !audioStream.IsDefault);
var audioFailureConditions = GetProfileConditionsForVideoAudio(profile.CodecProfiles, container, audioStream.Codec, audioStream.Channels, audioStream.BitRate, audioStream.SampleRate, audioStream.BitDepth, audioStream.Profile, mediaSource.IsSecondaryAudio(audioStream));
var audioStreamFailureReasons = AggregateFailureConditions(mediaSource, profile, "VideoAudioCodecProfile", audioFailureConditions);
if (audioStream?.IsExternal == true)

View File

@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;

View File

@@ -76,6 +76,8 @@ namespace MediaBrowser.Model.Dto
public bool? CanDownload { get; set; }
public bool? HasLyrics { get; set; }
public bool? HasSubtitles { get; set; }
public string PreferredMetadataLanguage { get; set; }
@@ -294,13 +296,13 @@ namespace MediaBrowser.Model.Dto
public NameGuidPair[] GenreItems { get; set; }
/// <summary>
/// Gets or sets wether the item has a logo, this will hold the Id of the Parent that has one.
/// Gets or sets whether the item has a logo, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent logo item id.</value>
public Guid? ParentLogoItemId { get; set; }
/// <summary>
/// Gets or sets wether the item has any backdrops, this will hold the Id of the Parent that has one.
/// Gets or sets whether the item has any backdrops, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent backdrop item id.</value>
public Guid? ParentBackdropItemId { get; set; }
@@ -506,7 +508,7 @@ namespace MediaBrowser.Model.Dto
public string ParentLogoImageTag { get; set; }
/// <summary>
/// Gets or sets wether the item has fan art, this will hold the Id of the Parent that has one.
/// Gets or sets whether the item has fan art, this will hold the Id of the Parent that has one.
/// </summary>
/// <value>The parent art item id.</value>
public Guid? ParentArtItemId { get; set; }

View File

@@ -230,19 +230,15 @@ namespace MediaBrowser.Model.Dto
public bool? IsSecondaryAudio(MediaStream stream)
{
// Look for the first audio track marked as default
foreach (var currentStream in MediaStreams)
if (stream.IsExternal)
{
if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault)
{
return currentStream.Index != stream.Index;
}
return false;
}
// Look for the first audio track
foreach (var currentStream in MediaStreams)
{
if (currentStream.Type == MediaStreamType.Audio)
if (currentStream.Type == MediaStreamType.Audio && !currentStream.IsExternal)
{
return currentStream.Index != stream.Index;
}

View File

@@ -13,6 +13,8 @@ namespace MediaBrowser.Model.Entities
Scene = 6,
Sample = 7,
ThemeSong = 8,
ThemeVideo = 9
ThemeVideo = 9,
Featurette = 10,
Short = 11
}
}

View File

@@ -221,6 +221,8 @@ namespace MediaBrowser.Model.Entities
public string LocalizedExternal { get; set; }
public string LocalizedHearingImpaired { get; set; }
public string DisplayTitle
{
get
@@ -345,6 +347,11 @@ namespace MediaBrowser.Model.Entities
attributes.Add(string.IsNullOrEmpty(LocalizedUndefined) ? "Und" : LocalizedUndefined);
}
if (IsHearingImpaired)
{
attributes.Add(string.IsNullOrEmpty(LocalizedHearingImpaired) ? "Hearing Impaired" : LocalizedHearingImpaired);
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(LocalizedDefault) ? "Default" : LocalizedDefault);
@@ -453,6 +460,12 @@ namespace MediaBrowser.Model.Entities
/// <value><c>true</c> if this instance is forced; otherwise, <c>false</c>.</value>
public bool IsForced { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is for the hearing impaired.
/// </summary>
/// <value><c>true</c> if this instance is for the hearing impaired; otherwise, <c>false</c>.</value>
public bool IsHearingImpaired { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
@@ -606,7 +619,7 @@ namespace MediaBrowser.Model.Entities
<= 1024 when Height <= 576 => IsInterlaced ? "576i" : "576p",
// 1280x720
<= 1280 when Height <= 962 => IsInterlaced ? "720i" : "720p",
// 2560x1080 (FHD ultra wide 21:9) using 1440px width to accomodate WQHD
// 2560x1080 (FHD ultra wide 21:9) using 1440px width to accommodate WQHD
<= 2560 when Height <= 1440 => IsInterlaced ? "1080i" : "1080p",
// 4K
<= 4096 when Height <= 3072 => "4K",

View File

@@ -23,6 +23,11 @@ namespace MediaBrowser.Model.Entities
/// <summary>
/// The embedded image.
/// </summary>
EmbeddedImage
EmbeddedImage,
/// <summary>
/// The data.
/// </summary>
Data
}
}

View File

@@ -28,10 +28,7 @@ namespace MediaBrowser.Model.Entities
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, string name)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
return instance.TryGetProviderId(name, out _);
}
@@ -56,10 +53,7 @@ namespace MediaBrowser.Model.Entities
/// <returns><c>true</c> if a provider id with the given name was found; otherwise <c>false</c>.</returns>
public static bool TryGetProviderId(this IHasProviderIds instance, string name, [NotNullWhen(true)] out string? id)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
if (instance.ProviderIds == null)
{
@@ -121,10 +115,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="value">The value.</param>
public static void SetProviderId(this IHasProviderIds instance, string name, string? value)
{
if (instance == null)
{
throw new ArgumentNullException(nameof(instance));
}
ArgumentNullException.ThrowIfNull(instance);
// If it's null remove the key from the dictionary
if (string.IsNullOrEmpty(value))

View File

@@ -1,18 +1,23 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum SeriesStatus.
/// The status of a series.
/// </summary>
public enum SeriesStatus
{
/// <summary>
/// The continuing.
/// The continuing status. This indicates that a series is currently releasing.
/// </summary>
Continuing,
/// <summary>
/// The ended.
/// The ended status. This indicates that a series has completed and is no longer being released.
/// </summary>
Ended
Ended,
/// <summary>
/// The unreleased status. This indicates that a series has not been released yet.
/// </summary>
Unreleased
}
}

View File

@@ -1,16 +0,0 @@
#pragma warning disable CS1591
using System.IO;
namespace MediaBrowser.Model.IO
{
/// <summary>
/// Interface IZipClient.
/// </summary>
public interface IZipClient
{
void ExtractAllFromGz(Stream source, string targetPath, bool overwriteExistingFiles);
void ExtractFirstFileFromGz(Stream source, string targetPath, string defaultFileName);
}
}

View File

@@ -8,6 +8,7 @@ namespace MediaBrowser.Model.LiveTv
public TunerHostInfo()
{
AllowHWTranscoding = true;
IgnoreDts = true;
}
public string Id { get; set; }
@@ -31,5 +32,7 @@ namespace MediaBrowser.Model.LiveTv
public int TunerCount { get; set; }
public string UserAgent { get; set; }
public bool IgnoreDts { get; set; }
}
}

View File

@@ -34,13 +34,13 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.3" />
<PackageReference Include="MimeTypes" Version="2.4.0">
<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="6.0.5" />
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>
<ItemGroup>

View File

@@ -100,7 +100,7 @@ namespace MediaBrowser.Model.Search
public BaseItemKind Type { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is folder.
/// Gets or sets a value indicating whether this instance is folder.
/// </summary>
/// <value><c>true</c> if this instance is folder; otherwise, <c>false</c>.</value>
public bool? IsFolder { get; set; }

View File

@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.SyncPlay
Idle = 0,
/// <summary>
/// The group is in wating state. Playback is paused. Will start playing when users are ready.
/// The group is in waiting state. Playback is paused. Will start playing when users are ready.
/// </summary>
Waiting = 1,

View File

@@ -22,7 +22,7 @@ namespace MediaBrowser.Model.Tasks
/// <summary>
/// Cancels if running and queue.
/// </summary>
/// <typeparam name="T">An implementatin of <see cref="IScheduledTask" />.</typeparam>
/// <typeparam name="T">An implementation of <see cref="IScheduledTask" />.</typeparam>
/// <param name="options">Task options.</param>
void CancelIfRunningAndQueue<T>(TaskOptions options)
where T : IScheduledTask;
@@ -30,21 +30,21 @@ namespace MediaBrowser.Model.Tasks
/// <summary>
/// Cancels if running and queue.
/// </summary>
/// <typeparam name="T">An implementatin of <see cref="IScheduledTask" />.</typeparam>
/// <typeparam name="T">An implementation of <see cref="IScheduledTask" />.</typeparam>
void CancelIfRunningAndQueue<T>()
where T : IScheduledTask;
/// <summary>
/// Cancels if running.
/// </summary>
/// <typeparam name="T">An implementatin of <see cref="IScheduledTask" />.</typeparam>
/// <typeparam name="T">An implementation of <see cref="IScheduledTask" />.</typeparam>
void CancelIfRunning<T>()
where T : IScheduledTask;
/// <summary>
/// Queues the scheduled task.
/// </summary>
/// <typeparam name="T">An implementatin of <see cref="IScheduledTask" />.</typeparam>
/// <typeparam name="T">An implementation of <see cref="IScheduledTask" />.</typeparam>
/// <param name="options">Task options.</param>
void QueueScheduledTask<T>(TaskOptions options)
where T : IScheduledTask;
@@ -52,7 +52,7 @@ namespace MediaBrowser.Model.Tasks
/// <summary>
/// Queues the scheduled task.
/// </summary>
/// <typeparam name="T">An implementatin of <see cref="IScheduledTask" />.</typeparam>
/// <typeparam name="T">An implementation of <see cref="IScheduledTask" />.</typeparam>
void QueueScheduledTask<T>()
where T : IScheduledTask;

View File

@@ -21,10 +21,10 @@ namespace MediaBrowser.Model.Tasks
/// <summary>
/// Stars waiting for the trigger action.
/// </summary>
/// <param name="lastResult">Result of the last run triggerd task.</param>
/// <param name="lastResult">Result of the last run triggered task.</param>
/// <param name="logger">The <see cref="ILogger"/>.</param>
/// <param name="taskName">The name of the task.</param>
/// <param name="isApplicationStartup">Wheter or not this is is fired during startup.</param>
/// <param name="isApplicationStartup">Whether or not this is is fired during startup.</param>
void Start(TaskResult? lastResult, ILogger logger, string taskName, bool isApplicationStartup);
/// <summary>