Fix some warnings
This commit is contained in:
parent
68e7072698
commit
1c14c86b20
|
@ -569,7 +569,7 @@ namespace Emby.Dlna.PlayTo
|
|||
streamInfo.TargetVideoCodecTag,
|
||||
streamInfo.IsTargetAVC);
|
||||
|
||||
return list.Count == 0 ? null : list[0];
|
||||
return list.FirstOrDefault();
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -883,7 +883,7 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
private class StreamParams
|
||||
{
|
||||
private MediaSourceInfo mediaSource;
|
||||
private MediaSourceInfo _mediaSource;
|
||||
private IMediaSourceManager _mediaSourceManager;
|
||||
|
||||
public Guid ItemId { get; set; }
|
||||
|
@ -908,24 +908,22 @@ namespace Emby.Dlna.PlayTo
|
|||
|
||||
public async Task<MediaSourceInfo> GetMediaSource(CancellationToken cancellationToken)
|
||||
{
|
||||
if (mediaSource != null)
|
||||
if (_mediaSource != null)
|
||||
{
|
||||
return mediaSource;
|
||||
return _mediaSource;
|
||||
}
|
||||
|
||||
var hasMediaSources = Item as IHasMediaSources;
|
||||
|
||||
if (hasMediaSources == null)
|
||||
if (Item is not IHasMediaSources)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (_mediaSourceManager != null)
|
||||
{
|
||||
mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);
|
||||
_mediaSource = await _mediaSourceManager.GetMediaSource(Item, MediaSourceId, LiveStreamId, false, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return mediaSource;
|
||||
return _mediaSource;
|
||||
}
|
||||
|
||||
private static Guid GetItemId(string url)
|
||||
|
|
|
@ -5914,7 +5914,7 @@ AND Type = @InternalPersonType)");
|
|||
}
|
||||
}
|
||||
|
||||
public void SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken)
|
||||
public void SaveMediaStreams(Guid id, IReadOnlyList<MediaStream> streams, CancellationToken cancellationToken)
|
||||
{
|
||||
CheckDisposed();
|
||||
|
||||
|
@ -5946,7 +5946,7 @@ AND Type = @InternalPersonType)");
|
|||
}
|
||||
}
|
||||
|
||||
private void InsertMediaStreams(byte[] idBlob, List<MediaStream> streams, IDatabaseConnection db)
|
||||
private void InsertMediaStreams(byte[] idBlob, IReadOnlyList<MediaStream> streams, IDatabaseConnection db)
|
||||
{
|
||||
const int Limit = 10;
|
||||
var startIndex = 0;
|
||||
|
|
|
@ -581,7 +581,7 @@ namespace Emby.Server.Implementations.IO
|
|||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public virtual List<FileSystemMetadata> GetDrives()
|
||||
public virtual IEnumerable<FileSystemMetadata> GetDrives()
|
||||
{
|
||||
// check for ready state to avoid waiting for drives to timeout
|
||||
// some drives on linux have no actual size or are used for other purposes
|
||||
|
@ -595,7 +595,7 @@ namespace Emby.Server.Implementations.IO
|
|||
Name = d.Name,
|
||||
FullName = d.RootDirectory.FullName,
|
||||
IsDirectory = true
|
||||
}).ToList();
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
|
|
@ -344,7 +344,7 @@ namespace Emby.Server.Implementations.Library
|
|||
return sources;
|
||||
}
|
||||
|
||||
private string[] NormalizeLanguage(string language)
|
||||
private IReadOnlyList<string> NormalizeLanguage(string language)
|
||||
{
|
||||
if (string.IsNullOrEmpty(language))
|
||||
{
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#nullable disable
|
||||
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
|
@ -13,39 +11,24 @@ namespace Emby.Server.Implementations.Library
|
|||
{
|
||||
public static class MediaStreamSelector
|
||||
{
|
||||
public static int? GetDefaultAudioStreamIndex(List<MediaStream> streams, string[] preferredLanguages, bool preferDefaultTrack)
|
||||
public static int? GetDefaultAudioStreamIndex(IReadOnlyList<MediaStream> streams, IReadOnlyList<string> preferredLanguages, bool preferDefaultTrack)
|
||||
{
|
||||
streams = GetSortedStreams(streams, MediaStreamType.Audio, preferredLanguages)
|
||||
.ToList();
|
||||
var sortedStreams = GetSortedStreams(streams, MediaStreamType.Audio, preferredLanguages);
|
||||
|
||||
if (preferDefaultTrack)
|
||||
{
|
||||
var defaultStream = streams.FirstOrDefault(i => i.IsDefault);
|
||||
|
||||
if (defaultStream != null)
|
||||
{
|
||||
return defaultStream.Index;
|
||||
}
|
||||
return sortedStreams.FirstOrDefault(i => i.IsDefault)?.Index;
|
||||
}
|
||||
|
||||
var stream = streams.FirstOrDefault();
|
||||
|
||||
if (stream != null)
|
||||
{
|
||||
return stream.Index;
|
||||
}
|
||||
|
||||
return null;
|
||||
return sortedStreams.FirstOrDefault()?.Index;
|
||||
}
|
||||
|
||||
public static int? GetDefaultSubtitleStreamIndex(
|
||||
IEnumerable<MediaStream> streams,
|
||||
string[] preferredLanguages,
|
||||
IReadOnlyList<string> preferredLanguages,
|
||||
SubtitlePlaybackMode mode,
|
||||
string audioTrackLanguage)
|
||||
{
|
||||
MediaStream stream = null;
|
||||
|
||||
if (mode == SubtitlePlaybackMode.None)
|
||||
{
|
||||
return null;
|
||||
|
@ -59,6 +42,7 @@ namespace Emby.Server.Implementations.Library
|
|||
.ThenByDescending(x => x.IsDefault)
|
||||
.ToList();
|
||||
|
||||
MediaStream? stream = null;
|
||||
if (mode == SubtitlePlaybackMode.Default)
|
||||
{
|
||||
// Prefer embedded metadata over smart logic
|
||||
|
@ -95,26 +79,27 @@ namespace Emby.Server.Implementations.Library
|
|||
return stream?.Index;
|
||||
}
|
||||
|
||||
private static IEnumerable<MediaStream> GetSortedStreams(IEnumerable<MediaStream> streams, MediaStreamType type, string[] languagePreferences)
|
||||
private static IEnumerable<MediaStream> GetSortedStreams(IEnumerable<MediaStream> streams, MediaStreamType type, IReadOnlyList<string> languagePreferences)
|
||||
{
|
||||
// Give some preference to external text subs for better performance
|
||||
return streams.Where(i => i.Type == type)
|
||||
return streams
|
||||
.Where(i => i.Type == type)
|
||||
.OrderBy(i =>
|
||||
{
|
||||
var index = FindIndex(languagePreferences, i.Language);
|
||||
{
|
||||
var index = languagePreferences.FindIndex(x => string.Equals(x, i.Language, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
return index == -1 ? 100 : index;
|
||||
})
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsDefault))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.SupportsExternalStream))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsTextSubtitleStream))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsExternal))
|
||||
.ThenBy(i => i.Index);
|
||||
return index == -1 ? 100 : index;
|
||||
})
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsDefault))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.SupportsExternalStream))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsTextSubtitleStream))
|
||||
.ThenBy(i => GetBooleanOrderBy(i.IsExternal))
|
||||
.ThenBy(i => i.Index);
|
||||
}
|
||||
|
||||
public static void SetSubtitleStreamScores(
|
||||
List<MediaStream> streams,
|
||||
string[] preferredLanguages,
|
||||
IReadOnlyList<MediaStream> streams,
|
||||
IReadOnlyList<string> preferredLanguages,
|
||||
SubtitlePlaybackMode mode,
|
||||
string audioTrackLanguage)
|
||||
{
|
||||
|
@ -123,15 +108,14 @@ namespace Emby.Server.Implementations.Library
|
|||
return;
|
||||
}
|
||||
|
||||
streams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages)
|
||||
.ToList();
|
||||
var sortedStreams = GetSortedStreams(streams, MediaStreamType.Subtitle, preferredLanguages);
|
||||
|
||||
var filteredStreams = new List<MediaStream>();
|
||||
|
||||
if (mode == SubtitlePlaybackMode.Default)
|
||||
{
|
||||
// Prefer embedded metadata over smart logic
|
||||
filteredStreams = streams.Where(s => s.IsForced || s.IsDefault)
|
||||
filteredStreams = sortedStreams.Where(s => s.IsForced || s.IsDefault)
|
||||
.ToList();
|
||||
}
|
||||
else if (mode == SubtitlePlaybackMode.Smart)
|
||||
|
@ -139,54 +123,37 @@ namespace Emby.Server.Implementations.Library
|
|||
// Prefer smart logic over embedded metadata
|
||||
if (!preferredLanguages.Contains(audioTrackLanguage, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
filteredStreams = streams.Where(s => !s.IsForced && preferredLanguages.Contains(s.Language, StringComparison.OrdinalIgnoreCase))
|
||||
filteredStreams = sortedStreams.Where(s => !s.IsForced && preferredLanguages.Contains(s.Language, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
else if (mode == SubtitlePlaybackMode.Always)
|
||||
{
|
||||
// always load the most suitable full subtitles
|
||||
filteredStreams = streams.Where(s => !s.IsForced)
|
||||
.ToList();
|
||||
filteredStreams = sortedStreams.Where(s => !s.IsForced).ToList();
|
||||
}
|
||||
else if (mode == SubtitlePlaybackMode.OnlyForced)
|
||||
{
|
||||
// always load the most suitable full subtitles
|
||||
filteredStreams = streams.Where(s => s.IsForced).ToList();
|
||||
filteredStreams = sortedStreams.Where(s => s.IsForced).ToList();
|
||||
}
|
||||
|
||||
// load forced subs if we have found no suitable full subtitles
|
||||
if (filteredStreams.Count == 0)
|
||||
{
|
||||
filteredStreams = streams
|
||||
.Where(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase))
|
||||
.ToList();
|
||||
}
|
||||
var iterStreams = filteredStreams.Count == 0
|
||||
? sortedStreams.Where(s => s.IsForced && string.Equals(s.Language, audioTrackLanguage, StringComparison.OrdinalIgnoreCase))
|
||||
: filteredStreams;
|
||||
|
||||
foreach (var stream in filteredStreams)
|
||||
foreach (var stream in iterStreams)
|
||||
{
|
||||
stream.Score = GetSubtitleScore(stream, preferredLanguages);
|
||||
}
|
||||
}
|
||||
|
||||
private static int FindIndex(string[] list, string value)
|
||||
{
|
||||
for (var i = 0; i < list.Length; i++)
|
||||
{
|
||||
if (string.Equals(list[i], value, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private static int GetSubtitleScore(MediaStream stream, string[] languagePreferences)
|
||||
private static int GetSubtitleScore(MediaStream stream, IReadOnlyList<string> languagePreferences)
|
||||
{
|
||||
var values = new List<int>();
|
||||
|
||||
var index = FindIndex(languagePreferences, stream.Language);
|
||||
var index = languagePreferences.FindIndex(x => string.Equals(x, stream.Language, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
values.Add(index == -1 ? 0 : 100 - index);
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
{
|
||||
if (isVideo)
|
||||
{
|
||||
mediaSource.MediaStreams.AddRange(new List<MediaStream>
|
||||
mediaSource.MediaStreams = new MediaStream[]
|
||||
{
|
||||
new MediaStream
|
||||
{
|
||||
|
@ -329,11 +329,11 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
// Set the index to -1 because we don't know the exact index of the audio stream within the container
|
||||
Index = -1
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
mediaSource.MediaStreams.AddRange(new List<MediaStream>
|
||||
mediaSource.MediaStreams = new MediaStream[]
|
||||
{
|
||||
new MediaStream
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ namespace Emby.Server.Implementations.LiveTv
|
|||
// Set the index to -1 because we don't know the exact index of the audio stream within the container
|
||||
Index = -1
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -446,7 +446,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
|
|||
{
|
||||
Path = url,
|
||||
Protocol = MediaProtocol.Udp,
|
||||
MediaStreams = new List<MediaStream>
|
||||
MediaStreams = new MediaStream[]
|
||||
{
|
||||
new MediaStream
|
||||
{
|
||||
|
|
|
@ -170,7 +170,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
|||
{
|
||||
Path = path,
|
||||
Protocol = protocol,
|
||||
MediaStreams = new List<MediaStream>
|
||||
MediaStreams = new MediaStream[]
|
||||
{
|
||||
new MediaStream
|
||||
{
|
||||
|
|
|
@ -147,13 +147,7 @@ namespace Emby.Server.Implementations.Localization
|
|||
threeletterNames = new[] { parts[0], parts[1] };
|
||||
}
|
||||
|
||||
list.Add(new CultureDto
|
||||
{
|
||||
DisplayName = name,
|
||||
Name = name,
|
||||
ThreeLetterISOLanguageNames = threeletterNames,
|
||||
TwoLetterISOLanguageName = twoCharName
|
||||
});
|
||||
list.Add(new CultureDto(name, name, twoCharName, threeletterNames));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -121,11 +121,7 @@ namespace Jellyfin.Api.Controllers
|
|||
IsSports = isSports
|
||||
});
|
||||
|
||||
return new SearchHintResult
|
||||
{
|
||||
TotalRecordCount = result.TotalRecordCount,
|
||||
SearchHints = result.Items.Select(GetSearchHintResult).ToArray()
|
||||
};
|
||||
return new SearchHintResult(result.Items.Select(GetSearchHintResult).ToArray(), result.TotalRecordCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace MediaBrowser.Controller.LiveTv
|
|||
{
|
||||
Id = Id.ToString("N", CultureInfo.InvariantCulture),
|
||||
Protocol = PathProtocol ?? MediaProtocol.File,
|
||||
MediaStreams = new List<MediaStream>(),
|
||||
MediaStreams = Array.Empty<MediaStream>(),
|
||||
Name = Name,
|
||||
Path = Path,
|
||||
RunTimeTicks = RunTimeTicks,
|
||||
|
|
|
@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Persistence
|
|||
/// <param name="id">The identifier.</param>
|
||||
/// <param name="streams">The streams.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SaveMediaStreams(Guid id, List<MediaStream> streams, CancellationToken cancellationToken);
|
||||
void SaveMediaStreams(Guid id, IReadOnlyList<MediaStream> streams, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the media attachments.
|
||||
|
|
|
@ -115,7 +115,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
return "DLNA.ORG_PN=" + orgPn + orgOp + orgCi + dlnaflags;
|
||||
}
|
||||
|
||||
public static List<string> BuildVideoHeader(
|
||||
public static IEnumerable<string> BuildVideoHeader(
|
||||
DeviceProfile profile,
|
||||
string container,
|
||||
string videoCodec,
|
||||
|
|
|
@ -675,7 +675,7 @@ namespace MediaBrowser.Model.Dlna
|
|||
return string.Format(CultureInfo.InvariantCulture, "{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
|
||||
}
|
||||
|
||||
private static List<NameValuePair> BuildParams(StreamInfo item, string accessToken)
|
||||
private static IEnumerable<NameValuePair> BuildParams(StreamInfo item, string accessToken)
|
||||
{
|
||||
var list = new List<NameValuePair>();
|
||||
|
||||
|
@ -805,34 +805,12 @@ namespace MediaBrowser.Model.Dlna
|
|||
return list;
|
||||
}
|
||||
|
||||
public List<SubtitleStreamInfo> GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, string baseUrl, string accessToken)
|
||||
{
|
||||
return GetExternalSubtitles(transcoderSupport, includeSelectedTrackOnly, false, baseUrl, accessToken);
|
||||
}
|
||||
|
||||
public List<SubtitleStreamInfo> GetExternalSubtitles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken)
|
||||
{
|
||||
var list = GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, enableAllProfiles, baseUrl, accessToken);
|
||||
var newList = new List<SubtitleStreamInfo>();
|
||||
|
||||
// First add the selected track
|
||||
foreach (SubtitleStreamInfo stream in list)
|
||||
{
|
||||
if (stream.DeliveryMethod == SubtitleDeliveryMethod.External)
|
||||
{
|
||||
newList.Add(stream);
|
||||
}
|
||||
}
|
||||
|
||||
return newList;
|
||||
}
|
||||
|
||||
public List<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, string baseUrl, string accessToken)
|
||||
public IEnumerable<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, string baseUrl, string accessToken)
|
||||
{
|
||||
return GetSubtitleProfiles(transcoderSupport, includeSelectedTrackOnly, false, baseUrl, accessToken);
|
||||
}
|
||||
|
||||
public List<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken)
|
||||
public IEnumerable<SubtitleStreamInfo> GetSubtitleProfiles(ITranscoderSupport transcoderSupport, bool includeSelectedTrackOnly, bool enableAllProfiles, string baseUrl, string accessToken)
|
||||
{
|
||||
var list = new List<SubtitleStreamInfo>();
|
||||
|
||||
|
|
|
@ -63,10 +63,10 @@ namespace MediaBrowser.Model.Dto
|
|||
public int PrimaryImageWidth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the custom prefs.
|
||||
/// Gets the custom prefs.
|
||||
/// </summary>
|
||||
/// <value>The custom prefs.</value>
|
||||
public Dictionary<string, string?> CustomPrefs { get; set; }
|
||||
public Dictionary<string, string?> CustomPrefs { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the scroll direction.
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dto
|
|||
public MediaSourceInfo()
|
||||
{
|
||||
Formats = Array.Empty<string>();
|
||||
MediaStreams = new List<MediaStream>();
|
||||
MediaStreams = Array.Empty<MediaStream>();
|
||||
MediaAttachments = Array.Empty<MediaAttachment>();
|
||||
RequiredHttpHeaders = new Dictionary<string, string>();
|
||||
SupportsTranscoding = true;
|
||||
|
@ -88,7 +88,7 @@ namespace MediaBrowser.Model.Dto
|
|||
|
||||
public Video3DFormat? Video3DFormat { get; set; }
|
||||
|
||||
public List<MediaStream> MediaStreams { get; set; }
|
||||
public IReadOnlyList<MediaStream> MediaStreams { get; set; }
|
||||
|
||||
public IReadOnlyList<MediaAttachment> MediaAttachments { get; set; }
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Globalization;
|
||||
using MediaBrowser.Model.Providers;
|
||||
|
@ -19,16 +19,16 @@ namespace MediaBrowser.Model.Dto
|
|||
ContentTypeOptions = Array.Empty<NameValuePair>();
|
||||
}
|
||||
|
||||
public ParentalRating[] ParentalRatingOptions { get; set; }
|
||||
public IReadOnlyList<ParentalRating> ParentalRatingOptions { get; set; }
|
||||
|
||||
public CountryInfo[] Countries { get; set; }
|
||||
public IReadOnlyList<CountryInfo> Countries { get; set; }
|
||||
|
||||
public CultureDto[] Cultures { get; set; }
|
||||
public IReadOnlyList<CultureDto> Cultures { get; set; }
|
||||
|
||||
public ExternalIdInfo[] ExternalIdInfos { get; set; }
|
||||
public IReadOnlyList<ExternalIdInfo> ExternalIdInfos { get; set; }
|
||||
|
||||
public string ContentType { get; set; }
|
||||
public string? ContentType { get; set; }
|
||||
|
||||
public NameValuePair[] ContentTypeOptions { get; set; }
|
||||
public IReadOnlyList<NameValuePair> ContentTypeOptions { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#nullable disable
|
||||
#pragma warning disable CS1591
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Globalization
|
||||
{
|
||||
|
@ -10,39 +9,42 @@ namespace MediaBrowser.Model.Globalization
|
|||
/// </summary>
|
||||
public class CultureDto
|
||||
{
|
||||
public CultureDto()
|
||||
public CultureDto(string name, string displayName, string twoLetterISOLanguageName, IReadOnlyList<string> threeLetterISOLanguageNames)
|
||||
{
|
||||
ThreeLetterISOLanguageNames = Array.Empty<string>();
|
||||
Name = name;
|
||||
DisplayName = displayName;
|
||||
TwoLetterISOLanguageName = twoLetterISOLanguageName;
|
||||
ThreeLetterISOLanguageNames = threeLetterISOLanguageNames;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// Gets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the display name.
|
||||
/// Gets the display name.
|
||||
/// </summary>
|
||||
/// <value>The display name.</value>
|
||||
public string DisplayName { get; set; }
|
||||
public string DisplayName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the two letter ISO language.
|
||||
/// Gets the name of the two letter ISO language.
|
||||
/// </summary>
|
||||
/// <value>The name of the two letter ISO language.</value>
|
||||
public string TwoLetterISOLanguageName { get; set; }
|
||||
public string TwoLetterISOLanguageName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the three letter ISO language.
|
||||
/// </summary>
|
||||
/// <value>The name of the three letter ISO language.</value>
|
||||
public string ThreeLetterISOLanguageName
|
||||
public string? ThreeLetterISOLanguageName
|
||||
{
|
||||
get
|
||||
{
|
||||
var vals = ThreeLetterISOLanguageNames;
|
||||
if (vals.Length > 0)
|
||||
if (vals.Count > 0)
|
||||
{
|
||||
return vals[0];
|
||||
}
|
||||
|
@ -51,6 +53,6 @@ namespace MediaBrowser.Model.Globalization
|
|||
}
|
||||
}
|
||||
|
||||
public string[] ThreeLetterISOLanguageNames { get; set; }
|
||||
public IReadOnlyList<string> ThreeLetterISOLanguageNames { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,6 +199,6 @@ namespace MediaBrowser.Model.IO
|
|||
|
||||
void SetAttributes(string path, bool isHidden, bool readOnly);
|
||||
|
||||
List<FileSystemMetadata> GetDrives();
|
||||
IEnumerable<FileSystemMetadata> GetDrives();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#nullable disable
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Model.Search
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -7,15 +8,26 @@ namespace MediaBrowser.Model.Search
|
|||
public class SearchHintResult
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the search hints.
|
||||
/// Initializes a new instance of the <see cref="SearchHintResult" /> class.
|
||||
/// </summary>
|
||||
/// <value>The search hints.</value>
|
||||
public SearchHint[] SearchHints { get; set; }
|
||||
/// <param name="searchHints">The search hints.</param>
|
||||
/// <param name="totalRecordCount">The total record count.</param>
|
||||
public SearchHintResult(IReadOnlyList<SearchHint> searchHints, int totalRecordCount)
|
||||
{
|
||||
SearchHints = searchHints;
|
||||
TotalRecordCount = totalRecordCount;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the total record count.
|
||||
/// Gets the search hints.
|
||||
/// </summary>
|
||||
/// <value>The search hints.</value>
|
||||
public IReadOnlyList<SearchHint> SearchHints { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total record count.
|
||||
/// </summary>
|
||||
/// <value>The total record count.</value>
|
||||
public int TotalRecordCount { get; set; }
|
||||
public int TotalRecordCount { get; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
protected void Fetch(Audio audio, Model.MediaInfo.MediaInfo mediaInfo, CancellationToken cancellationToken)
|
||||
{
|
||||
var mediaStreams = mediaInfo.MediaStreams;
|
||||
|
||||
audio.Container = mediaInfo.Container;
|
||||
audio.TotalBitrate = mediaInfo.Bitrate;
|
||||
|
||||
|
@ -97,7 +95,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
|
||||
FetchDataFromTags(audio, mediaInfo);
|
||||
|
||||
_itemRepo.SaveMediaStreams(audio.Id, mediaStreams, cancellationToken);
|
||||
_itemRepo.SaveMediaStreams(audio.Id, mediaInfo.MediaStreams, cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
|
||||
if (mediaInfo != null)
|
||||
{
|
||||
mediaStreams = mediaInfo.MediaStreams;
|
||||
mediaStreams = mediaInfo.MediaStreams.ToList();
|
||||
mediaAttachments = mediaInfo.MediaAttachments;
|
||||
|
||||
video.TotalBitrate = mediaInfo.Bitrate;
|
||||
|
@ -202,7 +202,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
|
||||
video.Container = mediaInfo.Container;
|
||||
|
||||
chapters = mediaInfo.Chapters == null ? Array.Empty<ChapterInfo>() : mediaInfo.Chapters;
|
||||
chapters = mediaInfo.Chapters ?? Array.Empty<ChapterInfo>();
|
||||
if (blurayInfo != null)
|
||||
{
|
||||
FetchBdInfo(video, ref chapters, mediaStreams, blurayInfo);
|
||||
|
@ -246,7 +246,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
video.Height = videoStream?.Height ?? 0;
|
||||
video.Width = videoStream?.Width ?? 0;
|
||||
|
||||
video.DefaultVideoStreamIndex = videoStream == null ? (int?)null : videoStream.Index;
|
||||
video.DefaultVideoStreamIndex = videoStream?.Index;
|
||||
|
||||
video.HasSubtitles = mediaStreams.Any(i => i.Type == MediaStreamType.Subtitle);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user