Remove "download images in advance" option

This commit is contained in:
ferferga
2020-10-19 17:28:07 +02:00
1641 changed files with 58910 additions and 57032 deletions

View File

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

View File

@@ -1,10 +1,10 @@
#pragma warning disable CS1591
using System;
using System.Linq;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Model.Events;
using Jellyfin.Data.Events;
using Jellyfin.Data.Queries;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity
@@ -13,15 +13,8 @@ namespace MediaBrowser.Model.Activity
{
event EventHandler<GenericEventArgs<ActivityLogEntry>> EntryCreated;
void Create(ActivityLog entry);
Task CreateAsync(ActivityLog entry);
QueryResult<ActivityLogEntry> GetPagedResult(int? startIndex, int? limit);
QueryResult<ActivityLogEntry> GetPagedResult(
Func<IQueryable<ActivityLog>, IQueryable<ActivityLog>> func,
int? startIndex,
int? limit);
Task<QueryResult<ActivityLogEntry>> GetPagedResultAsync(ActivityLogQuery query);
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.ApiClient

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Branding

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -37,7 +38,7 @@ namespace MediaBrowser.Model.Channels
public ChannelMediaContentType[] ContentTypes { get; set; }
/// <summary>
/// Represents the maximum number of records the channel allows retrieving at a time
/// Represents the maximum number of records the channel allows retrieving at a time.
/// </summary>
public int? MaxPageSize { get; set; }

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Channels

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -9,12 +10,15 @@ namespace MediaBrowser.Model.Channels
public class ChannelQuery
{
/// <summary>
/// Fields to return within the items, in addition to basic information
/// Fields to return within the items, in addition to basic information.
/// </summary>
/// <value>The fields.</value>
public ItemFields[] Fields { get; set; }
public bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[] EnableImageTypes { get; set; }
/// <summary>
@@ -30,7 +34,7 @@ namespace MediaBrowser.Model.Channels
public int? StartIndex { get; set; }
/// <summary>
/// The maximum number of items to return
/// The maximum number of items to return.
/// </summary>
/// <value>The limit.</value>
public int? Limit { get; set; }
@@ -48,7 +52,9 @@ namespace MediaBrowser.Model.Channels
/// </summary>
/// <value><c>null</c> if [is favorite] contains no value, <c>true</c> if [is favorite]; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; }
public bool? IsRecordingsFolder { get; set; }
public bool RefreshLatestChannelItems { get; set; }
}
}

View File

@@ -1,3 +1,5 @@
using Jellyfin.Data.Enums;
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration

View File

@@ -1,3 +1,4 @@
#nullable disable
using System;
using System.Xml.Serialization;
@@ -11,7 +12,15 @@ namespace MediaBrowser.Model.Configuration
public class BaseApplicationConfiguration
{
/// <summary>
/// The number of days we should retain log files
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
LogFileRetentionDays = 3;
}
/// <summary>
/// Gets or sets the number of days we should retain log files.
/// </summary>
/// <value>The log file retention days.</value>
public int LogFileRetentionDays { get; set; }
@@ -29,29 +38,27 @@ namespace MediaBrowser.Model.Configuration
public string CachePath { get; set; }
/// <summary>
/// Last known version that was ran using the configuration.
/// Gets or sets the last known version that was ran using the configuration.
/// </summary>
/// <value>The version from previous run.</value>
[XmlIgnore]
public Version PreviousVersion { get; set; }
/// <summary>
/// Stringified PreviousVersion to be stored/loaded,
/// because System.Version itself isn't xml-serializable
/// Gets or sets the stringified PreviousVersion to be stored/loaded,
/// because System.Version itself isn't xml-serializable.
/// </summary>
/// <value>String value of PreviousVersion</value>
/// <value>String value of PreviousVersion.</value>
public string PreviousVersionStr
{
get => PreviousVersion?.ToString();
set => PreviousVersion = Version.Parse(value);
}
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
LogFileRetentionDays = 3;
set
{
if (Version.TryParse(value, out var version))
{
PreviousVersion = version;
}
}
}
}
}

View File

