Merge remote-tracking branch 'upstream/master' into network-rewrite

This commit is contained in:
Shadowghost
2022-12-03 12:44:45 +01:00
276 changed files with 5507 additions and 9001 deletions

View File

@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Updates;
@@ -240,5 +241,23 @@ namespace MediaBrowser.Model.Configuration
/// Gets or sets a value indicating whether clients should be allowed to upload logs.
/// </summary>
public bool AllowClientLogUpload { get; set; } = true;
/// <summary>
/// Gets or sets the dummy chapters duration in seconds.
/// </summary>
/// <value>The dummy chapters duration.</value>
public int DummyChapterDuration { get; set; } = 300;
/// <summary>
/// Gets or sets the dummy chapter count.
/// </summary>
/// <value>The dummy chapter count.</value>
public int DummyChapterCount { get; set; } = 100;
/// <summary>
/// Gets or sets the chapter image resolution.
/// </summary>
/// <value>The chapter image resolution.</value>
public ImageResolution ChapterImageResolution { get; set; } = ImageResolution.MatchSource;
}
}

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;
}
@@ -587,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);
@@ -1057,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)
@@ -1088,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;
@@ -1122,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)
@@ -1179,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;
@@ -1239,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

@@ -0,0 +1,52 @@
namespace MediaBrowser.Model.Drawing;
/// <summary>
/// Enum ImageResolution.
/// </summary>
public enum ImageResolution
{
/// <summary>
/// MatchSource.
/// </summary>
MatchSource = 0,
/// <summary>
/// 144p.
/// </summary>
P144 = 1,
/// <summary>
/// 240p.
/// </summary>
P240 = 2,
/// <summary>
/// 360p.
/// </summary>
P360 = 3,
/// <summary>
/// 480p.
/// </summary>
P480 = 4,
/// <summary>
/// 720p.
/// </summary>
P720 = 5,
/// <summary>
/// 1080p.
/// </summary>
P1080 = 6,
/// <summary>
/// 1440p.
/// </summary>
P1440 = 7,
/// <summary>
/// 2160p.
/// </summary>
P2160 = 8
}

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; }

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>

View File

@@ -1,5 +1,3 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
/// <summary>
@@ -14,38 +12,78 @@ namespace MediaBrowser.Model.Entities
Custom = 0,
/// <summary>
/// The imdb.
/// The IMDb provider.
/// </summary>
Imdb = 2,
/// <summary>
/// The TMDB.
/// The TMDb provider.
/// </summary>
Tmdb = 3,
/// <summary>
/// The TVDB.
/// The TVDb provider.
/// </summary>
Tvdb = 4,
/// <summary>
/// The tvcom.
/// The tvcom providerd.
/// </summary>
Tvcom = 5,
/// <summary>
/// Tmdb Collection Id.
/// TMDb collection provider.
/// </summary>
TmdbCollection = 7,
/// <summary>
/// The MusicBrainz album provider.
/// </summary>
MusicBrainzAlbum = 8,
/// <summary>
/// The MusicBrainz album artist provider.
/// </summary>
MusicBrainzAlbumArtist = 9,
/// <summary>
/// The MusicBrainz artist provider.
/// </summary>
MusicBrainzArtist = 10,
/// <summary>
/// The MusicBrainz release group provider.
/// </summary>
MusicBrainzReleaseGroup = 11,
/// <summary>
/// The Zap2It provider.
/// </summary>
Zap2It = 12,
/// <summary>
/// The TvRage provider.
/// </summary>
TvRage = 15,
/// <summary>
/// The AudioDb artist provider.
/// </summary>
AudioDbArtist = 16,
/// <summary>
/// The AudioDb collection provider.
/// </summary>
AudioDbAlbum = 17,
/// <summary>
/// The MusicBrainz track provider.
/// </summary>
MusicBrainzTrack = 18,
/// <summary>
/// The TvMaze provider.
/// </summary>
TvMaze = 19
}
}

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

@@ -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.2" />
<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.6" />
<PackageReference Include="System.Text.Json" Version="6.0.7" />
</ItemGroup>
<ItemGroup>

View File

@@ -126,7 +126,7 @@ namespace MediaBrowser.Model.Querying
ProductionLocations,
/// <summary>
/// Imdb, tmdb, etc.
/// The ids from IMDb, TMDb, etc.
/// </summary>
ProviderIds,

View File

@@ -154,5 +154,10 @@ namespace MediaBrowser.Model.Querying
/// The similarity score.
/// </summary>
public const string SimilarityScore = "SimilarityScore";
/// <summary>
/// The search score.
/// </summary>
public const string SearchScore = "SearchScore";
}
}