@@ -1,18 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public enum DynamicDayOfWeek
{
Sunday = 0,
Monday = 1,
Tuesday = 2,
Wednesday = 3,
Thursday = 4,
Friday = 5,
Saturday = 6,
Everyday = 7,
Weekday = 8,
Weekend = 9
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
@@ -5,10 +6,17 @@ namespace MediaBrowser.Model.Configuration
public class EncodingOptions
{
public int EncodingThreadCount { get; set; }
public string TranscodingTempPath { get; set; }
public double DownMixAudioBoost { get; set; }
public int MaxMuxingQueueSize { get; set; }
public bool EnableThrottling { get; set; }
public int ThrottleDelaySeconds { get; set; }
public string HardwareAccelerationType { get; set; }
/// <summary>
@@ -20,12 +28,41 @@ namespace MediaBrowser.Model.Configuration
/// The current FFmpeg path being used by the system and displayed on the transcode page.
/// </summary>
public string EncoderAppPathDisplay { get; set; }
public string VaapiDevice { get; set; }
public string OpenclDevice { get; set; }
public bool EnableTonemapping { get; set; }
public string TonemappingAlgorithm { get; set; }
public string TonemappingRange { get; set; }
public double TonemappingDesat { get; set; }
public double TonemappingThreshold { get; set; }
public double TonemappingPeak { get; set; }
public double TonemappingParam { get; set; }
public int H264Crf { get; set; }
public int H265Crf { get; set; }
public string EncoderPreset { get; set; }
public bool DeinterlaceDoubleRate { get; set; }
public string DeinterlaceMethod { get; set; }
public bool EnableDecodingColorDepth10Hevc { get; set; }
public bool EnableDecodingColorDepth10Vp9 { get; set; }
public bool EnableHardwareEncoding { get; set; }
public bool EnableSubtitleExtraction { get; set; }
public string[] HardwareDecodingCodecs { get; set; }
@@ -33,14 +70,29 @@ namespace MediaBrowser.Model.Configuration
public EncodingOptions()
{
DownMixAudioBoost = 2;
MaxMuxingQueueSize = 2048;
EnableThrottling = false;
ThrottleDelaySeconds = 180;
EncodingThreadCount = -1;
// This is a DRM device that is almost guaranteed to be there on every intel platform, plus it's the default one in ffmpeg if you don't specify anything
// This is a DRM device that is almost guaranteed to be there on every intel platform,
// plus it's the default one in ffmpeg if you don't specify anything
VaapiDevice = "/dev/dri/renderD128";
// This is the OpenCL device that is used for tonemapping.
// The left side of the dot is the platform number, and the right side is the device number on the platform.
OpenclDevice = "0.0";
EnableTonemapping = false;
TonemappingAlgorithm = "reinhard";
TonemappingRange = "auto";
TonemappingDesat = 0;
TonemappingThreshold = 0.8;
TonemappingPeak = 0;
TonemappingParam = 0;
H264Crf = 23;
H265Crf = 28;
DeinterlaceDoubleRate = false;
DeinterlaceMethod = "yadif";
EnableDecodingColorDepth10Hevc = true;
EnableDecodingColorDepth10Vp9 = true;
EnableHardwareEncoding = true;
EnableSubtitleExtraction = true;
HardwareDecodingCodecs = new string[] { "h264", "vc1" };

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -9,16 +10,23 @@ namespace MediaBrowser.Model.Configuration
public class LibraryOptions
{
public bool EnablePhotos { get; set; }
public bool EnableRealtimeMonitor { get; set; }
public bool EnableChapterImageExtraction { get; set; }
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
public MediaPathInfo[] PathInfos { get; set; }
public bool SaveLocalMetadata { get; set; }
public bool EnableInternetProviders { get; set; }
public bool ImportMissingEpisodes { get; set; }
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableEmbeddedTitles { get; set; }
public bool EnableEmbeddedEpisodeInfos { get; set; }
public int AutomaticRefreshIntervalDays { get; set; }
@@ -36,17 +44,25 @@ namespace MediaBrowser.Model.Configuration
public string MetadataCountryCode { get; set; }
public string SeasonZeroDisplayName { get; set; }
public string[] MetadataSavers { get; set; }
public string[] DisabledLocalMetadataReaders { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledSubtitleFetchers { get; set; }
public string[] SubtitleFetcherOrder { get; set; }
public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; }
public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
public string[] SubtitleDownloadLanguages { get; set; }
public bool RequirePerfectSubtitleMatch { get; set; }
public bool SaveSubtitlesWithMedia { get; set; }
public TypeOptions[] TypeOptions { get; set; }
@@ -87,17 +103,22 @@ namespace MediaBrowser.Model.Configuration
public class MediaPathInfo
{
public string Path { get; set; }
public string NetworkPath { get; set; }
}
public class TypeOptions
{
public string Type { get; set; }
public string[] MetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] ImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
public ImageOption[] ImageOptions { get; set; }
public ImageOption GetImageOptions(ImageType type)

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -12,12 +13,15 @@ namespace MediaBrowser.Model.Configuration
public string ItemType { get; set; }
public string[] DisabledMetadataSavers { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledMetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] DisabledImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
public MetadataOptions()

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration

View File

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

View File

@@ -3,7 +3,7 @@
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Enum MetadataPluginType
/// Enum MetadataPluginType.
/// </summary>
public enum MetadataPluginType
{

View File

@@ -1,7 +1,10 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Updates;
namespace MediaBrowser.Model.Configuration
{
@@ -75,12 +78,13 @@ namespace MediaBrowser.Model.Configuration
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
public bool IsPortAuthorized { get; set; }
public bool AutoRunWebApp { get; set; }
/// <summary>
/// Gets or sets if quick connect is available for use on this server.
/// </summary>
public bool QuickConnectAvailable { get; set; }
public bool EnableRemoteAccess { get; set; }
public bool CollectionsUpgraded { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [enable case sensitive item ids].
/// </summary>
@@ -110,19 +114,19 @@ namespace MediaBrowser.Model.Configuration
public string MetadataCountryCode { get; set; }
/// <summary>
/// Characters to be replaced with a ' ' in strings to create a sort name
/// Characters to be replaced with a ' ' in strings to create a sort name.
/// </summary>
/// <value>The sort replace characters.</value>
public string[] SortReplaceCharacters { get; set; }
/// <summary>
/// Characters to be removed from strings to create a sort name
/// Characters to be removed from strings to create a sort name.
/// </summary>
/// <value>The sort remove characters.</value>
public string[] SortRemoveCharacters { get; set; }
/// <summary>
/// Words to be removed from strings to create a sort name
/// Words to be removed from strings to create a sort name.
/// </summary>
/// <value>The sort remove words.</value>
public string[] SortRemoveWords { get; set; }
@@ -160,12 +164,6 @@ namespace MediaBrowser.Model.Configuration
/// <value><c>true</c> if [enable dashboard response caching]; otherwise, <c>false</c>.</value>
public bool EnableDashboardResponseCaching { get; set; }
/// <summary>
/// Gets or sets a custom path to serve the dashboard from.
/// </summary>
/// <value>The dashboard source path, or null if the default path should be used.</value>
public string DashboardSourcePath { get; set; }
/// <summary>
/// Gets or sets the image saving convention.
/// </summary>
@@ -228,6 +226,8 @@ namespace MediaBrowser.Model.Configuration
public string[] CodecsUsed { get; set; }
public List<RepositoryInfo> PluginRepositories { get; set; }
public bool IgnoreVirtualInterfaces { get; set; }
public bool EnableExternalContentInSuggestions { get; set; }
@@ -240,15 +240,37 @@ namespace MediaBrowser.Model.Configuration
public bool EnableNewOmdbSupport { get; set; }
public string[] RemoteIPFilter { get; set; }
public bool IsRemoteIPFilterBlacklist { get; set; }
public int ImageExtractionTimeoutMs { get; set; }
public PathSubstitution[] PathSubstitutions { get; set; }
public bool EnableSimpleArtistDetection { get; set; }
public string[] UninstalledPlugins { get; set; }
/// <summary>
/// Gets or sets a value indicating whether slow server responses should be logged as a warning.
/// </summary>
public bool EnableSlowResponseWarning { get; set; }
/// <summary>
/// Gets or sets the threshold for the slow response time warning in ms.
/// </summary>
public long SlowResponseThresholdMs { get; set; }
/// <summary>
/// Gets or sets the cors hosts.
/// </summary>
public string[] CorsHosts { get; set; }
/// <summary>
/// Gets or sets the known proxies.
/// </summary>
public string[] KnownProxies { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@@ -262,6 +284,9 @@ namespace MediaBrowser.Model.Configuration
PathSubstitutions = Array.Empty<PathSubstitution>();
IgnoreVirtualInterfaces = false;
EnableSimpleArtistDetection = false;
SkipDeserializationForBasicTypes = true;
PluginRepositories = new List<RepositoryInfo>();
DisplaySpecialsWithinSeasons = true;
EnableExternalContentInSuggestions = true;
@@ -275,9 +300,12 @@ namespace MediaBrowser.Model.Configuration
EnableHttps = false;
EnableDashboardResponseCaching = true;
EnableCaseSensitiveItemIds = true;
EnableNormalizedItemByNameIds = true;
DisableLiveTvChannelUserDataName = true;
EnableNewOmdbSupport = true;
AutoRunWebApp = true;
EnableRemoteAccess = true;
QuickConnectAvailable = false;
EnableUPnP = false;
MinResumePct = 5;
@@ -313,24 +341,24 @@ namespace MediaBrowser.Model.Configuration
new MetadataOptions
{
ItemType = "MusicVideo",
DisabledMetadataFetchers = new [] { "The Open Movie Database" },
DisabledImageFetchers = new [] { "The Open Movie Database" }
DisabledMetadataFetchers = new[] { "The Open Movie Database" },
DisabledImageFetchers = new[] { "The Open Movie Database" }
},
new MetadataOptions
{
ItemType = "Series",
DisabledMetadataFetchers = new [] { "TheMovieDb" },
DisabledImageFetchers = new [] { "TheMovieDb" }
DisabledMetadataFetchers = new[] { "TheMovieDb" },
DisabledImageFetchers = new[] { "TheMovieDb" }
},
new MetadataOptions
{
ItemType = "MusicAlbum",
DisabledMetadataFetchers = new [] { "TheAudioDB" }
DisabledMetadataFetchers = new[] { "TheAudioDB" }
},
new MetadataOptions
{
ItemType = "MusicArtist",
DisabledMetadataFetchers = new [] { "TheAudioDB" }
DisabledMetadataFetchers = new[] { "TheAudioDB" }
},
new MetadataOptions
{
@@ -339,21 +367,27 @@ namespace MediaBrowser.Model.Configuration
new MetadataOptions
{
ItemType = "Season",
DisabledMetadataFetchers = new [] { "TheMovieDb" },
DisabledMetadataFetchers = new[] { "TheMovieDb" },
},
new MetadataOptions
{
ItemType = "Episode",
DisabledMetadataFetchers = new [] { "The Open Movie Database", "TheMovieDb" },
DisabledImageFetchers = new [] { "The Open Movie Database", "TheMovieDb" }
DisabledMetadataFetchers = new[] { "The Open Movie Database", "TheMovieDb" },
DisabledImageFetchers = new[] { "The Open Movie Database", "TheMovieDb" }
}
};
EnableSlowResponseWarning = true;
SlowResponseThresholdMs = 500;
CorsHosts = new[] { "*" };
KnownProxies = Array.Empty<string>();
}
}
public class PathSubstitution
{
public string From { get; set; }
public string To { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public enum SubtitlePlaybackMode
{
Default = 0,
Always = 1,
OnlyForced = 2,
None = 3,
Smart = 4
}
}

View File

@@ -1,23 +0,0 @@
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Enum SyncPlayAccess.
/// </summary>
public enum SyncPlayAccess
{
/// <summary>
/// User can create groups and join them.
/// </summary>
CreateAndJoinGroups,
/// <summary>
/// User can only join already existing groups.
/// </summary>
JoinGroups,
/// <summary>
/// SyncPlay is disabled for the user.
/// </summary>
None
}
}

View File

@@ -1,17 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public enum UnratedItem
{
Movie,
Trailer,
Series,
Music,
Book,
LiveTvChannel,
LiveTvProgram,
ChannelContent,
Other
}
}

View File

@@ -1,11 +1,13 @@
#nullable disable
#pragma warning disable CS1591
using System;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class UserConfiguration
/// Class UserConfiguration.
/// </summary>
public class UserConfiguration
{
@@ -32,6 +34,7 @@ namespace MediaBrowser.Model.Configuration
public string[] GroupedFolders { get; set; }
public SubtitlePlaybackMode SubtitleMode { get; set; }
public bool DisplayCollectionsView { get; set; }
public bool EnableLocalPassword { get; set; }
@@ -39,12 +42,15 @@ namespace MediaBrowser.Model.Configuration
public string[] OrderedViews { get; set; }
public string[] LatestItemsExcludes { get; set; }
public string[] MyMediaExcludes { get; set; }
public bool HidePlayedInLatest { get; set; }
public bool RememberAudioSelections { get; set; }
public bool RememberSubtitleSelections { get; set; }
public bool EnableNextEpisodeAutoPlay { get; set; }
/// <summary>

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
@@ -9,6 +10,7 @@ namespace MediaBrowser.Model.Configuration
public string ReleaseDateFormat { get; set; }
public bool SaveImagePathsInNfo { get; set; }
public bool EnablePathSubstitution { get; set; }
public bool EnableExtraThumbsDuplication { get; set; }

View File

@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.Cryptography
IEnumerable<string> GetSupportedHashMethods();
byte[] ComputeHash(string HashMethod, byte[] bytes, byte[] salt);
byte[] ComputeHash(string hashMethod, byte[] bytes, byte[] salt);
byte[] ComputeHashWithDefaultMethod(byte[] bytes, byte[] salt);

View File

@@ -1,15 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Devices
{
public class ContentUploadHistory
{
public string DeviceId { get; set; }
public LocalFileInfo[] FilesUploaded { get; set; }
public ContentUploadHistory()
{
FilesUploaded = new LocalFileInfo[] { };
}
}
}

View File

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

View File

@@ -4,6 +4,6 @@ namespace MediaBrowser.Model.Devices
{
public class DeviceOptions
{
public string CustomName { get; set; }
public string? CustomName { get; set; }
}
}

View File

@@ -1,12 +0,0 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Devices
{
public class LocalFileInfo
{
public string Name { get; set; }
public string Id { get; set; }
public string Album { get; set; }
public string MimeType { get; set; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -19,12 +20,17 @@ namespace MediaBrowser.Model.Dlna
}
public bool EnableDirectPlay { get; set; }
public bool EnableDirectStream { get; set; }
public bool ForceDirectPlay { get; set; }
public bool ForceDirectStream { get; set; }
public Guid ItemId { get; set; }
public MediaSourceInfo[] MediaSources { get; set; }
public DeviceProfile Profile { get; set; }
/// <summary>
@@ -41,7 +47,7 @@ namespace MediaBrowser.Model.Dlna
public int? MaxAudioChannels { get; set; }
/// <summary>
/// The application's configured quality setting
/// The application's configured quality setting.
/// </summary>
public long? MaxBitrate { get; set; }
@@ -79,6 +85,7 @@ namespace MediaBrowser.Model.Dlna
{
return Profile.MaxStaticMusicBitrate;
}
return Profile.MaxStaticBitrate;
}

View File

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

View File

@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.Dlna
int? height,
int? videoBitDepth,
int? videoBitrate,
string videoProfile,
string? videoProfile,
double? videoLevel,
float? videoFramerate,
int? packetLength,
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Dlna
int? refFrames,
int? numVideoStreams,
int? numAudioStreams,
string videoCodecTag,
string? videoCodecTag,
bool? isAvc)
{
switch (condition.Property)
@@ -103,7 +103,7 @@ namespace MediaBrowser.Model.Dlna
int? audioBitrate,
int? audioSampleRate,
int? audioBitDepth,
string audioProfile,
string? audioProfile,
bool? isSecondaryTrack)
{
switch (condition.Property)
@@ -154,7 +154,7 @@ namespace MediaBrowser.Model.Dlna
return false;
}
private static bool IsConditionSatisfied(ProfileCondition condition, string currentValue)
private static bool IsConditionSatisfied(ProfileCondition condition, string? currentValue)
{
if (string.IsNullOrEmpty(currentValue))
{
@@ -201,34 +201,6 @@ namespace MediaBrowser.Model.Dlna
return false;
}
private static bool IsConditionSatisfied(ProfileCondition condition, float currentValue)
{
if (currentValue <= 0)
{
// If the value is unknown, it satisfies if not marked as required
return !condition.IsRequired;
}
if (float.TryParse(condition.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out var expected))
{
switch (condition.Condition)
{
case ProfileConditionType.Equals:
return currentValue.Equals(expected);
case ProfileConditionType.GreaterThanEqual:
return currentValue >= expected;
case ProfileConditionType.LessThanEqual:
return currentValue <= expected;
case ProfileConditionType.NotEquals:
return !currentValue.Equals(expected);
default:
throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition);
}
}
return false;
}
private static bool IsConditionSatisfied(ProfileCondition condition, double? currentValue)
{
if (!currentValue.HasValue)

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -10,6 +11,7 @@ namespace MediaBrowser.Model.Dlna
{
[XmlAttribute("type")]
public DlnaProfileType Type { get; set; }
public ProfileCondition[] Conditions { get; set; }
[XmlAttribute("container")]

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -32,9 +33,13 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}", DlnaMaps.FlagsToString(flagValue));
string dlnaflags = string.Format(
CultureInfo.InvariantCulture,
";DLNA.ORG_FLAGS={0}",
DlnaMaps.FlagsToString(flagValue));
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(container,
ResponseProfile mediaProfile = _profile.GetImageMediaProfile(
container,
width,
height);
@@ -75,11 +80,11 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
//if (isDirectStream)
// if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
// else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
//}
@@ -144,19 +149,20 @@ namespace MediaBrowser.Model.Dlna
DlnaFlags.InteractiveTransferMode |
DlnaFlags.DlnaV15;
//if (isDirectStream)
// if (isDirectStream)
//{
// flagValue = flagValue | DlnaFlags.ByteBasedSeek;
//}
//else if (runtimeTicks.HasValue)
// else if (runtimeTicks.HasValue)
//{
// flagValue = flagValue | DlnaFlags.TimeBasedSeek;
//}
string dlnaflags = string.Format(";DLNA.ORG_FLAGS={0}",
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,
@@ -217,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);
@@ -227,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

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -36,12 +37,6 @@ namespace MediaBrowser.Model.Dlna
/// <value>The model description.</value>
public string ModelDescription { get; set; }
/// <summary>
/// Gets or sets the device description.
/// </summary>
/// <value>The device description.</value>
public string DeviceDescription { get; set; }
/// <summary>
/// Gets or sets the model URL.
/// </summary>

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -26,16 +27,25 @@ namespace MediaBrowser.Model.Dlna
public DeviceIdentification Identification { get; set; }
public string FriendlyName { get; set; }
public string Manufacturer { get; set; }
public string ManufacturerUrl { get; set; }
public string ModelName { get; set; }
public string ModelDescription { get; set; }
public string ModelNumber { get; set; }
public string ModelUrl { get; set; }
public string SerialNumber { get; set; }
public bool EnableAlbumArtInDidl { get; set; }
public bool EnableSingleAlbumArtLimit { get; set; }
public bool EnableSingleSubtitleLimit { get; set; }
public string SupportedMediaTypes { get; set; }
@@ -45,15 +55,19 @@ namespace MediaBrowser.Model.Dlna
public string AlbumArtPn { get; set; }
public int MaxAlbumArtWidth { get; set; }
public int MaxAlbumArtHeight { get; set; }
public int? MaxIconWidth { get; set; }
public int? MaxIconHeight { get; set; }
public long? MaxStreamingBitrate { get; set; }
public long? MaxStaticBitrate { get; set; }
public int? MusicStreamingTranscodingBitrate { get; set; }
public int? MaxStaticMusicBitrate { get; set; }
/// <summary>
@@ -64,10 +78,13 @@ namespace MediaBrowser.Model.Dlna
public string ProtocolInfo { get; set; }
public int TimelineOffsetSeconds { get; set; }
public bool RequiresPlainVideoItems { get; set; }
public bool RequiresPlainFolders { get; set; }
public bool EnableMSMediaReceiverRegistrar { get; set; }
public bool IgnoreTranscodeByteRangeRequests { get; set; }
public XmlAttribute[] XmlRootAttributes { get; set; }
@@ -87,6 +104,7 @@ namespace MediaBrowser.Model.Dlna
public ContainerProfile[] ContainerProfiles { get; set; }
public CodecProfile[] CodecProfiles { get; set; }
public ResponseProfile[] ResponseProfiles { get; set; }
public SubtitleProfile[] SubtitleProfiles { get; set; }
@@ -168,6 +186,7 @@ namespace MediaBrowser.Model.Dlna
return i;
}
return null;
}
@@ -208,6 +227,7 @@ namespace MediaBrowser.Model.Dlna
return i;
}
return null;
}
@@ -253,10 +273,12 @@ namespace MediaBrowser.Model.Dlna
return i;
}
return null;
}
public ResponseProfile GetVideoMediaProfile(string container,
public ResponseProfile GetVideoMediaProfile(
string container,
string audioCodec,
string videoCodec,
int? width,
@@ -317,6 +339,7 @@ namespace MediaBrowser.Model.Dlna
return i;
}
return null;
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;

View File

@@ -1,18 +1,20 @@
#pragma warning disable CS1591
using System.Globalization;
namespace MediaBrowser.Model.Dlna
{
public static class DlnaMaps
{
private static readonly string DefaultStreaming =
FlagsToString(DlnaFlags.StreamingTransferMode |
FlagsToString(DlnaFlags.StreamingTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
DlnaFlags.DlnaV15);
private static readonly string DefaultInteractive =
FlagsToString(DlnaFlags.InteractiveTransferMode |
FlagsToString(DlnaFlags.InteractiveTransferMode |
DlnaFlags.BackgroundTransferMode |
DlnaFlags.ConnectionStall |
DlnaFlags.ByteBasedSeek |
@@ -20,7 +22,7 @@ namespace MediaBrowser.Model.Dlna
public static string FlagsToString(DlnaFlags flags)
{
return string.Format("{0:X8}{1:D24}", (ulong)flags, 0);
return string.Format(CultureInfo.InvariantCulture, "{0:X8}{1:D24}", (ulong)flags, 0);
}
public static string GetOrgOpValue(bool hasKnownRuntime, bool isDirectStream, TranscodeSeekInfo profileTranscodeSeekInfo)

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;

View File

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

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
@@ -5,7 +6,9 @@ namespace MediaBrowser.Model.Dlna
public interface ITranscoderSupport
{
bool CanEncodeToAudioCodec(string codec);
bool CanEncodeToSubtitleCodec(string codec);
bool CanExtractSubtitles(string codec);
}
@@ -15,10 +18,12 @@ namespace MediaBrowser.Model.Dlna
{
return true;
}
public bool CanEncodeToSubtitleCodec(string codec)
{
return true;
}
public bool CanExtractSubtitles(string codec)
{
return true;

View File

@@ -1,7 +1,9 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using MediaBrowser.Model.MediaInfo;
@@ -21,28 +23,35 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
}
if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
}
if (string.Equals(container, "avi", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.AVI };
}
if (string.Equals(container, "mkv", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };
}
if (string.Equals(container, "mpeg2ps", StringComparison.OrdinalIgnoreCase) ||
string.Equals(container, "ts", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };
}
if (string.Equals(container, "mpeg1video", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };
}
if (string.Equals(container, "mpeg2ts", StringComparison.OrdinalIgnoreCase) ||
string.Equals(container, "mpegts", StringComparison.OrdinalIgnoreCase) ||
@@ -53,26 +62,32 @@ namespace MediaBrowser.Model.Dlna
}
if (string.Equals(container, "flv", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.FLV };
}
if (string.Equals(container, "wtv", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.WTV };
}
if (string.Equals(container, "3gp", StringComparison.OrdinalIgnoreCase))
{
MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);
return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };
return val.HasValue ? new MediaFormatProfile[] { val.Value } : Array.Empty<MediaFormatProfile>();
}
if (string.Equals(container, "ogv", StringComparison.OrdinalIgnoreCase) || string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.OGV };
}
return new MediaFormatProfile[] { };
return Array.Empty<MediaFormatProfile>();
}
private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)
{
string suffix = "";
string suffix = string.Empty;
switch (timestampType)
{
@@ -92,22 +107,27 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
{
var list = new List<MediaFormatProfile>();
list.Add(ValueOf("MPEG_TS_SD_NA" + suffix));
list.Add(ValueOf("MPEG_TS_SD_EU" + suffix));
list.Add(ValueOf("MPEG_TS_SD_KO" + suffix));
var list = new List<MediaFormatProfile>
{
ValueOf("MPEG_TS_SD_NA" + suffix),
ValueOf("MPEG_TS_SD_EU" + suffix),
ValueOf("MPEG_TS_SD_KO" + suffix)
};
if ((timestampType == TransportStreamTimestamp.Valid) && string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
list.Add(MediaFormatProfile.MPEG_TS_JP_T);
}
return list.ToArray();
}
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
{
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };
}
if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
{
@@ -115,6 +135,7 @@ namespace MediaBrowser.Model.Dlna
{
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };
}
return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };
}
@@ -122,21 +143,27 @@ namespace MediaBrowser.Model.Dlna
{
if (timestampType == TransportStreamTimestamp.None)
{
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };
}
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };
}
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };
}
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };
}
if (string.IsNullOrEmpty(audioCodec) ||
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };
}
}
else if (string.Equals(videoCodec, "vc1", StringComparison.OrdinalIgnoreCase))
{
@@ -146,29 +173,41 @@ namespace MediaBrowser.Model.Dlna
{
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };
}
return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };
}
if (string.Equals(audioCodec, "dts", StringComparison.OrdinalIgnoreCase))
{
suffix = string.Equals(suffix, "_ISO", StringComparison.OrdinalIgnoreCase) ? suffix : "_T";
return new MediaFormatProfile[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "VC1_TS_HD_DTS{0}", suffix)) };
}
}
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) || string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "MPEG4_P2_TS_ASP_AAC{0}", suffix)) };
}
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };
}
if (string.Equals(audioCodec, "mp2", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };
}
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
{
return new MediaFormatProfile[] { ValueOf(string.Format(CultureInfo.InvariantCulture, "MPEG4_P2_TS_ASP_AC3{0}", suffix)) };
}
}
return new MediaFormatProfile[] { };
return Array.Empty<MediaFormatProfile>();
}
private MediaFormatProfile ValueOf(string value)
@@ -181,27 +220,36 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
if (string.Equals(audioCodec, "lpcm", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_LPCM;
}
if (string.IsNullOrEmpty(audioCodec) ||
string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_SD_AC3;
}
if (string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_SD_MPEG1_L3;
}
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
{
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_SD_AAC_MULT5;
}
}
else if ((width.Value <= 1280) && (height.Value <= 720))
{
if (string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_MP4_MP_HD_720p_AAC;
}
}
else if ((width.Value <= 1920) && (height.Value <= 1080))
{
@@ -218,7 +266,10 @@ namespace MediaBrowser.Model.Dlna
if (width.HasValue && height.HasValue && width.Value <= 720 && height.Value <= 576)
{
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_MP4_ASP_AAC;
}
if (string.Equals(audioCodec, "ac3", StringComparison.OrdinalIgnoreCase) || string.Equals(audioCodec, "mp3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_MP4_NDSD;
@@ -242,15 +293,22 @@ namespace MediaBrowser.Model.Dlna
if (string.Equals(videoCodec, "h264", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "aac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.AVC_3GPP_BL_QCIF15_AAC;
}
}
else if (string.Equals(videoCodec, "mpeg4", StringComparison.OrdinalIgnoreCase) ||
string.Equals(videoCodec, "msmpeg4", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrEmpty(audioCodec) || string.Equals(audioCodec, "wma", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AAC;
}
if (string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MPEG4_P2_3GPP_SP_L0B_AMR;
}
}
else if (string.Equals(videoCodec, "h263", StringComparison.OrdinalIgnoreCase) && string.Equals(audioCodec, "amrnb", StringComparison.OrdinalIgnoreCase))
{
@@ -274,6 +332,7 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.WMVMED_FULL;
}
return MediaFormatProfile.WMVMED_PRO;
}
}
@@ -282,6 +341,7 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.WMVHIGH_FULL;
}
return MediaFormatProfile.WMVHIGH_PRO;
}
@@ -290,11 +350,19 @@ namespace MediaBrowser.Model.Dlna
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 720) && (height.Value <= 576))
{
return MediaFormatProfile.VC1_ASF_AP_L1_WMA;
}
if ((width.Value <= 1280) && (height.Value <= 720))
{
return MediaFormatProfile.VC1_ASF_AP_L2_WMA;
}
if ((width.Value <= 1920) && (height.Value <= 1080))
{
return MediaFormatProfile.VC1_ASF_AP_L3_WMA;
}
}
}
else if (string.Equals(videoCodec, "mpeg2video", StringComparison.OrdinalIgnoreCase))
@@ -308,27 +376,41 @@ namespace MediaBrowser.Model.Dlna
public MediaFormatProfile? ResolveAudioFormat(string container, int? bitrate, int? frequency, int? channels)
{
if (string.Equals(container, "asf", StringComparison.OrdinalIgnoreCase))
{
return ResolveAudioASFFormat(bitrate);
}
if (string.Equals(container, "mp3", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.MP3;
}
if (string.Equals(container, "lpcm", StringComparison.OrdinalIgnoreCase))
{
return ResolveAudioLPCMFormat(frequency, channels);
}
if (string.Equals(container, "mp4", StringComparison.OrdinalIgnoreCase) ||
string.Equals(container, "aac", StringComparison.OrdinalIgnoreCase))
{
return ResolveAudioMP4Format(bitrate);
}
if (string.Equals(container, "adts", StringComparison.OrdinalIgnoreCase))
{
return ResolveAudioADTSFormat(bitrate);
}
if (string.Equals(container, "flac", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.FLAC;
}
if (string.Equals(container, "oga", StringComparison.OrdinalIgnoreCase) ||
string.Equals(container, "ogg", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.OGG;
}
return null;
}
@@ -339,6 +421,7 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.WMA_BASE;
}
return MediaFormatProfile.WMA_FULL;
}
@@ -350,14 +433,17 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.LPCM16_44_MONO;
}
if (frequency.Value == 44100 && channels.Value == 2)
{
return MediaFormatProfile.LPCM16_44_STEREO;
}
if (frequency.Value == 48000 && channels.Value == 1)
{
return MediaFormatProfile.LPCM16_48_MONO;
}
if (frequency.Value == 48000 && channels.Value == 2)
{
return MediaFormatProfile.LPCM16_48_STEREO;
@@ -375,6 +461,7 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.AAC_ISO_320;
}
return MediaFormatProfile.AAC_ISO;
}
@@ -384,6 +471,7 @@ namespace MediaBrowser.Model.Dlna
{
return MediaFormatProfile.AAC_ADTS_320;
}
return MediaFormatProfile.AAC_ADTS;
}
@@ -394,13 +482,19 @@ namespace MediaBrowser.Model.Dlna
return ResolveImageJPGFormat(width, height);
if (string.Equals(container, "png", StringComparison.OrdinalIgnoreCase))
{
return ResolveImagePNGFormat(width, height);
}
if (string.Equals(container, "gif", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.GIF_LRG;
}
if (string.Equals(container, "raw", StringComparison.OrdinalIgnoreCase))
{
return MediaFormatProfile.RAW;
}
return null;
}
@@ -410,10 +504,14 @@ namespace MediaBrowser.Model.Dlna
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 160) && (height.Value <= 160))
{
return MediaFormatProfile.JPEG_TN;
}
if ((width.Value <= 640) && (height.Value <= 480))
{
return MediaFormatProfile.JPEG_SM;
}
if ((width.Value <= 1024) && (height.Value <= 768))
{
@@ -431,7 +529,9 @@ namespace MediaBrowser.Model.Dlna
if (width.HasValue && height.HasValue)
{
if ((width.Value <= 160) && (height.Value <= 160))
{
return MediaFormatProfile.PNG_TN;
}
}
return MediaFormatProfile.PNG_LRG;

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;
@@ -6,6 +7,24 @@ namespace MediaBrowser.Model.Dlna
{
public class ProfileCondition
{
public ProfileCondition()
{
IsRequired = true;
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value)
: this(condition, property, value, false)
{
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired)
{
Condition = condition;
Property = property;
Value = value;
IsRequired = isRequired;
}
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
@@ -17,24 +36,5 @@ namespace MediaBrowser.Model.Dlna
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
public ProfileCondition()
{
IsRequired = true;
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value)
: this(condition, property, value, false)
{
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired)
{
Condition = condition;
Property = property;
Value = value;
IsRequired = isRequired;
}
}
}

View File

@@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
public class ResolutionConfiguration
{
public int MaxWidth { get; set; }
public int MaxBitrate { get; set; }
public ResolutionConfiguration(int maxWidth, int maxBitrate)

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -14,10 +15,12 @@ namespace MediaBrowser.Model.Dlna
new ResolutionConfiguration(720, 950000),
new ResolutionConfiguration(1280, 2500000),
new ResolutionConfiguration(1920, 4000000),
new ResolutionConfiguration(2560, 8000000),
new ResolutionConfiguration(3840, 35000000)
};
public static ResolutionOptions Normalize(int? inputBitrate,
public static ResolutionOptions Normalize(
int? inputBitrate,
int? unused1,
int? unused2,
int outputBitrate,
@@ -83,6 +86,7 @@ namespace MediaBrowser.Model.Dlna
{
return .5;
}
return 1;
}

View File

@@ -5,6 +5,7 @@ namespace MediaBrowser.Model.Dlna
public class ResolutionOptions
{
public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; }
}
}

View File

@@ -1,5 +1,7 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
@@ -28,7 +30,7 @@ namespace MediaBrowser.Model.Dlna
public ResponseProfile()
{
Conditions = new ProfileCondition[] { };
Conditions = Array.Empty<ProfileCondition>();
}
public string[] GetContainers()

View File

@@ -34,9 +34,9 @@ namespace MediaBrowser.Model.Dlna
public SearchCriteria(string search)
{
if (string.IsNullOrEmpty(search))
if (search.Length == 0)
{
throw new ArgumentNullException(nameof(search));
throw new ArgumentException("String can't be empty.", nameof(search));
}
SearchType = SearchType.Unknown;
@@ -48,11 +48,10 @@ namespace MediaBrowser.Model.Dlna
if (subFactors.Length == 3)
{
if (string.Equals("upnp:class", subFactors[0], StringComparison.OrdinalIgnoreCase) &&
(string.Equals("=", subFactors[1]) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
(string.Equals("=", subFactors[1], StringComparison.Ordinal) || string.Equals("derivedfrom", subFactors[1], StringComparison.OrdinalIgnoreCase)))
{
if (string.Equals("\"object.item.imageItem\"", subFactors[2]) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
if (string.Equals("\"object.item.imageItem\"", subFactors[2], StringComparison.Ordinal) || string.Equals("\"object.item.imageItem.photo\"", subFactors[2], StringComparison.OrdinalIgnoreCase))
{
SearchType = SearchType.Image;
}

View File

@@ -1,6 +1,6 @@
#pragma warning disable CS1591
using MediaBrowser.Model.Entities;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Dlna
{
@@ -10,7 +10,6 @@ namespace MediaBrowser.Model.Dlna
public SortCriteria(string value)
{
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -108,7 +109,6 @@ namespace MediaBrowser.Model.Dlna
}
return 1;
}).ThenBy(i =>
{
switch (i.PlayMethod)
@@ -120,7 +120,6 @@ namespace MediaBrowser.Model.Dlna
default:
return 1;
}
}).ThenBy(i =>
{
switch (i.MediaSource.Protocol)
@@ -130,7 +129,6 @@ namespace MediaBrowser.Model.Dlna
default:
return 1;
}
}).ThenBy(i =>
{
if (maxBitrate > 0)
@@ -142,7 +140,6 @@ namespace MediaBrowser.Model.Dlna
}
return 0;
}).ThenBy(streams.IndexOf);
}
@@ -339,6 +336,7 @@ namespace MediaBrowser.Model.Dlna
{
transcodeReasons.Add(transcodeReason.Value);
}
all = false;
break;
}
@@ -386,7 +384,10 @@ namespace MediaBrowser.Model.Dlna
audioCodecProfiles.Add(i);
}
if (audioCodecProfiles.Count >= 1) break;
if (audioCodecProfiles.Count >= 1)
{
break;
}
}
var audioTranscodingConditions = new List<ProfileCondition>();
@@ -454,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));
}
@@ -497,7 +500,6 @@ namespace MediaBrowser.Model.Dlna
}
}
if (playMethods.Count > 0)
{
transcodeReasons.Clear();
@@ -629,10 +631,12 @@ namespace MediaBrowser.Model.Dlna
{
playlistItem.MinSegments = transcodingProfile.MinSegments;
}
if (transcodingProfile.SegmentLength > 0)
{
playlistItem.SegmentLength = transcodingProfile.SegmentLength;
}
playlistItem.SubProtocol = transcodingProfile.Protocol;
if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels)
@@ -676,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,
@@ -779,7 +784,7 @@ namespace MediaBrowser.Model.Dlna
if (!ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
{
//LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item);
// LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item);
applyConditions = false;
break;
}
@@ -823,7 +828,7 @@ namespace MediaBrowser.Model.Dlna
if (!ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio))
{
//LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item);
// LogConditionFailure(options.Profile, "VideoCodecProfile.ApplyConditions", applyCondition, item);
applyConditions = false;
break;
}
@@ -949,6 +954,7 @@ namespace MediaBrowser.Model.Dlna
{
return (PlayMethod.DirectPlay, new List<TranscodeReason>());
}
if (options.ForceDirectStream)
{
return (PlayMethod.DirectStream, new List<TranscodeReason>());
@@ -969,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));
}
@@ -1044,7 +1052,7 @@ namespace MediaBrowser.Model.Dlna
{
if (!ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numVideoStreams, numAudioStreams, videoCodecTag, isAvc))
{
//LogConditionFailure(profile, "VideoCodecProfile.ApplyConditions", applyCondition, mediaSource);
// LogConditionFailure(profile, "VideoCodecProfile.ApplyConditions", applyCondition, mediaSource);
applyConditions = false;
break;
}
@@ -1090,7 +1098,7 @@ namespace MediaBrowser.Model.Dlna
{
if (!ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio))
{
//LogConditionFailure(profile, "VideoAudioCodecProfile.ApplyConditions", applyCondition, mediaSource);
// LogConditionFailure(profile, "VideoAudioCodecProfile.ApplyConditions", applyCondition, mediaSource);
applyConditions = false;
break;
}
@@ -1132,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,
@@ -1263,6 +1272,7 @@ namespace MediaBrowser.Model.Dlna
return true;
}
}
return false;
}
@@ -1336,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;
}
@@ -1365,14 +1376,17 @@ namespace MediaBrowser.Model.Dlna
{
throw new ArgumentException("ItemId is required");
}
if (string.IsNullOrEmpty(options.DeviceId))
{
throw new ArgumentException("DeviceId is required");
}
if (options.Profile == null)
{
throw new ArgumentException("Profile is required");
}
if (options.MediaSources == null)
{
throw new ArgumentException("MediaSources is required");
@@ -1420,8 +1434,10 @@ namespace MediaBrowser.Model.Dlna
item.AudioBitrate = Math.Max(num, item.AudioBitrate ?? num);
}
}
break;
}
case ProfileConditionValue.AudioChannels:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1454,8 +1470,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "audiochannels", Math.Max(num, item.GetTargetAudioChannels(qualifier) ?? num).ToString(CultureInfo.InvariantCulture));
}
}
break;
}
case ProfileConditionValue.IsAvc:
{
if (!enableNonQualifiedConditions)
@@ -1474,8 +1492,10 @@ namespace MediaBrowser.Model.Dlna
item.RequireAvc = true;
}
}
break;
}
case ProfileConditionValue.IsAnamorphic:
{
if (!enableNonQualifiedConditions)
@@ -1494,8 +1514,10 @@ namespace MediaBrowser.Model.Dlna
item.RequireNonAnamorphic = true;
}
}
break;
}
case ProfileConditionValue.IsInterlaced:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1524,8 +1546,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "deinterlace", "true");
}
}
break;
}
case ProfileConditionValue.AudioProfile:
case ProfileConditionValue.Has64BitOffsets:
case ProfileConditionValue.PacketLength:
@@ -1537,6 +1561,7 @@ namespace MediaBrowser.Model.Dlna
// Not supported yet
break;
}
case ProfileConditionValue.RefFrames:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1569,8 +1594,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "maxrefframes", Math.Max(num, item.GetTargetRefFrames(qualifier) ?? num).ToString(CultureInfo.InvariantCulture));
}
}
break;
}
case ProfileConditionValue.VideoBitDepth:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1603,8 +1630,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "videobitdepth", Math.Max(num, item.GetTargetVideoBitDepth(qualifier) ?? num).ToString(CultureInfo.InvariantCulture));
}
}
break;
}
case ProfileConditionValue.VideoProfile:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1625,8 +1654,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "profile", string.Join(",", values));
}
}
break;
}
case ProfileConditionValue.Height:
{
if (!enableNonQualifiedConditions)
@@ -1649,8 +1680,10 @@ namespace MediaBrowser.Model.Dlna
item.MaxHeight = Math.Max(num, item.MaxHeight ?? num);
}
}
break;
}
case ProfileConditionValue.VideoBitrate:
{
if (!enableNonQualifiedConditions)
@@ -1673,8 +1706,10 @@ namespace MediaBrowser.Model.Dlna
item.VideoBitrate = Math.Max(num, item.VideoBitrate ?? num);
}
}
break;
}
case ProfileConditionValue.VideoFramerate:
{
if (!enableNonQualifiedConditions)
@@ -1697,8 +1732,10 @@ namespace MediaBrowser.Model.Dlna
item.MaxFramerate = Math.Max(num, item.MaxFramerate ?? num);
}
}
break;
}
case ProfileConditionValue.VideoLevel:
{
if (string.IsNullOrEmpty(qualifier))
@@ -1721,8 +1758,10 @@ namespace MediaBrowser.Model.Dlna
item.SetOption(qualifier, "level", Math.Max(num, item.GetTargetVideoLevel(qualifier) ?? num).ToString(CultureInfo.InvariantCulture));
}
}
break;
}
case ProfileConditionValue.Width:
{
if (!enableNonQualifiedConditions)
@@ -1745,8 +1784,10 @@ namespace MediaBrowser.Model.Dlna
item.MaxWidth = Math.Max(num, item.MaxWidth ?? num);
}
}
break;
}
default:
break;
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -68,6 +69,7 @@ namespace MediaBrowser.Model.Dlna
public Guid ItemId { get; set; }
public PlayMethod PlayMethod { get; set; }
public EncodingContext Context { get; set; }
public DlnaProfileType MediaType { get; set; }
@@ -79,15 +81,23 @@ namespace MediaBrowser.Model.Dlna
public long StartPositionTicks { get; set; }
public int? SegmentLength { get; set; }
public int? MinSegments { get; set; }
public bool BreakOnNonKeyFrames { get; set; }
public bool RequireAvc { get; set; }
public bool RequireNonAnamorphic { get; set; }
public bool CopyTimestamps { get; set; }
public bool EnableMpegtsM2TsMode { get; set; }
public bool EnableSubtitlesInManifest { get; set; }
public string[] AudioCodecs { get; set; }
public string[] VideoCodecs { get; set; }
public int? AudioStreamIndex { get; set; }
@@ -95,6 +105,7 @@ namespace MediaBrowser.Model.Dlna
public int? SubtitleStreamIndex { get; set; }
public int? TranscodingMaxAudioChannels { get; set; }
public int? GlobalMaxAudioChannels { get; set; }
public int? AudioBitrate { get; set; }
@@ -102,12 +113,15 @@ namespace MediaBrowser.Model.Dlna
public int? VideoBitrate { get; set; }
public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; }
public float? MaxFramerate { get; set; }
public DeviceProfile DeviceProfile { get; set; }
public string DeviceProfileId { get; set; }
public string DeviceId { get; set; }
public long? RunTimeTicks { get; set; }
@@ -119,15 +133,18 @@ namespace MediaBrowser.Model.Dlna
public MediaSourceInfo MediaSource { get; set; }
public string[] SubtitleCodecs { get; set; }
public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; }
public string SubtitleFormat { get; set; }
public string PlaySessionId { get; set; }
public TranscodeReason[] TranscodeReasons { get; set; }
public Dictionary<string, string> StreamOptions { get; private set; }
public string MediaSourceId => MediaSource == null ? null : MediaSource.Id;
public string MediaSourceId => MediaSource?.Id;
public bool IsDirectStream =>
PlayMethod == PlayMethod.DirectStream ||
@@ -159,11 +176,13 @@ namespace MediaBrowser.Model.Dlna
{
continue;
}
if (string.Equals(pair.Name, "SubtitleStreamIndex", StringComparison.OrdinalIgnoreCase) &&
string.Equals(pair.Value, "-1", StringComparison.OrdinalIgnoreCase))
{
continue;
}
if (string.Equals(pair.Name, "Static", StringComparison.OrdinalIgnoreCase) &&
string.Equals(pair.Value, "false", StringComparison.OrdinalIgnoreCase))
{
@@ -172,7 +191,7 @@ namespace MediaBrowser.Model.Dlna
var encodedValue = pair.Value.Replace(" ", "%20");
list.Add(string.Format("{0}={1}", pair.Name, encodedValue));
list.Add(string.Format(CultureInfo.InvariantCulture, "{0}={1}", pair.Name, encodedValue));
}
string queryString = string.Join("&", list.ToArray());
@@ -195,18 +214,18 @@ namespace MediaBrowser.Model.Dlna
{
if (string.Equals(SubProtocol, "hls", StringComparison.OrdinalIgnoreCase))
{
return string.Format("{0}/audio/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
return string.Format(CultureInfo.InvariantCulture, "{0}/audio/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
}
return string.Format("{0}/audio/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
return string.Format(CultureInfo.InvariantCulture, "{0}/audio/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
}
if (string.Equals(SubProtocol, "hls", StringComparison.OrdinalIgnoreCase))
{
return string.Format("{0}/videos/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
return string.Format(CultureInfo.InvariantCulture, "{0}/videos/{1}/master.m3u8?{2}", baseUrl, ItemId, queryString);
}
return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
return string.Format(CultureInfo.InvariantCulture, "{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, queryString);
}
private static List<NameValuePair> BuildParams(StreamInfo item, string accessToken)
@@ -257,7 +276,6 @@ namespace MediaBrowser.Model.Dlna
list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty));
if (!item.IsDirectStream)
{
if (item.RequireNonAnamorphic)
@@ -438,7 +456,7 @@ namespace MediaBrowser.Model.Dlna
{
if (MediaSource.Protocol == MediaProtocol.File || !string.Equals(stream.Codec, subtitleProfile.Format, StringComparison.OrdinalIgnoreCase) || !stream.IsExternal)
{
info.Url = string.Format("{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
info.Url = string.Format(CultureInfo.InvariantCulture, "{0}/Videos/{1}/{2}/Subtitles/{3}/{4}/Stream.{5}",
baseUrl,
ItemId,
MediaSourceId,
@@ -464,7 +482,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Returns the audio stream that will be used
/// Returns the audio stream that will be used.
/// </summary>
public MediaStream TargetAudioStream
{
@@ -480,7 +498,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Returns the video stream that will be used
/// Returns the video stream that will be used.
/// </summary>
public MediaStream TargetVideoStream
{
@@ -496,7 +514,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public int? TargetAudioSampleRate
{
@@ -508,7 +526,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public int? TargetAudioBitDepth
{
@@ -531,7 +549,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public int? TargetVideoBitDepth
{
@@ -578,7 +596,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public float? TargetFramerate
{
@@ -592,7 +610,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public double? TargetVideoLevel
{
@@ -679,7 +697,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public int? TargetPacketLength
{
@@ -693,7 +711,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio sample rate that will be in the output stream
/// Predicts the audio sample rate that will be in the output stream.
/// </summary>
public string TargetVideoProfile
{
@@ -731,7 +749,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio bitrate that will be in the output stream
/// Predicts the audio bitrate that will be in the output stream.
/// </summary>
public int? TargetAudioBitrate
{
@@ -745,7 +763,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio channels that will be in the output stream
/// Predicts the audio channels that will be in the output stream.
/// </summary>
public int? TargetAudioChannels
{
@@ -786,7 +804,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio codec that will be in the output stream
/// Predicts the audio codec that will be in the output stream.
/// </summary>
public string[] TargetAudioCodec
{
@@ -794,18 +812,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetAudioStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in AudioCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}
@@ -819,18 +837,18 @@ namespace MediaBrowser.Model.Dlna
{
var stream = TargetVideoStream;
string inputCodec = stream == null ? null : stream.Codec;
string inputCodec = stream?.Codec;
if (IsDirectStream)
{
return string.IsNullOrEmpty(inputCodec) ? new string[] { } : new[] { inputCodec };
return string.IsNullOrEmpty(inputCodec) ? Array.Empty<string>() : new[] { inputCodec };
}
foreach (string codec in VideoCodecs)
{
if (string.Equals(codec, inputCodec, StringComparison.OrdinalIgnoreCase))
{
return string.IsNullOrEmpty(codec) ? new string[] { } : new[] { codec };
return string.IsNullOrEmpty(codec) ? Array.Empty<string>() : new[] { codec };
}
}
@@ -839,7 +857,7 @@ namespace MediaBrowser.Model.Dlna
}
/// <summary>
/// Predicts the audio channels that will be in the output stream
/// Predicts the audio channels that will be in the output stream.
/// </summary>
public long? TargetSize
{
@@ -992,6 +1010,7 @@ namespace MediaBrowser.Model.Dlna
{
return GetMediaStreamCount(MediaStreamType.Video, int.MaxValue);
}
return GetMediaStreamCount(MediaStreamType.Video, 1);
}
}
@@ -1004,6 +1023,7 @@ namespace MediaBrowser.Model.Dlna
{
return GetMediaStreamCount(MediaStreamType.Audio, int.MaxValue);
}
return GetMediaStreamCount(MediaStreamType.Audio, 1);
}
}

View File

@@ -5,22 +5,22 @@ namespace MediaBrowser.Model.Dlna
public enum SubtitleDeliveryMethod
{
/// <summary>
/// The encode
/// The encode.
/// </summary>
Encode = 0,
/// <summary>
/// The embed
/// The embed.
/// </summary>
Embed = 1,
/// <summary>
/// The external
/// The external.
/// </summary>
External = 2,
/// <summary>
/// The HLS
/// The HLS.
/// </summary>
Hls = 3
}

View File

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

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
@@ -5,13 +6,21 @@ namespace MediaBrowser.Model.Dlna
public class SubtitleStreamInfo
{
public string Url { get; set; }
public string Language { get; set; }
public string Name { get; set; }
public bool IsForced { get; set; }
public string Format { get; set; }
public string DisplayTitle { get; set; }
public int Index { get; set; }
public SubtitleDeliveryMethod DeliveryMethod { get; set; }
public bool IsExternalUrl { get; set; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -9,8 +10,11 @@ namespace MediaBrowser.Model.Dlna
public class UpnpDeviceInfo
{
public Uri Location { get; set; }
public Dictionary<string, string> Headers { get; set; }
public IPAddress LocalIpAddress { get; set; }
public int LocalPort { get; set; }
}
}

View File

@@ -8,6 +8,7 @@ namespace MediaBrowser.Model.Dlna
public class VideoOptions : AudioOptions
{
public int? AudioStreamIndex { get; set; }
public int? SubtitleStreamIndex { get; set; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;

View File

@@ -16,7 +16,8 @@ namespace MediaBrowser.Model.Drawing
/// <param name="maxWidth">A max fixed width, if desired.</param>
/// <param name="maxHeight">A max fixed height, if desired.</param>
/// <returns>A new size object.</returns>
public static ImageDimensions Resize(ImageDimensions size,
public static ImageDimensions Resize(
ImageDimensions size,
int width,
int height,
int maxWidth,
@@ -62,7 +63,7 @@ namespace MediaBrowser.Model.Drawing
/// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param>
/// <param name="newHeight">The new height.</param>
/// <returns>the new width</returns>
/// <returns>The new width.</returns>
private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight)
=> Convert.ToInt32((double)newHeight / currentHeight * currentWidth);

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -61,17 +62,23 @@ namespace MediaBrowser.Model.Dto
public DateTime? DateCreated { get; set; }
public DateTime? DateLastMediaAdded { get; set; }
public string ExtraType { get; set; }
public int? AirsBeforeSeasonNumber { get; set; }
public int? AirsAfterSeasonNumber { get; set; }
public int? AirsBeforeEpisodeNumber { get; set; }
public bool? CanDelete { get; set; }
public bool? CanDownload { get; set; }
public bool? HasSubtitles { get; set; }
public string PreferredMetadataLanguage { get; set; }
public string PreferredMetadataCountryCode { get; set; }
/// <summary>
@@ -86,6 +93,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The name of the sort.</value>
public string SortName { get; set; }
public string ForcedSortName { get; set; }
/// <summary>
@@ -145,6 +153,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The channel identifier.</value>
public Guid ChannelId { get; set; }
public string ChannelName { get; set; }
/// <summary>
@@ -212,6 +221,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The number.</value>
public string Number { get; set; }
public string ChannelNumber { get; set; }
/// <summary>
@@ -307,7 +317,7 @@ namespace MediaBrowser.Model.Dto
public int? LocalTrailerCount { get; set; }
/// <summary>
/// User data for this item based on the user it's being requested for
/// User data for this item based on the user it's being requested for.
/// </summary>
/// <value>The user data.</value>
public UserItemDataDto UserData { get; set; }
@@ -419,6 +429,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The album id.</value>
public Guid AlbumId { get; set; }
/// <summary>
/// Gets or sets the album image tag.
/// </summary>
@@ -466,6 +477,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The part count.</value>
public int? PartCount { get; set; }
public int? MediaSourceCount { get; set; }
/// <summary>
@@ -510,6 +522,13 @@ namespace MediaBrowser.Model.Dto
/// <value>The series thumb image tag.</value>
public string SeriesThumbImageTag { get; set; }
/// <summary>
/// Gets or sets the blurhashes for the image tags.
/// Maps image type to dictionary mapping image tag to blurhash value.
/// </summary>
/// <value>The blurhashes.</value>
public Dictionary<ImageType, Dictionary<string, string>> ImageBlurHashes { get; set; }
/// <summary>
/// Gets or sets the series studio.
/// </summary>
@@ -574,40 +593,48 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the locked fields.
/// </summary>
/// <value>The locked fields.</value>
public MetadataFields[] LockedFields { get; set; }
public MetadataField[] LockedFields { get; set; }
/// <summary>
/// Gets or sets the trailer count.
/// </summary>
/// <value>The trailer count.</value>
public int? TrailerCount { get; set; }
/// <summary>
/// Gets or sets the movie count.
/// </summary>
/// <value>The movie count.</value>
public int? MovieCount { get; set; }
/// <summary>
/// Gets or sets the series count.
/// </summary>
/// <value>The series count.</value>
public int? SeriesCount { get; set; }
public int? ProgramCount { get; set; }
/// <summary>
/// Gets or sets the episode count.
/// </summary>
/// <value>The episode count.</value>
public int? EpisodeCount { get; set; }
/// <summary>
/// Gets or sets the song count.
/// </summary>
/// <value>The song count.</value>
public int? SongCount { get; set; }
/// <summary>
/// Gets or sets the album count.
/// </summary>
/// <value>The album count.</value>
public int? AlbumCount { get; set; }
public int? ArtistCount { get; set; }
/// <summary>
/// Gets or sets the music video count.
/// </summary>
@@ -621,18 +648,31 @@ namespace MediaBrowser.Model.Dto
public bool? LockData { get; set; }
public int? Width { get; set; }
public int? Height { get; set; }
public string CameraMake { get; set; }
public string CameraModel { get; set; }
public string Software { get; set; }
public double? ExposureTime { get; set; }
public double? FocalLength { get; set; }
public ImageOrientation? ImageOrientation { get; set; }
public double? Aperture { get; set; }
public double? ShutterSpeed { get; set; }
public double? Latitude { get; set; }
public double? Longitude { get; set; }
public double? Altitude { get; set; }
public int? IsoSpeedRating { get; set; }
/// <summary>
@@ -735,6 +775,7 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The timer identifier.</value>
public string TimerId { get; set; }
/// <summary>
/// Gets or sets the current program.
/// </summary>

View File

@@ -1,4 +1,7 @@
#nullable disable
using System.Collections.Generic;
using System.Text.Json.Serialization;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
{
@@ -37,6 +40,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the primary image blurhash.
/// </summary>
/// <value>The primary image blurhash.</value>
public Dictionary<ImageType, Dictionary<string, string>> ImageBlurHashes { get; set; }
/// <summary>
/// Gets a value indicating whether this instance has primary image.
/// </summary>

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto

View File

@@ -1,3 +1,4 @@
#nullable disable
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
@@ -20,9 +21,9 @@ namespace MediaBrowser.Model.Dto
public int? ImageIndex { get; set; }
/// <summary>
/// The image tag
/// Gets or sets the image tag.
/// </summary>
public string ImageTag;
public string ImageTag { get; set; }
/// <summary>
/// Gets or sets the path.
@@ -30,6 +31,12 @@ namespace MediaBrowser.Model.Dto
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the blurhash.
/// </summary>
/// <value>The blurhash.</value>
public string BlurHash { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>

View File

@@ -1,3 +1,4 @@
#nullable disable
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
@@ -8,6 +9,14 @@ namespace MediaBrowser.Model.Dto
/// </summary>
public class ImageOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="ImageOptions" /> class.
/// </summary>
public ImageOptions()
{
EnableImageEnhancers = true;
}
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
@@ -52,7 +61,7 @@ namespace MediaBrowser.Model.Dto
/// <summary>
/// Gets or sets the image tag.
/// If set this will result in strong, unconditional response caching
/// If set this will result in strong, unconditional response caching.
/// </summary>
/// <value>The hash.</value>
public string Tag { get; set; }
@@ -98,13 +107,5 @@ namespace MediaBrowser.Model.Dto
/// </summary>
/// <value>The color of the background.</value>
public string BackgroundColor { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ImageOptions" /> class.
/// </summary>
public ImageOptions()
{
EnableImageEnhancers = true;
}
}
}

View File

@@ -1,20 +0,0 @@
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ItemIndex.
/// </summary>
public class ItemIndex
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the item count.
/// </summary>
/// <value>The item count.</value>
public int ItemCount { get; set; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -12,39 +13,56 @@ namespace MediaBrowser.Model.Dto
public class MediaSourceInfo
{
public MediaProtocol Protocol { get; set; }
public string Id { get; set; }
public string Path { get; set; }
public string EncoderPath { get; set; }
public MediaProtocol? EncoderProtocol { get; set; }
public MediaSourceType Type { get; set; }
public string Container { get; set; }
public long? Size { get; set; }
public string Name { get; set; }
/// <summary>
/// Differentiate internet url vs local network
/// Differentiate internet url vs local network.
/// </summary>
public bool IsRemote { get; set; }
public string ETag { get; set; }
public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; }
public bool IgnoreDts { get; set; }
public bool IgnoreIndex { get; set; }
public bool GenPtsInput { get; set; }
public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; }
public bool SupportsDirectPlay { get; set; }
public bool IsInfiniteStream { get; set; }
public bool RequiresOpening { get; set; }
public string OpenToken { get; set; }
public bool RequiresClosing { get; set; }
public string LiveStreamId { get; set; }
public int? BufferMs { get; set; }
public bool RequiresLooping { get; set; }
@@ -66,10 +84,13 @@ namespace MediaBrowser.Model.Dto
public int? Bitrate { get; set; }
public TransportStreamTimestamp? Timestamp { get; set; }
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
public string TranscodingUrl { get; set; }
public string TranscodingSubProtocol { get; set; }
public string TranscodingContainer { get; set; }
public int? AnalyzeDurationMs { get; set; }
@@ -117,6 +138,7 @@ namespace MediaBrowser.Model.Dto
public TranscodeReason[] TranscodeReasons { get; set; }
public int? DefaultAudioStreamIndex { get; set; }
public int? DefaultSubtitleStreamIndex { get; set; }
public MediaStream GetDefaultAudioStream(int? defaultIndex)

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -10,11 +11,15 @@ namespace MediaBrowser.Model.Dto
public class MetadataEditorInfo
{
public ParentalRating[] ParentalRatingOptions { get; set; }
public CountryInfo[] Countries { get; set; }
public CultureDto[] Cultures { get; set; }
public ExternalIdInfo[] ExternalIdInfos { get; set; }
public string ContentType { get; set; }
public NameValuePair[] ContentTypeOptions { get; set; }
public MetadataEditorInfo()

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -22,6 +23,7 @@ namespace MediaBrowser.Model.Dto
public class NameGuidPair
{
public string Name { get; set; }
public Guid Id { get; set; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
@@ -6,7 +7,6 @@ namespace MediaBrowser.Model.Dto
{
public NameValuePair()
{
}
public NameValuePair(string name, string value)

View File

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

View File

@@ -1,3 +1,4 @@
#nullable disable
using System;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Users;

View File

@@ -1,3 +1,4 @@
#nullable disable
using System;
namespace MediaBrowser.Model.Dto

View File

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

View File

@@ -1,21 +1,18 @@
#nullable disable
using System.Collections.Generic;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Defines the display preferences for any item that supports them (usually Folders).
/// </summary>
public class DisplayPreferences
public class DisplayPreferencesDto
{
/// <summary>
/// The image scale.
/// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
/// </summary>
private const double ImageScale = .9;
/// <summary>
/// Initializes a new instance of the <see cref="DisplayPreferences" /> class.
/// </summary>
public DisplayPreferences()
public DisplayPreferencesDto()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
@@ -103,7 +100,7 @@ namespace MediaBrowser.Model.Entities
public bool ShowSidebar { get; set; }
/// <summary>
/// Gets or sets the client
/// Gets or sets the client.
/// </summary>
public string Client { get; set; }
}

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repition by using extension methods.
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary>
public interface IHasProviderIds
{

View File

@@ -63,6 +63,11 @@ namespace MediaBrowser.Model.Entities
/// <summary>
/// The box rear.
/// </summary>
BoxRear = 11
BoxRear = 11,
/// <summary>
/// The user profile image.
/// </summary>
Profile = 12
}
}

View File

@@ -5,15 +5,29 @@ using System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class LibraryUpdateInfo
/// Class LibraryUpdateInfo.
/// </summary>
public class LibraryUpdateInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary>
public LibraryUpdateInfo()
{
FoldersAddedTo = Array.Empty<string>();
FoldersRemovedFrom = Array.Empty<string>();
ItemsAdded = Array.Empty<string>();
ItemsRemoved = Array.Empty<string>();
ItemsUpdated = Array.Empty<string>();
CollectionFolders = Array.Empty<string>();
}
/// <summary>
/// Gets or sets the folders added to.
/// </summary>
/// <value>The folders added to.</value>
public string[] FoldersAddedTo { get; set; }
/// <summary>
/// Gets or sets the folders removed from.
/// </summary>
@@ -41,18 +55,5 @@ namespace MediaBrowser.Model.Entities
public string[] CollectionFolders { get; set; }
public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0;
/// <summary>
/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class.
/// </summary>
public LibraryUpdateInfo()
{
FoldersAddedTo = Array.Empty<string>();
FoldersRemovedFrom = Array.Empty<string>();
ItemsAdded = Array.Empty<string>();
ItemsRemoved = Array.Empty<string>();
ItemsUpdated = Array.Empty<string>();
CollectionFolders = Array.Empty<string>();
}
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
namespace MediaBrowser.Model.Entities
{
/// <summary>

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -12,7 +13,7 @@ using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class MediaStream
/// Class MediaStream.
/// </summary>
public class MediaStream
{
@@ -34,6 +35,18 @@ namespace MediaBrowser.Model.Entities
/// <value>The language.</value>
public string Language { get; set; }
/// <summary>
/// Gets or sets the color range.
/// </summary>
/// <value>The color range.</value>
public string ColorRange { get; set; }
/// <summary>
/// Gets or sets the color space.
/// </summary>
/// <value>The color space.</value>
public string ColorSpace { get; set; }
/// <summary>
/// Gets or sets the color transfer.
/// </summary>
@@ -46,12 +59,6 @@ namespace MediaBrowser.Model.Entities
/// <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>
/// Gets or sets the comment.
/// </summary>
@@ -111,106 +118,146 @@ namespace MediaBrowser.Model.Entities
{
get
{
if (Type == MediaStreamType.Audio)
switch (Type)
{
//if (!string.IsNullOrEmpty(Title))
//{
// return AddLanguageIfNeeded(Title);
//}
case MediaStreamType.Audio:
{
var attributes = new List<string>();
var attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
string fullLanguage = CultureInfo
.GetCultures(CultureTypes.NeutralCultures)
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
?.DisplayName;
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
}
if (!string.IsNullOrEmpty(Language))
{
attributes.Add(StringHelper.FirstToUpper(Language));
}
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(AudioCodec.GetFriendlyName(Codec));
}
else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(Profile);
if (!string.IsNullOrEmpty(Codec) && !string.Equals(Codec, "dca", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(AudioCodec.GetFriendlyName(Codec));
}
else if (!string.IsNullOrEmpty(Profile) && !string.Equals(Profile, "lc", StringComparison.OrdinalIgnoreCase))
{
attributes.Add(Profile);
}
if (!string.IsNullOrEmpty(ChannelLayout))
{
attributes.Add(StringHelper.FirstToUpper(ChannelLayout));
}
else if (Channels.HasValue)
{
attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(" - ", attributes);
}
if (!string.IsNullOrEmpty(ChannelLayout))
case MediaStreamType.Video:
{
attributes.Add(ChannelLayout);
}
else if (Channels.HasValue)
{
attributes.Add(Channels.Value.ToString(CultureInfo.InvariantCulture) + " ch");
}
if (IsDefault)
{
attributes.Add("Default");
var attributes = new List<string>();
var resolutionText = GetResolutionText();
if (!string.IsNullOrEmpty(resolutionText))
{
attributes.Add(resolutionText);
}
if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(Codec.ToUpperInvariant());
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(" ", attributes);
}
return string.Join(" ", attributes);
case MediaStreamType.Subtitle:
{
var attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
// Get full language string i.e. eng -> English. Will not work for some languages which use ISO 639-2/B instead of /T codes.
string fullLanguage = CultureInfo
.GetCultures(CultureTypes.NeutralCultures)
.FirstOrDefault(r => r.ThreeLetterISOLanguageName.Equals(Language, StringComparison.OrdinalIgnoreCase))
?.DisplayName;
attributes.Add(StringHelper.FirstToUpper(fullLanguage ?? Language));
}
else
{
attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
}
if (IsForced)
{
attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
}
if (!string.IsNullOrEmpty(Title))
{
var result = new StringBuilder(Title);
foreach (var tag in attributes)
{
// Keep Tags that are not already in Title.
if (Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
{
result.Append(" - ").Append(tag);
}
}
return result.ToString();
}
return string.Join(" - ", attributes);
}
default:
return null;
}
if (Type == MediaStreamType.Video)
{
var attributes = new List<string>();
var resolutionText = GetResolutionText();
if (!string.IsNullOrEmpty(resolutionText))
{
attributes.Add(resolutionText);
}
if (!string.IsNullOrEmpty(Codec))
{
attributes.Add(Codec.ToUpperInvariant());
}
return string.Join(" ", attributes);
}
if (Type == MediaStreamType.Subtitle)
{
var attributes = new List<string>();
if (!string.IsNullOrEmpty(Language))
{
attributes.Add(StringHelper.FirstToUpper(Language));
}
else
{
attributes.Add(string.IsNullOrEmpty(localizedUndefined) ? "Und" : localizedUndefined);
}
if (IsDefault)
{
attributes.Add(string.IsNullOrEmpty(localizedDefault) ? "Default" : localizedDefault);
}
if (IsForced)
{
attributes.Add(string.IsNullOrEmpty(localizedForced) ? "Forced" : localizedForced);
}
if (!string.IsNullOrEmpty(Title))
{
return attributes.AsEnumerable()
// keep Tags that are not already in Title
.Where(tag => Title.IndexOf(tag, StringComparison.OrdinalIgnoreCase) == -1)
// attributes concatenation, starting with Title
.Aggregate(new StringBuilder(Title), (builder, attr) => builder.Append(" - ").Append(attr))
.ToString();
}
return string.Join(" - ", attributes.ToArray());
}
if (Type == MediaStreamType.Video)
{
}
return null;
}
}
@@ -227,30 +274,37 @@ namespace MediaBrowser.Model.Entities
{
return "4K";
}
if (width >= 2500)
{
if (i.IsInterlaced)
{
return "1440i";
}
return "1440p";
}
if (width >= 1900 || height >= 1000)
{
if (i.IsInterlaced)
{
return "1080i";
}
return "1080p";
}
if (width >= 1260 || height >= 700)
{
if (i.IsInterlaced)
{
return "720i";
}
return "720p";
}
if (width >= 700 || height >= 440)
{
@@ -258,11 +312,13 @@ namespace MediaBrowser.Model.Entities
{
return "480i";
}
return "480p";
}
return "SD";
}
return null;
}
@@ -395,11 +451,13 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The method.</value>
public SubtitleDeliveryMethod? DeliveryMethod { get; set; }
/// <summary>
/// Gets or sets the delivery URL.
/// </summary>
/// <value>The delivery URL.</value>
public string DeliveryUrl { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is external URL.
/// </summary>
@@ -410,7 +468,10 @@ namespace MediaBrowser.Model.Entities
{
get
{
if (Type != MediaStreamType.Subtitle) return false;
if (Type != MediaStreamType.Subtitle)
{
return false;
}
if (string.IsNullOrEmpty(Codec) && !IsExternal)
{
@@ -448,6 +509,7 @@ namespace MediaBrowser.Model.Entities
{
return false;
}
if (string.Equals(fromCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;
@@ -458,6 +520,7 @@ namespace MediaBrowser.Model.Entities
{
return false;
}
if (string.Equals(toCodec, "ssa", StringComparison.OrdinalIgnoreCase))
{
return false;

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
@@ -5,6 +6,7 @@ namespace MediaBrowser.Model.Entities
public class MediaUrl
{
public string Url { get; set; }
public string Name { get; set; }
}
}

View File

@@ -3,7 +3,7 @@ namespace MediaBrowser.Model.Entities
/// <summary>
/// Enum MetadataFields.
/// </summary>
public enum MetadataFields
public enum MetadataField
{
/// <summary>
/// The cast.

View File

@@ -3,28 +3,32 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum MetadataProviders
/// Enum MetadataProviders.
/// </summary>
public enum MetadataProviders
public enum MetadataProvider
{
/// <summary>
/// The imdb
/// The imdb.
/// </summary>
Imdb = 2,
/// <summary>
/// The TMDB
/// The TMDB.
/// </summary>
Tmdb = 3,
/// <summary>
/// The TVDB
/// The TVDB.
/// </summary>
Tvdb = 4,
/// <summary>
/// The tvcom
/// The tvcom.
/// </summary>
Tvcom = 5,
/// <summary>
/// Tmdb Collection Id
/// Tmdb Collection Id.
/// </summary>
TmdbCollection = 7,
MusicBrainzAlbum = 8,

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -7,34 +8,33 @@ namespace MediaBrowser.Model.Entities
public class PackageReviewInfo
{
/// <summary>
/// The package id (database key) for this review
/// Gets or sets the package id (database key) for this review.
/// </summary>
public int id { get; set; }
/// <summary>
/// The rating value
/// Gets or sets the rating value.
/// </summary>
public int rating { get; set; }
/// <summary>
/// Whether or not this review recommends this item
/// Gets or sets whether or not this review recommends this item.
/// </summary>
public bool recommend { get; set; }
/// <summary>
/// A short description of the review
/// Gets or sets a short description of the review.
/// </summary>
public string title { get; set; }
/// <summary>
/// A full review
/// Gets or sets the full review.
/// </summary>
public string review { get; set; }
/// <summary>
/// Time of review
/// Gets or sets the time of review.
/// </summary>
public DateTime timestamp { get; set; }
}
}

View File

@@ -1,12 +1,23 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class ParentalRating
/// Class ParentalRating.
/// </summary>
public class ParentalRating
{
public ParentalRating()
{
}
public ParentalRating(string name, int value)
{
Name = name;
Value = value;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
@@ -18,16 +29,5 @@ namespace MediaBrowser.Model.Entities
/// </summary>
/// <value>The value.</value>
public int Value { get; set; }
public ParentalRating()
{
}
public ParentalRating(string name, int value)
{
Name = name;
Value = value;
}
}
}

View File

@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns><c>true</c> if [has provider identifier] [the specified instance]; otherwise, <c>false</c>.</returns>
public static bool HasProviderId(this IHasProviderIds instance, MetadataProviders provider)
public static bool HasProviderId(this IHasProviderIds instance, MetadataProvider provider)
{
return !string.IsNullOrEmpty(instance.GetProviderId(provider.ToString()));
}
@@ -25,7 +25,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, MetadataProviders provider)
public static string? GetProviderId(this IHasProviderIds instance, MetadataProvider provider)
{
return instance.GetProviderId(provider.ToString());
}
@@ -36,7 +36,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="name">The name.</param>
/// <returns>System.String.</returns>
public static string GetProviderId(this IHasProviderIds instance, string name)
public static string? GetProviderId(this IHasProviderIds instance, string name)
{
if (instance == null)
{
@@ -94,7 +94,7 @@ namespace MediaBrowser.Model.Entities
/// <param name="instance">The instance.</param>
/// <param name="provider">The provider.</param>
/// <param name="value">The value.</param>
public static void SetProviderId(this IHasProviderIds instance, MetadataProviders provider, string value)
public static void SetProviderId(this IHasProviderIds instance, MetadataProvider provider, string value)
{
instance.SetProviderId(provider.ToString(), value);
}

View File

@@ -1,18 +0,0 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum ScrollDirection.
/// </summary>
public enum ScrollDirection
{
/// <summary>
/// The horizontal.
/// </summary>
Horizontal,
/// <summary>
/// The vertical.
/// </summary>
Vertical
}
}

View File

@@ -1,18 +0,0 @@
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum SortOrder.
/// </summary>
public enum SortOrder
{
/// <summary>
/// The ascending.
/// </summary>
Ascending,
/// <summary>
/// The descending.
/// </summary>
Descending
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -6,7 +7,7 @@ using MediaBrowser.Model.Configuration;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Used to hold information about a user's list of configured virtual folders
/// Used to hold information about a user's list of configured virtual folders.
/// </summary>
public class VirtualFolderInfo
{
@@ -51,6 +52,7 @@ namespace MediaBrowser.Model.Entities
public string PrimaryImageItemId { get; set; }
public double? RefreshProgress { get; set; }
public string RefreshStatus { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using System;
namespace MediaBrowser.Model.Events
{
/// <summary>
/// Provides a generic EventArgs subclass that can hold any kind of object.
/// </summary>
/// <typeparam name="T"></typeparam>
public class GenericEventArgs<T> : EventArgs
{
/// <summary>
/// Gets or sets the argument.
/// </summary>
/// <value>The argument.</value>
public T Argument { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="GenericEventArgs{T}"/> class.
/// </summary>
/// <param name="arg">The argument.</param>
public GenericEventArgs(T arg)
{
Argument = arg;
}
/// <summary>
/// Initializes a new instance of the <see cref="GenericEventArgs{T}"/> class.
/// </summary>
public GenericEventArgs()
{
}
}
}

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

@@ -12,9 +12,9 @@ namespace MediaBrowser.Model.Extensions
/// <returns>The string with the first character as uppercase.</returns>
public static string FirstToUpper(string str)
{
if (string.IsNullOrEmpty(str))
if (str.Length == 0)
{
return string.Empty;
return str;
}
if (char.IsUpper(str[0]))

View File

@@ -1,3 +1,4 @@
#nullable disable
namespace MediaBrowser.Model.Globalization
{
/// <summary>

View File

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

View File

@@ -1,3 +1,4 @@
#nullable disable
using System.Collections.Generic;
using System.Globalization;
using MediaBrowser.Model.Entities;

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Globalization
@@ -11,6 +12,7 @@ namespace MediaBrowser.Model.Globalization
}
public string Name { get; set; }
public string Value { get; set; }
}
}

View File

@@ -1,26 +1,39 @@
namespace MediaBrowser.Model.IO
{
/// <summary>
/// Class FileSystemEntryInfo
/// Class FileSystemEntryInfo.
/// </summary>
public class FileSystemEntryInfo
{
/// <summary>
/// Gets or sets the name.
/// Initializes a new instance of the <see cref="FileSystemEntryInfo" /> class.
/// </summary>
/// <param name="name">The filename.</param>
/// <param name="path">The file path.</param>
/// <param name="type">The file type.</param>
public FileSystemEntryInfo(string name, string path, FileSystemEntryType type)
{
Name = name;
Path = path;
Type = type;
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
public string Name { get; }
/// <summary>
/// Gets or sets the path.
/// Gets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
public string Path { get; }
/// <summary>
/// Gets or sets the type.
/// Gets the type.
/// </summary>
/// <value>The type.</value>
public FileSystemEntryType Type { get; set; }
public FileSystemEntryType Type { get; }
}
}

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -55,7 +56,7 @@ namespace MediaBrowser.Model.IO
public DateTime CreationTimeUtc { get; set; }
/// <summary>
/// Gets a value indicating whether this instance is directory.
/// Gets or sets a value indicating whether this instance is directory.
/// </summary>
/// <value><c>true</c> if this instance is directory; otherwise, <c>false</c>.</value>
public bool IsDirectory { get; set; }

View File

@@ -1,3 +1,4 @@
#nullable disable
#pragma warning disable CS1591
using System;
@@ -200,9 +201,9 @@ namespace MediaBrowser.Model.IO
IEnumerable<string> GetFileSystemEntryPaths(string path, bool recursive = false);
void SetHidden(string path, bool isHidden);
void SetReadOnly(string path, bool readOnly);
void SetAttributes(string path, bool isHidden, bool readOnly);
List<FileSystemMetadata> GetDrives();
void SetExecutable(string path);
}
}

View File

@@ -16,7 +16,6 @@ namespace MediaBrowser.Model.IO
/// <param name="isoPath">The iso path.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>IsoMount.</returns>
/// <exception cref="ArgumentNullException">isoPath</exception>
/// <exception cref="IOException">Unable to create mount.</exception>
Task<IIsoMount> Mount(string isoPath, CancellationToken cancellationToken);

View File

@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.IO
public interface IIsoMount : IDisposable
{
/// <summary>
/// Gets or sets the iso path.
/// Gets the iso path.
/// </summary>
/// <value>The iso path.</value>
string IsoPath { get; }

Some files were not shown because too many files have changed in this diff Show More