Refactor: standardize namespace and using directive style

Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
This commit is contained in:
2026-02-20 16:26:53 -05:00
parent 44ab9e1d6d
commit af1152b001
1436 changed files with 36615 additions and 15508 deletions
+72 -74
View File
@@ -2,88 +2,86 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Model.Activity;
using global::System;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Model.Activity
{
/// <summary>
/// An activity log entry.
/// </summary>
public class ActivityLogEntry
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLogEntry"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="type">The type.</param>
/// <param name="userId">The user id.</param>
public ActivityLogEntry(string name, string type, Guid userId)
{
Name = name;
Type = type;
UserId = userId;
}
/// <summary>
/// An activity log entry.
/// </summary>
public class ActivityLogEntry
{
/// <summary>
/// Initializes a new instance of the <see cref="ActivityLogEntry"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="type">The type.</param>
/// <param name="userId">The user id.</param>
public ActivityLogEntry(string name, string type, Guid userId)
{
this.Name = name;
this.Type = type;
this.UserId = userId;
}
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public long Id { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the overview.
/// </summary>
/// <value>The overview.</value>
public string? Overview { get; set; }
/// <summary>
/// Gets or sets the overview.
/// </summary>
/// <value>The overview.</value>
public string? Overview { get; set; }
/// <summary>
/// Gets or sets the short overview.
/// </summary>
/// <value>The short overview.</value>
public string? ShortOverview { get; set; }
/// <summary>
/// Gets or sets the short overview.
/// </summary>
/// <value>The short overview.</value>
public string? ShortOverview { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public string Type { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string? ItemId { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string? ItemId { get; set; }
/// <summary>
/// Gets or sets the date.
/// </summary>
/// <value>The date.</value>
public DateTime Date { get; set; }
/// <summary>
/// Gets or sets the date.
/// </summary>
/// <value>The date.</value>
public DateTime Date { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the user primary image tag.
/// </summary>
/// <value>The user primary image tag.</value>
[Obsolete("UserPrimaryImageTag is not used.")]
public string? UserPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the user primary image tag.
/// </summary>
/// <value>The user primary image tag.</value>
[Obsolete("UserPrimaryImageTag is not used.")]
public string? UserPrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the log severity.
/// </summary>
/// <value>The log severity.</value>
public LogLevel Severity { get; set; }
}
}
/// <summary>
/// Gets or sets the log severity.
/// </summary>
/// <value>The log severity.</value>
public LogLevel Severity { get; set; }
}
@@ -2,15 +2,15 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Threading.Tasks;
namespace MediaBrowser.Model.Activity;
using global::System;
using global::System.Threading.Tasks;
using Jellyfin.Data.Events;
using Jellyfin.Data.Queries;
using Jellyfin.Database.Implementations.Entities;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Activity;
/// <summary>
/// Interface for the activity manager.
/// </summary>
@@ -2,46 +2,44 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.ApiClient
{
/// <summary>
/// The server discovery info model.
/// </summary>
public class ServerDiscoveryInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="ServerDiscoveryInfo"/> class.
/// </summary>
/// <param name="address">The server address.</param>
/// <param name="id">The server id.</param>
/// <param name="name">The server name.</param>
/// <param name="endpointAddress">The endpoint address.</param>
public ServerDiscoveryInfo(string address, string id, string name, string? endpointAddress = null)
{
Address = address;
Id = id;
Name = name;
EndpointAddress = endpointAddress;
}
namespace MediaBrowser.Model.ApiClient;
/// <summary>
/// The server discovery info model.
/// </summary>
public class ServerDiscoveryInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="ServerDiscoveryInfo"/> class.
/// </summary>
/// <param name="address">The server address.</param>
/// <param name="id">The server id.</param>
/// <param name="name">The server name.</param>
/// <param name="endpointAddress">The endpoint address.</param>
public ServerDiscoveryInfo(string address, string id, string name, string? endpointAddress = null)
{
Address = address;
Id = id;
Name = name;
EndpointAddress = endpointAddress;
}
/// <summary>
/// Gets the address.
/// </summary>
public string Address { get; }
/// <summary>
/// Gets the address.
/// </summary>
public string Address { get; }
/// <summary>
/// Gets the server identifier.
/// </summary>
public string Id { get; }
/// <summary>
/// Gets the server identifier.
/// </summary>
public string Id { get; }
/// <summary>
/// Gets the name.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the name.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the endpoint address.
/// </summary>
public string? EndpointAddress { get; }
}
}
/// <summary>
/// Gets the endpoint address.
/// </summary>
public string? EndpointAddress { get; }
}
+71 -73
View File
@@ -4,90 +4,88 @@
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Channels
{
public class ChannelFeatures
{
public ChannelFeatures(string name, Guid id)
{
MediaTypes = Array.Empty<ChannelMediaType>();
ContentTypes = Array.Empty<ChannelMediaContentType>();
DefaultSortFields = Array.Empty<ChannelItemSortField>();
namespace MediaBrowser.Model.Channels;
public class ChannelFeatures
{
public ChannelFeatures(string name, Guid id)
{
MediaTypes = Array.Empty<ChannelMediaType>();
ContentTypes = Array.Empty<ChannelMediaContentType>();
DefaultSortFields = Array.Empty<ChannelItemSortField>();
Name = name;
Id = id;
}
Name = name;
Id = id;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can search.
/// </summary>
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
public bool CanSearch { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can search.
/// </summary>
/// <value><c>true</c> if this instance can search; otherwise, <c>false</c>.</value>
public bool CanSearch { get; set; }
/// <summary>
/// Gets or sets the media types.
/// </summary>
/// <value>The media types.</value>
public ChannelMediaType[] MediaTypes { get; set; }
/// <summary>
/// Gets or sets the media types.
/// </summary>
/// <value>The media types.</value>
public ChannelMediaType[] MediaTypes { get; set; }
/// <summary>
/// Gets or sets the content types.
/// </summary>
/// <value>The content types.</value>
public ChannelMediaContentType[] ContentTypes { get; set; }
/// <summary>
/// Gets or sets the content types.
/// </summary>
/// <value>The content types.</value>
public ChannelMediaContentType[] ContentTypes { get; set; }
/// <summary>
/// Gets or sets the maximum number of records the channel allows retrieving at a time.
/// </summary>
public int? MaxPageSize { get; set; }
/// <summary>
/// Gets or sets the maximum number of records the channel allows retrieving at a time.
/// </summary>
public int? MaxPageSize { get; set; }
/// <summary>
/// Gets or sets the automatic refresh levels.
/// </summary>
/// <value>The automatic refresh levels.</value>
public int? AutoRefreshLevels { get; set; }
/// <summary>
/// Gets or sets the automatic refresh levels.
/// </summary>
/// <value>The automatic refresh levels.</value>
public int? AutoRefreshLevels { get; set; }
/// <summary>
/// Gets or sets the default sort orders.
/// </summary>
/// <value>The default sort orders.</value>
public ChannelItemSortField[] DefaultSortFields { get; set; }
/// <summary>
/// Gets or sets the default sort orders.
/// </summary>
/// <value>The default sort orders.</value>
public ChannelItemSortField[] DefaultSortFields { get; set; }
/// <summary>
/// Gets or sets a value indicating whether a sort ascending/descending toggle is supported.
/// </summary>
public bool SupportsSortOrderToggle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether a sort ascending/descending toggle is supported.
/// </summary>
public bool SupportsSortOrderToggle { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest media].
/// </summary>
/// <value><c>true</c> if [supports latest media]; otherwise, <c>false</c>.</value>
public bool SupportsLatestMedia { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest media].
/// </summary>
/// <value><c>true</c> if [supports latest media]; otherwise, <c>false</c>.</value>
public bool SupportsLatestMedia { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can filter.
/// </summary>
/// <value><c>true</c> if this instance can filter; otherwise, <c>false</c>.</value>
public bool CanFilter { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance can filter.
/// </summary>
/// <value><c>true</c> if this instance can filter; otherwise, <c>false</c>.</value>
public bool CanFilter { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports content downloading].
/// </summary>
/// <value><c>true</c> if [supports content downloading]; otherwise, <c>false</c>.</value>
public bool SupportsContentDownloading { get; set; }
}
}
/// <summary>
/// Gets or sets a value indicating whether [supports content downloading].
/// </summary>
/// <value><c>true</c> if [supports content downloading]; otherwise, <c>false</c>.</value>
public bool SupportsContentDownloading { get; set; }
}
@@ -4,20 +4,18 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Channels
{
public enum ChannelFolderType
{
Container = 0,
namespace MediaBrowser.Model.Channels;
public enum ChannelFolderType
{
Container = 0,
MusicAlbum = 1,
MusicAlbum = 1,
PhotoAlbum = 2,
PhotoAlbum = 2,
MusicArtist = 3,
MusicArtist = 3,
Series = 4,
Series = 4,
Season = 5
}
}
Season = 5,
}
@@ -4,16 +4,14 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Channels
{
public enum ChannelItemSortField
{
Name = 0,
CommunityRating = 1,
PremiereDate = 2,
DateCreated = 3,
Runtime = 4,
PlayCount = 5,
CommunityPlayCount = 6
}
}
namespace MediaBrowser.Model.Channels;
public enum ChannelItemSortField
{
Name = 0,
CommunityRating = 1,
PremiereDate = 2,
DateCreated = 3,
Runtime = 4,
PlayCount = 5,
CommunityPlayCount = 6,
}
@@ -4,24 +4,22 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Channels
{
public enum ChannelMediaContentType
{
Clip = 0,
namespace MediaBrowser.Model.Channels;
public enum ChannelMediaContentType
{
Clip = 0,
Podcast = 1,
Podcast = 1,
Trailer = 2,
Trailer = 2,
Movie = 3,
Movie = 3,
Episode = 4,
Episode = 4,
Song = 5,
Song = 5,
MovieExtra = 6,
MovieExtra = 6,
TvExtra = 7
}
}
TvExtra = 7,
}
@@ -4,14 +4,12 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Channels
{
public enum ChannelMediaType
{
Audio = 0,
namespace MediaBrowser.Model.Channels;
public enum ChannelMediaType
{
Audio = 0,
Video = 1,
Video = 1,
Photo = 2
}
}
Photo = 2,
}
+41 -43
View File
@@ -4,60 +4,58 @@
#pragma warning disable CS1591
using System;
using global::System;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
namespace MediaBrowser.Model.Channels
{
public class ChannelQuery
{
/// <summary>
/// Gets or sets the fields to return within the items, in addition to basic information.
/// </summary>
/// <value>The fields.</value>
public ItemFields[]? Fields { get; set; }
namespace MediaBrowser.Model.Channels;
public class ChannelQuery
{
/// <summary>
/// Gets or sets the 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 bool? EnableImages { get; set; }
public int? ImageTypeLimit { get; set; }
public int? ImageTypeLimit { get; set; }
public ImageType[]? EnableImageTypes { get; set; }
public ImageType[]? EnableImageTypes { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the user identifier.
/// </summary>
/// <value>The user identifier.</value>
public Guid UserId { get; set; }
/// <summary>
/// Gets or sets the start index. Use for paging.
/// </summary>
/// <value>The start index.</value>
public int? StartIndex { get; set; }
/// <summary>
/// Gets or sets the start index. Use for paging.
/// </summary>
/// <value>The start index.</value>
public int? StartIndex { get; set; }
/// <summary>
/// Gets or sets the maximum number of items to return.
/// </summary>
/// <value>The limit.</value>
public int? Limit { get; set; }
/// <summary>
/// Gets or sets the maximum number of items to return.
/// </summary>
/// <value>The limit.</value>
public int? Limit { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest items].
/// </summary>
/// <value><c>true</c> if [supports latest items]; otherwise, <c>false</c>.</value>
public bool? SupportsLatestItems { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports latest items].
/// </summary>
/// <value><c>true</c> if [supports latest items]; otherwise, <c>false</c>.</value>
public bool? SupportsLatestItems { get; set; }
public bool? SupportsMediaDeletion { get; set; }
public bool? SupportsMediaDeletion { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </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; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </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? IsRecordingsFolder { get; set; }
public bool RefreshLatestChannelItems { get; set; }
}
}
public bool RefreshLatestChannelItems { get; set; }
}
@@ -4,12 +4,10 @@
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Collections
{
public class CollectionCreationResult
{
public Guid Id { get; set; }
}
}
namespace MediaBrowser.Model.Collections;
public class CollectionCreationResult
{
public Guid Id { get; set; }
}
@@ -2,66 +2,64 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Xml.Serialization;
namespace MediaBrowser.Model.Configuration;
using global::System;
using global::System.Xml.Serialization;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Serves as a common base class for the Server and UI application Configurations
/// ProtoInclude tells Protobuf about subclasses,
/// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
/// </summary>
public class BaseApplicationConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
LogFileRetentionDays = 3;
}
/// <summary>
/// Serves as a common base class for the Server and UI application Configurations
/// ProtoInclude tells Protobuf about subclasses,
/// The number 50 can be any number, so long as it doesn't clash with any of the ProtoMember numbers either here or in subclasses.
/// </summary>
public class BaseApplicationConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class.
/// </summary>
public BaseApplicationConfiguration()
{
this.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; }
/// <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; }
/// <summary>
/// Gets or sets a value indicating whether this instance is first run.
/// </summary>
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
public bool IsStartupWizardCompleted { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is first run.
/// </summary>
/// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
public bool IsStartupWizardCompleted { get; set; }
/// <summary>
/// Gets or sets the cache path.
/// </summary>
/// <value>The cache path.</value>
public string? CachePath { get; set; }
/// <summary>
/// Gets or sets the cache path.
/// </summary>
/// <value>The cache path.</value>
public string? CachePath { get; set; }
/// <summary>
/// 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>
/// 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>
/// 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>
public string? PreviousVersionStr
{
get => PreviousVersion?.ToString();
set
{
if (Version.TryParse(value, out var version))
{
PreviousVersion = version;
}
}
}
}
}
/// <summary>
/// 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>
public string? PreviousVersionStr
{
get => this.PreviousVersion?.ToString();
set
{
if (Version.TryParse(value, out var version))
{
this.PreviousVersion = version;
}
}
}
}
@@ -2,31 +2,29 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// An enum representing the options to disable embedded subs.
/// </summary>
public enum EmbeddedSubtitleOptions
{
/// <summary>
/// Allow all embedded subs.
/// </summary>
AllowAll = 0,
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// An enum representing the options to disable embedded subs.
/// </summary>
public enum EmbeddedSubtitleOptions
{
/// <summary>
/// Allow all embedded subs.
/// </summary>
AllowAll = 0,
/// <summary>
/// Allow only embedded subs that are text based.
/// </summary>
AllowText = 1,
/// <summary>
/// Allow only embedded subs that are text based.
/// </summary>
AllowText = 1,
/// <summary>
/// Allow only embedded subs that are image based.
/// </summary>
AllowImage = 2,
/// <summary>
/// Allow only embedded subs that are image based.
/// </summary>
AllowImage = 2,
/// <summary>
/// Disable all embedded subs.
/// </summary>
AllowNone = 3,
}
}
/// <summary>
/// Disable all embedded subs.
/// </summary>
AllowNone = 3,
}
@@ -5,7 +5,7 @@
#pragma warning disable CA1819 // XML serialization handles collections improperly, so we need to use arrays
#nullable disable
using System.ComponentModel;
using global::System.ComponentModel;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration;
@@ -30,6 +30,7 @@ public class EncodingOptions
EnableSegmentDeletion = false;
SegmentKeepSeconds = 720;
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
VaapiDevice = "/dev/dri/renderD128";
@@ -53,6 +54,7 @@ public class EncodingOptions
EnableDecodingColorDepth10Vp9 = true;
EnableDecodingColorDepth10HevcRext = false;
EnableDecodingColorDepth12HevcRext = false;
// Enhanced Nvdec or system native decoder is required for DoVi to SDR tone-mapping.
EnableEnhancedNvdecDecoder = true;
PreferSystemNativeHwDecoder = true;
@@ -2,26 +2,24 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// An enum representing the options to seek the input audio stream when
/// transcoding HLS segments.
/// </summary>
public enum HlsAudioSeekStrategy
{
/// <summary>
/// If the video stream is transcoded and the audio stream is copied,
/// seek the video stream to the same keyframe as the audio stream. The
/// resulting timestamps in the output streams may be inaccurate.
/// </summary>
DisableAccurateSeek = 0,
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// An enum representing the options to seek the input audio stream when
/// transcoding HLS segments.
/// </summary>
public enum HlsAudioSeekStrategy
{
/// <summary>
/// If the video stream is transcoded and the audio stream is copied,
/// seek the video stream to the same keyframe as the audio stream. The
/// resulting timestamps in the output streams may be inaccurate.
/// </summary>
DisableAccurateSeek = 0,
/// <summary>
/// Prevent audio streams from being copied if the video stream is transcoded.
/// The resulting timestamps will be accurate, but additional audio transcoding
/// overhead will be incurred.
/// </summary>
TranscodeAudio = 1,
}
}
/// <summary>
/// Prevent audio streams from being copied if the video stream is transcoded.
/// The resulting timestamps will be accurate, but additional audio transcoding
/// overhead will be incurred.
/// </summary>
TranscodeAudio = 1,
}
+23 -25
View File
@@ -6,31 +6,29 @@
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration
{
public class ImageOption
{
public ImageOption()
{
Limit = 1;
}
namespace MediaBrowser.Model.Configuration;
public class ImageOption
{
public ImageOption()
{
Limit = 1;
}
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public ImageType Type { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public ImageType Type { get; set; }
/// <summary>
/// Gets or sets the limit.
/// </summary>
/// <value>The limit.</value>
public int Limit { get; set; }
/// <summary>
/// Gets or sets the limit.
/// </summary>
/// <value>The limit.</value>
public int Limit { get; set; }
/// <summary>
/// Gets or sets the minimum width.
/// </summary>
/// <value>The minimum width.</value>
public int MinWidth { get; set; }
}
}
/// <summary>
/// Gets or sets the minimum width.
/// </summary>
/// <value>The minimum width.</value>
public int MinWidth { get; set; }
}
@@ -4,11 +4,9 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public enum ImageSavingConvention
{
Legacy,
Compatible
}
}
namespace MediaBrowser.Model.Configuration;
public enum ImageSavingConvention
{
Legacy,
Compatible
}
+100 -102
View File
@@ -4,154 +4,152 @@
#pragma warning disable CS1591
using System;
using System.ComponentModel;
using System.Linq;
using global::System;
using global::System.ComponentModel;
using global::System.Linq;
namespace MediaBrowser.Model.Configuration
{
public class LibraryOptions
{
private static readonly string[] _defaultTagDelimiters = ["/", "|", ";", "\\"];
namespace MediaBrowser.Model.Configuration;
public class LibraryOptions
{
private static readonly string[] _defaultTagDelimiters = ["/", "|", ";", "\\"];
public LibraryOptions()
{
TypeOptions = Array.Empty<TypeOptions>();
DisabledSubtitleFetchers = Array.Empty<string>();
DisabledMediaSegmentProviders = Array.Empty<string>();
MediaSegmentProviderOrder = Array.Empty<string>();
SubtitleFetcherOrder = Array.Empty<string>();
DisabledLocalMetadataReaders = Array.Empty<string>();
DisabledLyricFetchers = Array.Empty<string>();
LyricFetcherOrder = Array.Empty<string>();
public LibraryOptions()
{
TypeOptions = Array.Empty<TypeOptions>();
DisabledSubtitleFetchers = Array.Empty<string>();
DisabledMediaSegmentProviders = Array.Empty<string>();
MediaSegmentProviderOrder = Array.Empty<string>();
SubtitleFetcherOrder = Array.Empty<string>();
DisabledLocalMetadataReaders = Array.Empty<string>();
DisabledLyricFetchers = Array.Empty<string>();
LyricFetcherOrder = Array.Empty<string>();
SkipSubtitlesIfAudioTrackMatches = true;
RequirePerfectSubtitleMatch = true;
AllowEmbeddedSubtitles = EmbeddedSubtitleOptions.AllowAll;
SkipSubtitlesIfAudioTrackMatches = true;
RequirePerfectSubtitleMatch = true;
AllowEmbeddedSubtitles = EmbeddedSubtitleOptions.AllowAll;
AutomaticallyAddToCollection = false;
EnablePhotos = true;
SaveSubtitlesWithMedia = true;
SaveLyricsWithMedia = false;
SaveTrickplayWithMedia = false;
PathInfos = Array.Empty<MediaPathInfo>();
EnableAutomaticSeriesGrouping = true;
SeasonZeroDisplayName = "Specials";
AutomaticallyAddToCollection = false;
EnablePhotos = true;
SaveSubtitlesWithMedia = true;
SaveLyricsWithMedia = false;
SaveTrickplayWithMedia = false;
PathInfos = Array.Empty<MediaPathInfo>();
EnableAutomaticSeriesGrouping = true;
SeasonZeroDisplayName = "Specials";
PreferNonstandardArtistsTag = false;
UseCustomTagDelimiters = false;
CustomTagDelimiters = _defaultTagDelimiters;
DelimiterWhitelist = Array.Empty<string>();
}
PreferNonstandardArtistsTag = false;
UseCustomTagDelimiters = false;
CustomTagDelimiters = _defaultTagDelimiters;
DelimiterWhitelist = Array.Empty<string>();
}
public bool Enabled { get; set; } = true;
public bool Enabled { get; set; } = true;
public bool EnablePhotos { get; set; }
public bool EnablePhotos { get; set; }
public bool EnableRealtimeMonitor { get; set; }
public bool EnableRealtimeMonitor { get; set; }
public bool EnableLUFSScan { get; set; }
public bool EnableLUFSScan { get; set; }
public bool EnableChapterImageExtraction { get; set; }
public bool EnableChapterImageExtraction { get; set; }
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
public bool ExtractChapterImagesDuringLibraryScan { get; set; }
public bool EnableTrickplayImageExtraction { get; set; }
public bool EnableTrickplayImageExtraction { get; set; }
public bool ExtractTrickplayImagesDuringLibraryScan { get; set; }
public bool ExtractTrickplayImagesDuringLibraryScan { get; set; }
public MediaPathInfo[] PathInfos { get; set; }
public MediaPathInfo[] PathInfos { get; set; }
public bool SaveLocalMetadata { get; set; }
public bool SaveLocalMetadata { get; set; }
[Obsolete("Disable remote providers in TypeOptions instead")]
public bool EnableInternetProviders { get; set; }
[Obsolete("Disable remote providers in TypeOptions instead")]
public bool EnableInternetProviders { get; set; }
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableAutomaticSeriesGrouping { get; set; }
public bool EnableEmbeddedTitles { get; set; }
public bool EnableEmbeddedTitles { get; set; }
public bool EnableEmbeddedExtrasTitles { get; set; }
public bool EnableEmbeddedExtrasTitles { get; set; }
public bool EnableEmbeddedEpisodeInfos { get; set; }
public bool EnableEmbeddedEpisodeInfos { get; set; }
public int AutomaticRefreshIntervalDays { get; set; }
public int AutomaticRefreshIntervalDays { get; set; }
/// <summary>
/// Gets or sets the preferred metadata language.
/// </summary>
/// <value>The preferred metadata language.</value>
public string? PreferredMetadataLanguage { get; set; }
/// <summary>
/// Gets or sets the preferred metadata language.
/// </summary>
/// <value>The preferred metadata language.</value>
public string? PreferredMetadataLanguage { get; set; }
/// <summary>
/// Gets or sets the metadata country code.
/// </summary>
/// <value>The metadata country code.</value>
public string? MetadataCountryCode { get; set; }
/// <summary>
/// Gets or sets the metadata country code.
/// </summary>
/// <value>The metadata country code.</value>
public string? MetadataCountryCode { get; set; }
public string SeasonZeroDisplayName { get; set; }
public string SeasonZeroDisplayName { get; set; }
public string[]? MetadataSavers { get; set; }
public string[]? MetadataSavers { get; set; }
public string[] DisabledLocalMetadataReaders { get; set; }
public string[] DisabledLocalMetadataReaders { get; set; }
public string[]? LocalMetadataReaderOrder { get; set; }
public string[]? LocalMetadataReaderOrder { get; set; }
public string[] DisabledSubtitleFetchers { get; set; }
public string[] DisabledSubtitleFetchers { get; set; }
public string[] SubtitleFetcherOrder { get; set; }
public string[] SubtitleFetcherOrder { get; set; }
public string[] DisabledMediaSegmentProviders { get; set; }
public string[] DisabledMediaSegmentProviders { get; set; }
public string[] MediaSegmentProviderOrder { get; set; }
public string[] MediaSegmentProviderOrder { get; set; }
public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; }
public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; }
public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
public string[]? SubtitleDownloadLanguages { get; set; }
public string[]? SubtitleDownloadLanguages { get; set; }
public bool RequirePerfectSubtitleMatch { get; set; }
public bool RequirePerfectSubtitleMatch { get; set; }
public bool SaveSubtitlesWithMedia { get; set; }
public bool SaveSubtitlesWithMedia { get; set; }
[DefaultValue(false)]
public bool SaveLyricsWithMedia { get; set; }
[DefaultValue(false)]
public bool SaveLyricsWithMedia { get; set; }
[DefaultValue(false)]
public bool SaveTrickplayWithMedia { get; set; }
[DefaultValue(false)]
public bool SaveTrickplayWithMedia { get; set; }
public string[] DisabledLyricFetchers { get; set; }
public string[] DisabledLyricFetchers { get; set; }
public string[] LyricFetcherOrder { get; set; }
public string[] LyricFetcherOrder { get; set; }
[DefaultValue(false)]
public bool PreferNonstandardArtistsTag { get; set; }
[DefaultValue(false)]
public bool PreferNonstandardArtistsTag { get; set; }
[DefaultValue(false)]
public bool UseCustomTagDelimiters { get; set; }
[DefaultValue(false)]
public bool UseCustomTagDelimiters { get; set; }
public string[] CustomTagDelimiters { get; set; }
public string[] CustomTagDelimiters { get; set; }
public string[] DelimiterWhitelist { get; set; }
public string[] DelimiterWhitelist { get; set; }
public bool AutomaticallyAddToCollection { get; set; }
public bool AutomaticallyAddToCollection { get; set; }
public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; }
public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; }
public TypeOptions[] TypeOptions { get; set; }
public TypeOptions[] TypeOptions { get; set; }
public TypeOptions? GetTypeOptions(string type)
{
foreach (var options in TypeOptions)
{
if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase))
{
return options;
}
}
public TypeOptions? GetTypeOptions(string type)
{
foreach (var options in TypeOptions)
{
if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase))
{
return options;
}
}
return null;
}
}
}
return null;
}
}
@@ -4,21 +4,19 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public class MediaPathInfo
{
public MediaPathInfo(string path)
{
Path = path;
}
namespace MediaBrowser.Model.Configuration;
public class MediaPathInfo
{
public MediaPathInfo(string path)
{
Path = path;
}
// Needed for xml serialization
public MediaPathInfo()
{
Path = string.Empty;
}
// Needed for xml serialization
public MediaPathInfo()
{
Path = string.Empty;
}
public string Path { get; set; }
}
}
public string Path { get; set; }
}
@@ -4,15 +4,13 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public class MetadataConfiguration
{
public MetadataConfiguration()
{
UseFileCreationTimeForDateAdded = true;
}
namespace MediaBrowser.Model.Configuration;
public class MetadataConfiguration
{
public MetadataConfiguration()
{
UseFileCreationTimeForDateAdded = true;
}
public bool UseFileCreationTimeForDateAdded { get; set; }
}
}
public bool UseFileCreationTimeForDateAdded { get; set; }
}
@@ -5,37 +5,35 @@
#nullable disable
#pragma warning disable CS1591, CA1819
using System;
using global::System;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class MetadataOptions.
/// </summary>
public class MetadataOptions
{
public MetadataOptions()
{
DisabledMetadataSavers = Array.Empty<string>();
LocalMetadataReaderOrder = Array.Empty<string>();
DisabledMetadataFetchers = Array.Empty<string>();
MetadataFetcherOrder = Array.Empty<string>();
DisabledImageFetchers = Array.Empty<string>();
ImageFetcherOrder = Array.Empty<string>();
}
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// Class MetadataOptions.
/// </summary>
public class MetadataOptions
{
public MetadataOptions()
{
DisabledMetadataSavers = Array.Empty<string>();
LocalMetadataReaderOrder = Array.Empty<string>();
DisabledMetadataFetchers = Array.Empty<string>();
MetadataFetcherOrder = Array.Empty<string>();
DisabledImageFetchers = Array.Empty<string>();
ImageFetcherOrder = Array.Empty<string>();
}
public string ItemType { get; set; }
public string ItemType { get; set; }
public string[] DisabledMetadataSavers { get; set; }
public string[] DisabledMetadataSavers { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] LocalMetadataReaderOrder { get; set; }
public string[] DisabledMetadataFetchers { get; set; }
public string[] DisabledMetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] DisabledImageFetchers { get; set; }
public string[] DisabledImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
}
}
public string[] ImageFetcherOrder { get; set; }
}
@@ -5,20 +5,18 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public class MetadataPlugin
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
namespace MediaBrowser.Model.Configuration;
public class MetadataPlugin
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public MetadataPluginType Type { get; set; }
}
}
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
public MetadataPluginType Type { get; set; }
}
@@ -5,35 +5,33 @@
#nullable disable
#pragma warning disable CS1591
using System;
using global::System;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration
{
public class MetadataPluginSummary
{
public MetadataPluginSummary()
{
SupportedImageTypes = Array.Empty<ImageType>();
Plugins = Array.Empty<MetadataPlugin>();
}
namespace MediaBrowser.Model.Configuration;
public class MetadataPluginSummary
{
public MetadataPluginSummary()
{
SupportedImageTypes = Array.Empty<ImageType>();
Plugins = Array.Empty<MetadataPlugin>();
}
/// <summary>
/// Gets or sets the type of the item.
/// </summary>
/// <value>The type of the item.</value>
public string ItemType { get; set; }
/// <summary>
/// Gets or sets the type of the item.
/// </summary>
/// <value>The type of the item.</value>
public string ItemType { get; set; }
/// <summary>
/// Gets or sets the plugins.
/// </summary>
/// <value>The plugins.</value>
public MetadataPlugin[] Plugins { get; set; }
/// <summary>
/// Gets or sets the plugins.
/// </summary>
/// <value>The plugins.</value>
public MetadataPlugin[] Plugins { get; set; }
/// <summary>
/// Gets or sets the supported image types.
/// </summary>
/// <value>The supported image types.</value>
public ImageType[] SupportedImageTypes { get; set; }
}
}
/// <summary>
/// Gets or sets the supported image types.
/// </summary>
/// <value>The supported image types.</value>
public ImageType[] SupportedImageTypes { get; set; }
}
@@ -4,21 +4,19 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Enum MetadataPluginType.
/// </summary>
public enum MetadataPluginType
{
LocalImageProvider,
ImageFetcher,
ImageSaver,
LocalMetadataProvider,
MetadataFetcher,
MetadataSaver,
SubtitleFetcher,
LyricFetcher,
MediaSegmentProvider
}
}
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// Enum MetadataPluginType.
/// </summary>
public enum MetadataPluginType
{
LocalImageProvider,
ImageFetcher,
ImageSaver,
LocalMetadataProvider,
MetadataFetcher,
MetadataSaver,
SubtitleFetcher,
LyricFetcher,
MediaSegmentProvider
}
@@ -2,21 +2,19 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Defines the <see cref="PathSubstitution" />.
/// </summary>
public class PathSubstitution
{
/// <summary>
/// Gets or sets the value to substitute.
/// </summary>
public string From { get; set; } = string.Empty;
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// Defines the <see cref="PathSubstitution" />.
/// </summary>
public class PathSubstitution
{
/// <summary>
/// Gets or sets the value to substitute.
/// </summary>
public string From { get; set; } = string.Empty;
/// <summary>
/// Gets or sets the value to substitution with.
/// </summary>
public string To { get; set; } = string.Empty;
}
}
/// <summary>
/// Gets or sets the value to substitution with.
/// </summary>
public string To { get; set; } = string.Empty;
}
@@ -5,7 +5,7 @@
#pragma warning disable CS1591
#pragma warning disable CA1819
using System;
using global::System;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.System;
@@ -27,17 +27,17 @@ public class ServerConfiguration : BaseApplicationConfiguration
{
new MetadataOptions()
{
ItemType = "Book"
ItemType = "Book",
},
new MetadataOptions()
{
ItemType = "Movie"
ItemType = "Movie",
},
new MetadataOptions
{
ItemType = "MusicVideo",
DisabledMetadataFetchers = new[] { "The Open Movie Database" },
DisabledImageFetchers = new[] { "The Open Movie Database" }
DisabledImageFetchers = new[] { "The Open Movie Database" },
},
new MetadataOptions
{
@@ -46,16 +46,16 @@ public class ServerConfiguration : BaseApplicationConfiguration
new MetadataOptions
{
ItemType = "MusicAlbum",
DisabledMetadataFetchers = new[] { "TheAudioDB" }
DisabledMetadataFetchers = new[] { "TheAudioDB" },
},
new MetadataOptions
{
ItemType = "MusicArtist",
DisabledMetadataFetchers = new[] { "TheAudioDB" }
DisabledMetadataFetchers = new[] { "TheAudioDB" },
},
new MetadataOptions
{
ItemType = "BoxSet"
ItemType = "BoxSet",
},
new MetadataOptions
{
@@ -2,11 +2,11 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
using System.Diagnostics;
namespace MediaBrowser.Model.Configuration;
using global::System.Collections.Generic;
using global::System.Diagnostics;
/// <summary>
/// Class TrickplayOptions.
/// </summary>
+313 -315
View File
@@ -5,365 +5,363 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using global::System;
using global::System.Collections.Generic;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Configuration
{
public class TypeOptions
{
public static readonly ImageOption DefaultInstance = new ImageOption();
namespace MediaBrowser.Model.Configuration;
public class TypeOptions
{
public static readonly ImageOption DefaultInstance = new ImageOption();
public static readonly Dictionary<string, ImageOption[]> DefaultImageOptions = new Dictionary<string, ImageOption[]>
{
{
"Movie", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
public static readonly Dictionary<string, ImageOption[]> DefaultImageOptions = new Dictionary<string, ImageOption[]>
{
{
"Movie", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"MusicVideo", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo,
}
}
},
{
"MusicVideo", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"Series", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo,
}
}
},
{
"Series", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 1,
Type = ImageType.Banner,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"MusicAlbum", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo,
}
}
},
{
"MusicAlbum", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
}
}
},
{
"MusicArtist", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc,
}
}
},
{
"MusicArtist", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
// Don't download this by default
// They do look great, but most artists won't have them, which means a banner view isn't really possible
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
// Don't download this by default
// They do look great, but most artists won't have them, which means a banner view isn't really possible
new ImageOption
{
Limit = 0,
Type = ImageType.Banner,
},
// Don't download this by default
// Generally not used
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default
// Generally not used
new ImageOption
{
Limit = 0,
Type = ImageType.Art,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
}
}
},
{
"BoxSet", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo,
}
}
},
{
"BoxSet", new[]
{
new ImageOption
{
Limit = 1,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb
},
new ImageOption
{
Limit = 1,
Type = ImageType.Thumb,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo
},
new ImageOption
{
Limit = 1,
Type = ImageType.Logo,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Art,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Disc,
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
}
}
},
{
"Season", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
// Don't download this by default as it's rarely used.
new ImageOption
{
Limit = 0,
Type = ImageType.Banner,
}
}
},
{
"Season", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner
},
new ImageOption
{
Limit = 0,
Type = ImageType.Banner,
},
new ImageOption
{
Limit = 0,
Type = ImageType.Thumb
}
}
},
{
"Episode", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop
},
new ImageOption
{
Limit = 0,
Type = ImageType.Thumb,
}
}
},
{
"Episode", new[]
{
new ImageOption
{
Limit = 0,
MinWidth = 1280,
Type = ImageType.Backdrop,
},
new ImageOption
{
Limit = 1,
Type = ImageType.Primary
}
}
}
};
new ImageOption
{
Limit = 1,
Type = ImageType.Primary,
}
}
}
};
public TypeOptions()
{
MetadataFetchers = Array.Empty<string>();
MetadataFetcherOrder = Array.Empty<string>();
ImageFetchers = Array.Empty<string>();
ImageFetcherOrder = Array.Empty<string>();
ImageOptions = Array.Empty<ImageOption>();
}
public TypeOptions()
{
MetadataFetchers = Array.Empty<string>();
MetadataFetcherOrder = Array.Empty<string>();
ImageFetchers = Array.Empty<string>();
ImageFetcherOrder = Array.Empty<string>();
ImageOptions = Array.Empty<ImageOption>();
}
public string Type { get; set; }
public string Type { get; set; }
public string[] MetadataFetchers { get; set; }
public string[] MetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] ImageFetchers { get; set; }
public string[] ImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
public string[] ImageFetcherOrder { get; set; }
public ImageOption[] ImageOptions { get; set; }
public ImageOption[] ImageOptions { get; set; }
public ImageOption GetImageOptions(ImageType type)
{
foreach (var i in ImageOptions)
{
if (i.Type == type)
{
return i;
}
}
public ImageOption GetImageOptions(ImageType type)
{
foreach (var i in ImageOptions)
{
if (i.Type == type)
{
return i;
}
}
if (DefaultImageOptions.TryGetValue(Type, out ImageOption[] options))
{
foreach (var i in options)
{
if (i.Type == type)
{
return i;
}
}
}
if (DefaultImageOptions.TryGetValue(Type, out ImageOption[] options))
{
foreach (var i in options)
{
if (i.Type == type)
{
return i;
}
}
}
return DefaultInstance;
}
return DefaultInstance;
}
public int GetLimit(ImageType type)
{
return GetImageOptions(type).Limit;
}
public int GetLimit(ImageType type)
{
return GetImageOptions(type).Limit;
}
public int GetMinWidth(ImageType type)
{
return GetImageOptions(type).MinWidth;
}
public int GetMinWidth(ImageType type)
{
return GetImageOptions(type).MinWidth;
}
public bool IsEnabled(ImageType type)
{
return GetLimit(type) > 0;
}
}
}
public bool IsEnabled(ImageType type)
{
return GetLimit(type) > 0;
}
}
@@ -4,79 +4,77 @@
#pragma warning disable CS1591
using System;
using global::System;
using Jellyfin.Database.Implementations.Enums;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class UserConfiguration.
/// </summary>
public class UserConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary>
public UserConfiguration()
{
EnableNextEpisodeAutoPlay = true;
RememberAudioSelections = true;
RememberSubtitleSelections = true;
namespace MediaBrowser.Model.Configuration;
/// <summary>
/// Class UserConfiguration.
/// </summary>
public class UserConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="UserConfiguration" /> class.
/// </summary>
public UserConfiguration()
{
EnableNextEpisodeAutoPlay = true;
RememberAudioSelections = true;
RememberSubtitleSelections = true;
HidePlayedInLatest = true;
PlayDefaultAudioTrack = true;
HidePlayedInLatest = true;
PlayDefaultAudioTrack = true;
LatestItemsExcludes = Array.Empty<Guid>();
OrderedViews = Array.Empty<Guid>();
MyMediaExcludes = Array.Empty<Guid>();
GroupedFolders = Array.Empty<Guid>();
}
LatestItemsExcludes = Array.Empty<Guid>();
OrderedViews = Array.Empty<Guid>();
MyMediaExcludes = Array.Empty<Guid>();
GroupedFolders = Array.Empty<Guid>();
}
/// <summary>
/// Gets or sets the audio language preference.
/// </summary>
/// <value>The audio language preference.</value>
public string? AudioLanguagePreference { get; set; }
/// <summary>
/// Gets or sets the audio language preference.
/// </summary>
/// <value>The audio language preference.</value>
public string? AudioLanguagePreference { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [play default audio track].
/// </summary>
/// <value><c>true</c> if [play default audio track]; otherwise, <c>false</c>.</value>
public bool PlayDefaultAudioTrack { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [play default audio track].
/// </summary>
/// <value><c>true</c> if [play default audio track]; otherwise, <c>false</c>.</value>
public bool PlayDefaultAudioTrack { get; set; }
/// <summary>
/// Gets or sets the subtitle language preference.
/// </summary>
/// <value>The subtitle language preference.</value>
public string? SubtitleLanguagePreference { get; set; }
/// <summary>
/// Gets or sets the subtitle language preference.
/// </summary>
/// <value>The subtitle language preference.</value>
public string? SubtitleLanguagePreference { get; set; }
public bool DisplayMissingEpisodes { get; set; }
public bool DisplayMissingEpisodes { get; set; }
public Guid[] GroupedFolders { get; set; }
public Guid[] GroupedFolders { get; set; }
public SubtitlePlaybackMode SubtitleMode { get; set; }
public SubtitlePlaybackMode SubtitleMode { get; set; }
public bool DisplayCollectionsView { get; set; }
public bool DisplayCollectionsView { get; set; }
public bool EnableLocalPassword { get; set; }
public bool EnableLocalPassword { get; set; }
public Guid[] OrderedViews { get; set; }
public Guid[] OrderedViews { get; set; }
public Guid[] LatestItemsExcludes { get; set; }
public Guid[] LatestItemsExcludes { get; set; }
public Guid[] MyMediaExcludes { get; set; }
public Guid[] MyMediaExcludes { get; set; }
public bool HidePlayedInLatest { get; set; }
public bool HidePlayedInLatest { get; set; }
public bool RememberAudioSelections { get; set; }
public bool RememberAudioSelections { get; set; }
public bool RememberSubtitleSelections { get; set; }
public bool RememberSubtitleSelections { get; set; }
public bool EnableNextEpisodeAutoPlay { get; set; }
public bool EnableNextEpisodeAutoPlay { get; set; }
/// <summary>
/// Gets or sets the id of the selected cast receiver.
/// </summary>
public string? CastReceiverId { get; set; }
}
}
/// <summary>
/// Gets or sets the id of the selected cast receiver.
/// </summary>
public string? CastReceiverId { get; set; }
}
@@ -4,26 +4,24 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Configuration
{
public class XbmcMetadataOptions
{
public XbmcMetadataOptions()
namespace MediaBrowser.Model.Configuration;
public class XbmcMetadataOptions
{
public XbmcMetadataOptions()
{
ReleaseDateFormat = "yyyy-MM-dd";
this.ReleaseDateFormat = "yyyy-MM-dd";
SaveImagePathsInNfo = true;
EnablePathSubstitution = true;
this.SaveImagePathsInNfo = true;
this.EnablePathSubstitution = true;
}
public string? UserId { get; set; }
public string? UserId { get; set; }
public string ReleaseDateFormat { get; set; }
public string ReleaseDateFormat { get; set; }
public bool SaveImagePathsInNfo { get; set; }
public bool SaveImagePathsInNfo { get; set; }
public bool EnablePathSubstitution { get; set; }
public bool EnablePathSubstitution { get; set; }
public bool EnableExtraThumbsDuplication { get; set; }
}
}
public bool EnableExtraThumbsDuplication { get; set; }
}
+19 -21
View File
@@ -2,26 +2,24 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Cryptography
{
/// <summary>
/// Class containing global constants for Jellyfin Cryptography.
/// </summary>
public static class Constants
{
/// <summary>
/// The default length for new salts.
/// </summary>
public const int DefaultSaltLength = 128 / 8;
namespace MediaBrowser.Model.Cryptography;
/// <summary>
/// Class containing global constants for Jellyfin Cryptography.
/// </summary>
public static class Constants
{
/// <summary>
/// The default length for new salts.
/// </summary>
public const int DefaultSaltLength = 128 / 8;
/// <summary>
/// The default output length.
/// </summary>
public const int DefaultOutputLength = 512 / 8;
/// <summary>
/// The default output length.
/// </summary>
public const int DefaultOutputLength = 512 / 8;
/// <summary>
/// The default amount of iterations for hashing passwords.
/// </summary>
public const int DefaultIterations = 210000;
}
}
/// <summary>
/// The default amount of iterations for hashing passwords.
/// </summary>
public const int DefaultIterations = 210000;
}
@@ -4,25 +4,23 @@
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Cryptography
{
public interface ICryptoProvider
{
string DefaultHashMethod { get; }
namespace MediaBrowser.Model.Cryptography;
public interface ICryptoProvider
{
string DefaultHashMethod { get; }
/// <summary>
/// Creates a new <see cref="PasswordHash" /> instance.
/// </summary>
/// <param name="password">The password that will be hashed.</param>
/// <returns>A <see cref="PasswordHash" /> instance with the hash method, hash, salt and number of iterations.</returns>
PasswordHash CreatePasswordHash(ReadOnlySpan<char> password);
/// <summary>
/// Creates a new <see cref="PasswordHash" /> instance.
/// </summary>
/// <param name="password">The password that will be hashed.</param>
/// <returns>A <see cref="PasswordHash" /> instance with the hash method, hash, salt and number of iterations.</returns>
PasswordHash CreatePasswordHash(ReadOnlySpan<char> password);
bool Verify(PasswordHash hash, ReadOnlySpan<char> password);
bool Verify(PasswordHash hash, ReadOnlySpan<char> password);
byte[] GenerateSalt();
byte[] GenerateSalt();
byte[] GenerateSalt(int length);
}
}
byte[] GenerateSalt(int length);
}
+175 -176
View File
@@ -4,213 +4,212 @@
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using System.Text;
using global::System;
using global::System.Collections.Generic;
using global::System.Text;
namespace MediaBrowser.Model.Cryptography
{
// Defined from this hash storage spec
// https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md
// $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
// with one slight amendment to ease the transition, we're writing out the bytes in hex
// rather than making them a BASE64 string with stripped padding
public class PasswordHash
{
private readonly Dictionary<string, string> _parameters;
private readonly byte[] _salt;
private readonly byte[] _hash;
namespace MediaBrowser.Model.Cryptography;
public PasswordHash(string id, byte[] hash)
: this(id, hash, Array.Empty<byte>())
{
}
// Defined from this hash storage spec
// https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md
// $<id>[$<param>=<value>(,<param>=<value>)*][$<salt>[$<hash>]]
// with one slight amendment to ease the transition, we're writing out the bytes in hex
// rather than making them a BASE64 string with stripped padding
public class PasswordHash
{
private readonly Dictionary<string, string> _parameters;
private readonly byte[] _salt;
private readonly byte[] _hash;
public PasswordHash(string id, byte[] hash, byte[] salt)
: this(id, hash, salt, new Dictionary<string, string>())
{
}
public PasswordHash(string id, byte[] hash)
: this(id, hash, Array.Empty<byte>())
{
}
public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters)
{
ArgumentException.ThrowIfNullOrEmpty(id);
public PasswordHash(string id, byte[] hash, byte[] salt)
: this(id, hash, salt, new Dictionary<string, string>())
{
}
Id = id;
_hash = hash;
_salt = salt;
_parameters = parameters;
}
public PasswordHash(string id, byte[] hash, byte[] salt, Dictionary<string, string> parameters)
{
ArgumentException.ThrowIfNullOrEmpty(id);
/// <summary>
/// Gets the symbolic name for the function used.
/// </summary>
/// <value>Returns the symbolic name for the function used.</value>
public string Id { get; }
Id = id;
_hash = hash;
_salt = salt;
_parameters = parameters;
}
/// <summary>
/// Gets the additional parameters used by the hash function.
/// </summary>
public IReadOnlyDictionary<string, string> Parameters => _parameters;
/// <summary>
/// Gets the symbolic name for the function used.
/// </summary>
/// <value>Returns the symbolic name for the function used.</value>
public string Id { get; }
/// <summary>
/// Gets the salt used for hashing the password.
/// </summary>
/// <value>Returns the salt used for hashing the password.</value>
public ReadOnlySpan<byte> Salt => _salt;
/// <summary>
/// Gets the additional parameters used by the hash function.
/// </summary>
public IReadOnlyDictionary<string, string> Parameters => _parameters;
/// <summary>
/// Gets the hashed password.
/// </summary>
/// <value>Return the hashed password.</value>
public ReadOnlySpan<byte> Hash => _hash;
/// <summary>
/// Gets the salt used for hashing the password.
/// </summary>
/// <value>Returns the salt used for hashing the password.</value>
public ReadOnlySpan<byte> Salt => _salt;
public static PasswordHash Parse(ReadOnlySpan<char> hashString)
{
if (hashString.IsEmpty)
{
throw new ArgumentException("String can't be empty", nameof(hashString));
}
/// <summary>
/// Gets the hashed password.
/// </summary>
/// <value>Return the hashed password.</value>
public ReadOnlySpan<byte> Hash => _hash;
if (hashString[0] != '$')
{
throw new FormatException("Hash string must start with a $");
}
public static PasswordHash Parse(ReadOnlySpan<char> hashString)
{
if (hashString.IsEmpty)
{
throw new ArgumentException("String can't be empty", nameof(hashString));
}
// Ignore first $
hashString = hashString[1..];
if (hashString[0] != '$')
{
throw new FormatException("Hash string must start with a $");
}
int nextSegment = hashString.IndexOf('$');
if (hashString.IsEmpty || nextSegment == 0)
{
throw new FormatException("Hash string must contain a valid id");
}
// Ignore first $
hashString = hashString[1..];
if (nextSegment == -1)
{
return new PasswordHash(hashString.ToString(), Array.Empty<byte>());
}
int nextSegment = hashString.IndexOf('$');
if (hashString.IsEmpty || nextSegment == 0)
{
throw new FormatException("Hash string must contain a valid id");
}
ReadOnlySpan<char> id = hashString[..nextSegment];
hashString = hashString[(nextSegment + 1)..];
Dictionary<string, string>? parameters = null;
if (nextSegment == -1)
{
return new PasswordHash(hashString.ToString(), Array.Empty<byte>());
}
nextSegment = hashString.IndexOf('$');
ReadOnlySpan<char> id = hashString[..nextSegment];
hashString = hashString[(nextSegment + 1)..];
Dictionary<string, string>? parameters = null;
// Optional parameters
ReadOnlySpan<char> parametersSpan = nextSegment == -1 ? hashString : hashString[..nextSegment];
if (parametersSpan.Contains('='))
{
while (!parametersSpan.IsEmpty)
{
ReadOnlySpan<char> parameter;
int index = parametersSpan.IndexOf(',');
if (index == -1)
{
parameter = parametersSpan;
parametersSpan = ReadOnlySpan<char>.Empty;
}
else
{
parameter = parametersSpan[..index];
parametersSpan = parametersSpan[(index + 1)..];
}
nextSegment = hashString.IndexOf('$');
int splitIndex = parameter.IndexOf('=');
if (splitIndex == -1 || splitIndex == 0 || splitIndex == parameter.Length - 1)
{
throw new FormatException("Malformed parameter in password hash string");
}
// Optional parameters
ReadOnlySpan<char> parametersSpan = nextSegment == -1 ? hashString : hashString[..nextSegment];
if (parametersSpan.Contains('='))
{
while (!parametersSpan.IsEmpty)
{
ReadOnlySpan<char> parameter;
int index = parametersSpan.IndexOf(',');
if (index == -1)
{
parameter = parametersSpan;
parametersSpan = ReadOnlySpan<char>.Empty;
}
else
{
parameter = parametersSpan[..index];
parametersSpan = parametersSpan[(index + 1)..];
}
(parameters ??= new Dictionary<string, string>()).Add(
parameter[..splitIndex].ToString(),
parameter[(splitIndex + 1)..].ToString());
}
int splitIndex = parameter.IndexOf('=');
if (splitIndex == -1 || splitIndex == 0 || splitIndex == parameter.Length - 1)
{
throw new FormatException("Malformed parameter in password hash string");
}
if (nextSegment == -1)
{
// parameters can't be null here
return new PasswordHash(id.ToString(), Array.Empty<byte>(), Array.Empty<byte>(), parameters!);
}
(parameters ??= new Dictionary<string, string>()).Add(
parameter[..splitIndex].ToString(),
parameter[(splitIndex + 1)..].ToString());
}
hashString = hashString[(nextSegment + 1)..];
nextSegment = hashString.IndexOf('$');
}
if (nextSegment == -1)
{
// parameters can't be null here
return new PasswordHash(id.ToString(), Array.Empty<byte>(), Array.Empty<byte>(), parameters!);
}
if (nextSegment == 0)
{
throw new FormatException("Hash string contains an empty segment");
}
hashString = hashString[(nextSegment + 1)..];
nextSegment = hashString.IndexOf('$');
}
byte[] hash;
byte[] salt;
if (nextSegment == 0)
{
throw new FormatException("Hash string contains an empty segment");
}
if (nextSegment == -1)
{
salt = Array.Empty<byte>();
hash = Convert.FromHexString(hashString);
}
else
{
salt = Convert.FromHexString(hashString[..nextSegment]);
hashString = hashString[(nextSegment + 1)..];
nextSegment = hashString.IndexOf('$');
if (nextSegment != -1)
{
throw new FormatException("Hash string contains too many segments");
}
byte[] hash;
byte[] salt;
if (hashString.IsEmpty)
{
throw new FormatException("Hash segment is empty");
}
if (nextSegment == -1)
{
salt = Array.Empty<byte>();
hash = Convert.FromHexString(hashString);
}
else
{
salt = Convert.FromHexString(hashString[..nextSegment]);
hashString = hashString[(nextSegment + 1)..];
nextSegment = hashString.IndexOf('$');
if (nextSegment != -1)
{
throw new FormatException("Hash string contains too many segments");
}
hash = Convert.FromHexString(hashString);
}
if (hashString.IsEmpty)
{
throw new FormatException("Hash segment is empty");
}
return new PasswordHash(id.ToString(), hash, salt, parameters ?? new Dictionary<string, string>());
}
hash = Convert.FromHexString(hashString);
}
private void SerializeParameters(StringBuilder stringBuilder)
{
if (_parameters.Count == 0)
{
return;
}
return new PasswordHash(id.ToString(), hash, salt, parameters ?? new Dictionary<string, string>());
}
stringBuilder.Append('$');
foreach (var pair in _parameters)
{
stringBuilder.Append(pair.Key)
.Append('=')
.Append(pair.Value)
.Append(',');
}
private void SerializeParameters(StringBuilder stringBuilder)
{
if (_parameters.Count == 0)
{
return;
}
// Remove last ','
stringBuilder.Length -= 1;
}
stringBuilder.Append('$');
foreach (var pair in _parameters)
{
stringBuilder.Append(pair.Key)
.Append('=')
.Append(pair.Value)
.Append(',');
}
/// <inheritdoc />
public override string ToString()
{
var str = new StringBuilder()
.Append('$')
.Append(Id);
SerializeParameters(str);
// Remove last ','
stringBuilder.Length -= 1;
}
if (_salt.Length != 0)
{
str.Append('$')
.Append(Convert.ToHexString(_salt));
}
/// <inheritdoc />
public override string ToString()
{
var str = new StringBuilder()
.Append('$')
.Append(Id);
SerializeParameters(str);
if (_hash.Length != 0)
{
str.Append('$')
.Append(Convert.ToHexString(_hash));
}
if (_salt.Length != 0)
{
str.Append('$')
.Append(Convert.ToHexString(_salt));
}
return str.ToString();
}
}
}
if (_hash.Length != 0)
{
str.Append('$')
.Append(Convert.ToHexString(_hash));
}
return str.ToString();
}
}
+4 -4
View File
@@ -2,11 +2,11 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Devices;
using global::System;
using MediaBrowser.Model.Session;
/// <summary>
/// A class for device Information.
/// </summary>
@@ -17,7 +17,7 @@ public class DeviceInfo
/// </summary>
public DeviceInfo()
{
Capabilities = new ClientCapabilities();
this.Capabilities = new ClientCapabilities();
}
/// <summary>
+39 -32
View File
@@ -2,14 +2,16 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
#pragma warning disable SA1615 // Element should be documented
namespace MediaBrowser.Model.Dlna;
using global::System;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
/// <summary>
/// Defines the <see cref="CodecProfile"/>.
/// </summary>
@@ -20,8 +22,8 @@ public class CodecProfile
/// </summary>
public CodecProfile()
{
Conditions = [];
ApplyConditions = [];
this.Conditions = [];
this.ApplyConditions = [];
}
/// <summary>
@@ -33,12 +35,12 @@ public class CodecProfile
/// <summary>
/// Gets or sets the list of <see cref="ProfileCondition"/> which this profile must meet.
/// </summary>
public ProfileCondition[] Conditions { get; set; }
public List<ProfileCondition> Conditions { get; set; } = [];
/// <summary>
/// Gets or sets the list of <see cref="ProfileCondition"/> to apply if this profile is met.
/// </summary>
public ProfileCondition[] ApplyConditions { get; set; }
public List<ProfileCondition> ApplyConditions { get; set; } = [];
/// <summary>
/// Gets or sets the codec(s) that this profile applies to.
@@ -61,38 +63,43 @@ public class CodecProfile
/// <summary>
/// Checks to see whether the codecs and containers contain the given parameters.
/// </summary>
/// <param name="codecs">The codecs to match.</param>
/// <param name="codec">The codec to match (single codec or comma-separated list).</param>
/// <param name="container">The container to match.</param>
/// <param name="useSubContainer">Consider sub-containers.</param>
/// <returns>True if both conditions are met.</returns>
public bool ContainsAnyCodec(IReadOnlyList<string> codecs, string? container, bool useSubContainer = false)
{
var containerToCheck = useSubContainer && string.Equals(Container, "hls", StringComparison.OrdinalIgnoreCase) ? SubContainer : Container;
return ContainerHelper.ContainsContainer(containerToCheck, container) && codecs.Any(c => ContainerHelper.ContainsContainer(Codec, false, c));
}
/// <summary>
/// Checks to see whether the codecs and containers contain the given parameters.
/// </summary>
/// <param name="codec">The codec to match.</param>
/// <param name="container">The container to match.</param>
/// <param name="useSubContainer">Consider sub-containers.</param>
/// <returns>True if both conditions are met.</returns>
/// <param name="useSubContainer">When true and Container is "hls", uses SubContainer instead of Container for matching.</param>
/// <returns>True if both the codec and container conditions are met.</returns>
public bool ContainsAnyCodec(string? codec, string? container, bool useSubContainer = false)
{
return ContainsAnyCodec(codec.AsSpan(), container, useSubContainer);
if (codec is null)
{
return false;
}
var containerToCheck =
useSubContainer &&
string.Equals(this.Container, "hls", StringComparison.OrdinalIgnoreCase)
? this.SubContainer
: this.Container;
return ContainerHelper.ContainsContainer(containerToCheck, container)
&& ContainerHelper.ContainsContainer(this.Codec, codec);
}
/// <summary>
/// Checks to see whether the codecs and containers contain the given parameters.
/// </summary>
/// <param name="codec">The codec to match.</param>
/// <param name="codecs">The list of codecs to match.</param>
/// <param name="container">The container to match.</param>
/// <param name="useSubContainer">Consider sub-containers.</param>
/// <returns>True if both conditions are met.</returns>
public bool ContainsAnyCodec(ReadOnlySpan<char> codec, string? container, bool useSubContainer = false)
/// <param name="useSubContainer">When true and Container is "hls", uses SubContainer instead of Container for matching.</param>
/// <returns>True if both the codec and container conditions are met.</returns>
public bool ContainsAnyCodec(IReadOnlyList<string> codecs, string? container, bool useSubContainer = false)
{
var containerToCheck = useSubContainer && string.Equals(Container, "hls", StringComparison.OrdinalIgnoreCase) ? SubContainer : Container;
return ContainerHelper.ContainsContainer(containerToCheck, container) && ContainerHelper.ContainsContainer(Codec, false, codec);
if (codecs == null || codecs.Count == 0)
{
return false;
}
// Join codecs with comma to match ContainerHelper's expected format
var codecString = string.Join(',', codecs);
return ContainsAnyCodec(codecString, container, useSubContainer);
}
}
+7 -9
View File
@@ -4,12 +4,10 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum CodecType
{
Video = 0,
VideoAudio = 1,
Audio = 2
}
}
namespace MediaBrowser.Model.Dlna;
public enum CodecType
{
Video = 0,
VideoAudio = 1,
Audio = 2,
}
+9 -10
View File
@@ -2,18 +2,18 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Globalization;
namespace MediaBrowser.Model.Dlna;
using global::System;
using global::System.Globalization;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Model.MediaInfo;
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// The condition processor.
/// </summary>
public static class ConditionProcessor
/// <summary>
/// The condition processor.
/// </summary>
public static class ConditionProcessor
{
/// <summary>
/// Checks if a video condition is satisfied.
@@ -379,11 +379,10 @@ namespace MediaBrowser.Model.Dlna
{
ProfileConditionType.Equals => currentValue.Value == expected,
ProfileConditionType.NotEquals => currentValue.Value != expected,
_ => throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition)
_ => throw new InvalidOperationException("Unexpected ProfileConditionType: " + condition.Condition),
};
}
return false;
}
}
}
+3 -3
View File
@@ -4,9 +4,9 @@
#pragma warning disable CA1819 // Properties should not return arrays
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using global::System;
using global::System.Collections.Generic;
using global::System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna;
+1 -1
View File
@@ -4,7 +4,7 @@
#pragma warning disable CA1819 // Properties should not return arrays
using System;
using global::System;
namespace MediaBrowser.Model.Dlna;
+3 -3
View File
@@ -2,11 +2,11 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna;
using global::System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
/// <summary>
/// Defines the <see cref="DirectPlayProfile"/>.
/// </summary>
+9 -11
View File
@@ -4,14 +4,12 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum DlnaProfileType
{
Audio = 0,
Video = 1,
Photo = 2,
Subtitle = 3,
Lyric = 4
}
}
namespace MediaBrowser.Model.Dlna;
public enum DlnaProfileType
{
Audio = 0,
Video = 1,
Photo = 2,
Subtitle = 3,
Lyric = 4,
}
+6 -8
View File
@@ -4,11 +4,9 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum EncodingContext
{
Streaming = 0,
Static = 1
}
}
namespace MediaBrowser.Model.Dlna;
public enum EncodingContext
{
Streaming = 0,
Static = 1,
}
@@ -4,14 +4,12 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public interface ITranscoderSupport
{
bool CanEncodeToAudioCodec(string codec);
namespace MediaBrowser.Model.Dlna;
public interface ITranscoderSupport
{
bool CanEncodeToAudioCodec(string codec);
bool CanEncodeToSubtitleCodec(string codec);
bool CanEncodeToSubtitleCodec(string codec);
bool CanExtractSubtitles(string codec);
}
}
bool CanExtractSubtitles(string codec);
}
+118 -120
View File
@@ -2,148 +2,146 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Dlna;
using global::System;
using MediaBrowser.Model.Dto;
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// Class MediaOptions.
/// </summary>
public class MediaOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="MediaOptions"/> class.
/// </summary>
public MediaOptions()
{
Context = EncodingContext.Streaming;
/// <summary>
/// Class MediaOptions.
/// </summary>
public class MediaOptions
{
/// <summary>
/// Initializes a new instance of the <see cref="MediaOptions"/> class.
/// </summary>
public MediaOptions()
{
Context = EncodingContext.Streaming;
EnableDirectPlay = true;
EnableDirectStream = true;
}
EnableDirectPlay = true;
EnableDirectStream = true;
}
/// <summary>
/// Gets or sets a value indicating whether direct playback is allowed.
/// </summary>
public bool EnableDirectPlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct playback is allowed.
/// </summary>
public bool EnableDirectPlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct streaming is allowed.
/// </summary>
public bool EnableDirectStream { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct streaming is allowed.
/// </summary>
public bool EnableDirectStream { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct playback is forced.
/// </summary>
public bool ForceDirectPlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct playback is forced.
/// </summary>
public bool ForceDirectPlay { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct streaming is forced.
/// </summary>
public bool ForceDirectStream { get; set; }
/// <summary>
/// Gets or sets a value indicating whether direct streaming is forced.
/// </summary>
public bool ForceDirectStream { get; set; }
/// <summary>
/// Gets or sets a value indicating whether audio stream copy is allowed.
/// </summary>
public bool AllowAudioStreamCopy { get; set; }
/// <summary>
/// Gets or sets a value indicating whether audio stream copy is allowed.
/// </summary>
public bool AllowAudioStreamCopy { get; set; }
/// <summary>
/// Gets or sets a value indicating whether video stream copy is allowed.
/// </summary>
public bool AllowVideoStreamCopy { get; set; }
/// <summary>
/// Gets or sets a value indicating whether video stream copy is allowed.
/// </summary>
public bool AllowVideoStreamCopy { get; set; }
/// <summary>
/// Gets or sets a value indicating whether always burn in subtitles when transcoding.
/// </summary>
public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
/// <summary>
/// Gets or sets a value indicating whether always burn in subtitles when transcoding.
/// </summary>
public bool AlwaysBurnInSubtitleWhenTranscoding { get; set; }
/// <summary>
/// Gets or sets the item id.
/// </summary>
public Guid ItemId { get; set; }
/// <summary>
/// Gets or sets the item id.
/// </summary>
public Guid ItemId { get; set; }
/// <summary>
/// Gets or sets the media sources.
/// </summary>
public MediaSourceInfo[] MediaSources { get; set; } = Array.Empty<MediaSourceInfo>();
/// <summary>
/// Gets or sets the media sources.
/// </summary>
public MediaSourceInfo[] MediaSources { get; set; } = Array.Empty<MediaSourceInfo>();
/// <summary>
/// Gets or sets the device profile.
/// </summary>
public required DeviceProfile Profile { get; set; }
/// <summary>
/// Gets or sets the device profile.
/// </summary>
public required DeviceProfile Profile { get; set; }
/// <summary>
/// Gets or sets a media source id. Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
/// </summary>
public string? MediaSourceId { get; set; }
/// <summary>
/// Gets or sets a media source id. Optional. Only needed if a specific AudioStreamIndex or SubtitleStreamIndex are requested.
/// </summary>
public string? MediaSourceId { get; set; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
public string? DeviceId { get; set; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
public string? DeviceId { get; set; }
/// <summary>
/// Gets or sets an override of supported number of audio channels
/// Example: DeviceProfile supports five channel, but user only has stereo speakers.
/// </summary>
public int? MaxAudioChannels { get; set; }
/// <summary>
/// Gets or sets an override of supported number of audio channels
/// Example: DeviceProfile supports five channel, but user only has stereo speakers.
/// </summary>
public int? MaxAudioChannels { get; set; }
/// <summary>
/// Gets or sets the application's configured maximum bitrate.
/// </summary>
public int? MaxBitrate { get; set; }
/// <summary>
/// Gets or sets the application's configured maximum bitrate.
/// </summary>
public int? MaxBitrate { get; set; }
/// <summary>
/// Gets or sets the context.
/// </summary>
/// <value>The context.</value>
public EncodingContext Context { get; set; }
/// <summary>
/// Gets or sets the context.
/// </summary>
/// <value>The context.</value>
public EncodingContext Context { get; set; }
/// <summary>
/// Gets or sets the audio transcoding bitrate.
/// </summary>
/// <value>The audio transcoding bitrate.</value>
public int? AudioTranscodingBitrate { get; set; }
/// <summary>
/// Gets or sets the audio transcoding bitrate.
/// </summary>
/// <value>The audio transcoding bitrate.</value>
public int? AudioTranscodingBitrate { get; set; }
/// <summary>
/// Gets or sets an override for the audio stream index.
/// </summary>
public int? AudioStreamIndex { get; set; }
/// <summary>
/// Gets or sets an override for the audio stream index.
/// </summary>
public int? AudioStreamIndex { get; set; }
/// <summary>
/// Gets or sets an override for the subtitle stream index.
/// </summary>
public int? SubtitleStreamIndex { get; set; }
/// <summary>
/// Gets or sets an override for the subtitle stream index.
/// </summary>
public int? SubtitleStreamIndex { get; set; }
/// <summary>
/// Gets the maximum bitrate.
/// </summary>
/// <param name="isAudio">Whether or not this is audio.</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
public int? GetMaxBitrate(bool isAudio)
{
if (MaxBitrate.HasValue)
{
return MaxBitrate;
}
/// <summary>
/// Gets the maximum bitrate.
/// </summary>
/// <param name="isAudio">Whether or not this is audio.</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
public int? GetMaxBitrate(bool isAudio)
{
if (MaxBitrate.HasValue)
{
return MaxBitrate;
}
if (Profile is null)
{
return null;
}
if (Profile is null)
{
return null;
}
if (Context == EncodingContext.Static)
{
if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
{
return Profile.MaxStaticMusicBitrate;
}
if (Context == EncodingContext.Static)
{
if (isAudio && Profile.MaxStaticMusicBitrate.HasValue)
{
return Profile.MaxStaticMusicBitrate;
}
return Profile.MaxStaticBitrate;
}
return Profile.MaxStaticBitrate;
}
return Profile.MaxStreamingBitrate;
}
}
}
return Profile.MaxStreamingBitrate;
}
}
+7 -9
View File
@@ -4,12 +4,10 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum PlaybackErrorCode
{
NotAllowed = 0,
NoCompatibleStream = 1,
RateLimitExceeded = 2
}
}
namespace MediaBrowser.Model.Dlna;
public enum PlaybackErrorCode
{
NotAllowed = 0,
NoCompatibleStream = 1,
RateLimitExceeded = 2,
}
+28 -30
View File
@@ -5,40 +5,38 @@
#nullable disable
#pragma warning disable CS1591
using System.Xml.Serialization;
using global::System.Xml.Serialization;
namespace MediaBrowser.Model.Dlna
{
public class ProfileCondition
{
public ProfileCondition()
{
IsRequired = true;
}
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)
: this(condition, property, value, false)
{
}
public ProfileCondition(ProfileConditionType condition, ProfileConditionValue property, string value, bool isRequired)
{
Condition = condition;
Property = property;
Value = value;
IsRequired = isRequired;
}
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; }
[XmlAttribute("condition")]
public ProfileConditionType Condition { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("property")]
public ProfileConditionValue Property { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("value")]
public string Value { get; set; }
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
}
}
[XmlAttribute("isRequired")]
public bool IsRequired { get; set; }
}
@@ -4,14 +4,12 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum ProfileConditionType
{
Equals = 0,
NotEquals = 1,
LessThanEqual = 2,
GreaterThanEqual = 3,
EqualsAny = 4
}
}
namespace MediaBrowser.Model.Dlna;
public enum ProfileConditionType
{
Equals = 0,
NotEquals = 1,
LessThanEqual = 2,
GreaterThanEqual = 3,
EqualsAny = 4,
}
@@ -4,34 +4,32 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum ProfileConditionValue
{
AudioChannels = 0,
AudioBitrate = 1,
AudioProfile = 2,
Width = 3,
Height = 4,
Has64BitOffsets = 5,
PacketLength = 6,
VideoBitDepth = 7,
VideoBitrate = 8,
VideoFramerate = 9,
VideoLevel = 10,
VideoProfile = 11,
VideoTimestamp = 12,
IsAnamorphic = 13,
RefFrames = 14,
NumAudioStreams = 16,
NumVideoStreams = 17,
IsSecondaryAudio = 18,
VideoCodecTag = 19,
IsAvc = 20,
IsInterlaced = 21,
AudioSampleRate = 22,
AudioBitDepth = 23,
VideoRangeType = 24,
NumStreams = 25
}
}
namespace MediaBrowser.Model.Dlna;
public enum ProfileConditionValue
{
AudioChannels = 0,
AudioBitrate = 1,
AudioProfile = 2,
Width = 3,
Height = 4,
Has64BitOffsets = 5,
PacketLength = 6,
VideoBitDepth = 7,
VideoBitrate = 8,
VideoFramerate = 9,
VideoLevel = 10,
VideoProfile = 11,
VideoTimestamp = 12,
IsAnamorphic = 13,
RefFrames = 14,
NumAudioStreams = 16,
NumVideoStreams = 17,
IsSecondaryAudio = 18,
VideoCodecTag = 19,
IsAvc = 20,
IsInterlaced = 21,
AudioSampleRate = 22,
AudioBitDepth = 23,
VideoRangeType = 24,
NumStreams = 25,
}
@@ -4,18 +4,21 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public class ResolutionConfiguration
{
public ResolutionConfiguration(int maxWidth, int maxBitrate)
{
MaxWidth = maxWidth;
MaxBitrate = maxBitrate;
}
namespace MediaBrowser.Model.Dlna;
public class ResolutionConfiguration
{
/// <summary>
/// Initializes a new instance of the <see cref="ResolutionConfiguration"/> class.
/// </summary>
/// <param name="maxWidth">The maximum width.</param>
/// <param name="maxBitrate">The maximum bitrate.</param>
public ResolutionConfiguration(int maxWidth, int maxBitrate)
{
MaxWidth = maxWidth;
MaxBitrate = maxBitrate;
}
public int MaxWidth { get; set; }
public int MaxWidth { get; set; }
public int MaxBitrate { get; set; }
}
}
public int MaxBitrate { get; set; }
}
+81 -72
View File
@@ -5,85 +5,94 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Linq;
using global::System;
using global::System.Linq;
namespace MediaBrowser.Model.Dlna
{
public static class ResolutionNormalizer
{
// Please note: all bitrate here are in the scale of SDR h264 bitrate at 30fps
private static readonly ResolutionConfiguration[] _configurations =
[
new ResolutionConfiguration(416, 365000),
new ResolutionConfiguration(640, 730000),
new ResolutionConfiguration(768, 1100000),
new ResolutionConfiguration(960, 3000000),
new ResolutionConfiguration(1280, 6000000),
new ResolutionConfiguration(1920, 13500000),
new ResolutionConfiguration(2560, 28000000),
new ResolutionConfiguration(3840, 50000000)
];
namespace MediaBrowser.Model.Dlna;
public static class ResolutionNormalizer
{
// Please note: all bitrate here are in the scale of SDR h264 bitrate at 30fps
private static readonly ResolutionConfiguration[] _configurations =
[
new ResolutionConfiguration(416, 365000),
new ResolutionConfiguration(640, 730000),
new ResolutionConfiguration(768, 1100000),
new ResolutionConfiguration(960, 3000000),
new ResolutionConfiguration(1280, 6000000),
new ResolutionConfiguration(1920, 13500000),
new ResolutionConfiguration(2560, 28000000),
new ResolutionConfiguration(3840, 50000000)
];
public static ResolutionOptions Normalize(
int? inputBitrate,
int outputBitrate,
int h264EquivalentOutputBitrate,
int? maxWidth,
int? maxHeight,
float? targetFps,
bool isHdr = false) // We are not doing HDR transcoding for now, leave for future use
{
// If the bitrate isn't changing, then don't downscale the resolution
if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value)
{
if (maxWidth.HasValue || maxHeight.HasValue)
{
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight
};
}
}
/// <summary>
/// Normalizes resolution options based on bitrate and dimensions.
/// </summary>
/// <param name="inputBitrate">The input bitrate.</param>
/// <param name="outputBitrate">The output bitrate.</param>
/// <param name="h264EquivalentOutputBitrate">The H264 equivalent output bitrate.</param>
/// <param name="maxWidth">The maximum width.</param>
/// <param name="maxHeight">The maximum height.</param>
/// <param name="targetFps">The target frames per second.</param>
/// <param name="isHdr">Whether the content is HDR.</param>
/// <returns>The normalized resolution options.</returns>
public static ResolutionOptions Normalize(
int? inputBitrate,
int outputBitrate,
int h264EquivalentOutputBitrate,
int? maxWidth,
int? maxHeight,
float? targetFps,
bool isHdr = false) // We are not doing HDR transcoding for now, leave for future use
{
// If the bitrate isn't changing, then don't downscale the resolution
if (inputBitrate.HasValue && outputBitrate >= inputBitrate.Value)
{
if (maxWidth.HasValue || maxHeight.HasValue)
{
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight,
};
}
}
// Our reference bitrate is based on SDR h264 at 30fps
var referenceFps = targetFps ?? 30.0f;
var referenceScale = referenceFps <= 30.0f
? 30.0f / referenceFps
: 1.0f / MathF.Sqrt(referenceFps / 30.0f);
var referenceBitrate = h264EquivalentOutputBitrate * referenceScale;
// Our reference bitrate is based on SDR h264 at 30fps
var referenceFps = targetFps ?? 30.0f;
var referenceScale = referenceFps <= 30.0f
? 30.0f / referenceFps
: 1.0f / MathF.Sqrt(referenceFps / 30.0f);
var referenceBitrate = h264EquivalentOutputBitrate * referenceScale;
if (isHdr)
{
referenceBitrate *= 0.8f;
}
if (isHdr)
{
referenceBitrate *= 0.8f;
}
var resolutionConfig = GetResolutionConfiguration(Convert.ToInt32(referenceBitrate));
var resolutionConfig = GetResolutionConfiguration(Convert.ToInt32(referenceBitrate));
if (resolutionConfig is null)
{
return new ResolutionOptions { MaxWidth = maxWidth, MaxHeight = maxHeight };
}
if (resolutionConfig is null)
{
return new ResolutionOptions { MaxWidth = maxWidth, MaxHeight = maxHeight };
}
var originWidthValue = maxWidth;
var originWidthValue = maxWidth;
maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
if (!originWidthValue.HasValue || originWidthValue.Value != maxWidth.Value)
{
maxHeight = null;
}
maxWidth = Math.Min(resolutionConfig.MaxWidth, maxWidth ?? resolutionConfig.MaxWidth);
if (!originWidthValue.HasValue || originWidthValue.Value != maxWidth.Value)
{
maxHeight = null;
}
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight
};
}
return new ResolutionOptions
{
MaxWidth = maxWidth,
MaxHeight = maxHeight,
};
}
private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
{
return _configurations.FirstOrDefault(config => outputBitrate <= config.MaxBitrate);
}
}
}
private static ResolutionConfiguration GetResolutionConfiguration(int outputBitrate)
{
return _configurations.FirstOrDefault(config => outputBitrate <= config.MaxBitrate);
}
}
+6 -8
View File
@@ -4,12 +4,10 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public class ResolutionOptions
{
public int? MaxWidth { get; set; }
namespace MediaBrowser.Model.Dlna;
public class ResolutionOptions
{
public int? MaxWidth { get; set; }
public int? MaxHeight { get; set; }
}
}
public int? MaxHeight { get; set; }
}
+41 -31
View File
@@ -2,10 +2,12 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
namespace MediaBrowser.Model.Dlna;
using global::System;
using global::System.Collections.Generic;
using global::System.Globalization;
using global::System.Linq;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Model.Dto;
@@ -15,12 +17,10 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// Class StreamBuilder.
/// </summary>
public class StreamBuilder
/// <summary>
/// Class StreamBuilder.
/// </summary>
public class StreamBuilder
{
// Aliases
internal const TranscodeReason ContainerReasons = TranscodeReason.ContainerNotSupported | TranscodeReason.ContainerBitrateExceedsLimit;
@@ -86,7 +86,7 @@ namespace MediaBrowser.Model.Dlna
MediaSource = item,
RunTimeTicks = item.RunTimeTicks,
Context = options.Context,
DeviceProfile = options.Profile
DeviceProfile = options.Profile,
};
if (options.ForceDirectPlay)
@@ -130,6 +130,7 @@ namespace MediaBrowser.Model.Dlna
{
var remuxContainer = item.TranscodingContainer ?? "ts";
string[] supportedHlsContainers = ["ts", "mp4"];
// If the container specified for the profile is an HLS supported container, use that container instead, overriding the preference
// The client should be responsible to ensure this container is compatible
remuxContainer = Array.Exists(supportedHlsContainers, element => string.Equals(element, directPlayInfo.Profile?.Container, StringComparison.OrdinalIgnoreCase)) ? directPlayInfo.Profile?.Container : remuxContainer;
@@ -323,6 +324,7 @@ namespace MediaBrowser.Model.Dlna
return TranscodeReason.AudioSampleRateNotSupported;
case ProfileConditionValue.Has64BitOffsets:
// TODO
return 0;
@@ -333,6 +335,7 @@ namespace MediaBrowser.Model.Dlna
return TranscodeReason.AnamorphicVideoNotSupported;
case ProfileConditionValue.IsAvc:
// TODO
return 0;
@@ -346,14 +349,17 @@ namespace MediaBrowser.Model.Dlna
return TranscodeReason.StreamCountExceedsLimit;
case ProfileConditionValue.NumAudioStreams:
// TODO
return 0;
case ProfileConditionValue.NumVideoStreams:
// TODO
return 0;
case ProfileConditionValue.PacketLength:
// TODO
return 0;
@@ -385,6 +391,7 @@ namespace MediaBrowser.Model.Dlna
return TranscodeReason.VideoRangeTypeNotSupported;
case ProfileConditionValue.VideoTimestamp:
// TODO
return 0;
@@ -655,7 +662,7 @@ namespace MediaBrowser.Model.Dlna
Context = options.Context,
DeviceProfile = options.Profile,
SubtitleStreamIndex = options.SubtitleStreamIndex ?? GetDefaultSubtitleStreamIndex(item, options.Profile.SubtitleProfiles),
AlwaysBurnInSubtitleWhenTranscoding = options.AlwaysBurnInSubtitleWhenTranscoding
AlwaysBurnInSubtitleWhenTranscoding = options.AlwaysBurnInSubtitleWhenTranscoding,
};
var subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null;
@@ -668,6 +675,7 @@ namespace MediaBrowser.Model.Dlna
// Collect candidate audio streams
ICollection<MediaStream> candidateAudioStreams = audioStream is null ? [] : [audioStream];
// When the index is explicitly required by client or the default is specified by user, don't do any stream reselection.
if (!item.DefaultAudioIndexSource.HasFlag(AudioIndexSource.User) && (options.AudioStreamIndex is null or < 0))
{
@@ -706,7 +714,7 @@ namespace MediaBrowser.Model.Dlna
var videoStream = item.VideoStream;
var bitrateLimitExceeded = IsBitrateLimitExceeded(item, options.GetMaxBitrate(false) ?? 0);
var bitrateLimitExceeded = this.IsBitrateLimitExceeded(item, options.GetMaxBitrate(false) ?? 0);
var isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || !bitrateLimitExceeded);
var isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || !bitrateLimitExceeded);
TranscodeReason transcodeReasons = 0;
@@ -722,7 +730,7 @@ namespace MediaBrowser.Model.Dlna
transcodeReasons = TranscodeReason.ContainerBitrateExceedsLimit;
}
_logger.LogDebug(
this._logger.LogDebug(
"Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}",
options.Profile.Name ?? "Unknown Profile",
item.Path ?? "Unknown path",
@@ -733,7 +741,7 @@ namespace MediaBrowser.Model.Dlna
if (isEligibleForDirectPlay || isEligibleForDirectStream)
{
// See if it can be direct played
var directPlayInfo = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, candidateAudioStreams, subtitleStream, isEligibleForDirectPlay, isEligibleForDirectStream);
var directPlayInfo = this.GetVideoDirectPlayProfile(options, item, videoStream, audioStream, candidateAudioStreams, subtitleStream, isEligibleForDirectPlay, isEligibleForDirectStream);
var directPlay = directPlayInfo.PlayMethod;
transcodeReasons |= directPlayInfo.TranscodeReasons;
@@ -771,14 +779,14 @@ namespace MediaBrowser.Model.Dlna
if (subtitleStream is not null)
{
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, _transcoderSupport, directPlayProfile?.Container, null);
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, this._transcoderSupport, directPlayProfile?.Container, null);
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
playlistItem.SubtitleFormat = subtitleProfile.Format;
}
}
_logger.LogDebug(
this._logger.LogDebug(
"DirectPlay Result for Profile: {0}, Path: {1}, PlayMethod: {2}, AudioStreamIndex: {3}, SubtitleStreamIndex: {4}, Reasons: {5}",
options.Profile.Name ?? "Anonymous Profile",
item.Path ?? "Unknown path",
@@ -794,19 +802,19 @@ namespace MediaBrowser.Model.Dlna
{
// Can't direct play, find the transcoding profile
// If we do this for direct-stream we will overwrite the info
var (transcodingProfile, playMethod) = GetVideoTranscodeProfile(item, options, videoStream, audioStream, playlistItem);
var (transcodingProfile, playMethod) = this.GetVideoTranscodeProfile(item, options, videoStream, audioStream, playlistItem);
if (transcodingProfile is not null && playMethod.HasValue)
{
SetStreamInfoOptionsFromTranscodingProfile(item, playlistItem, transcodingProfile);
BuildStreamVideoItem(playlistItem, options, item, videoStream, audioStream, candidateAudioStreams, transcodingProfile.Container, transcodingProfile.VideoCodec, transcodingProfile.AudioCodec);
this.BuildStreamVideoItem(playlistItem, options, item, videoStream, audioStream, candidateAudioStreams, transcodingProfile.Container, transcodingProfile.VideoCodec, transcodingProfile.AudioCodec);
playlistItem.PlayMethod = PlayMethod.Transcode;
if (subtitleStream is not null)
{
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, _transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);
var subtitleProfile = GetSubtitleProfile(item, subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, this._transcoderSupport, transcodingProfile.Container, transcodingProfile.Protocol);
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
playlistItem.SubtitleFormat = subtitleProfile.Format;
playlistItem.SubtitleCodecs = [subtitleProfile.Format];
@@ -814,12 +822,12 @@ namespace MediaBrowser.Model.Dlna
if ((playlistItem.TranscodeReasons & (VideoReasons | TranscodeReason.ContainerBitrateExceedsLimit)) != 0)
{
ApplyTranscodingConditions(playlistItem, transcodingProfile.Conditions, null, true, true);
this.ApplyTranscodingConditions(playlistItem, transcodingProfile.Conditions, null, true, true);
}
}
}
_logger.LogDebug(
this._logger.LogDebug(
"StreamBuilder.BuildVideoItem( Profile={0}, Path={1}, AudioStreamIndex={2}, SubtitleStreamIndex={3} ) => ( PlayMethod={4}, TranscodeReason={5} ) {6}",
options.Profile.Name ?? "Anonymous Profile",
item.Path ?? "Unknown path",
@@ -1059,6 +1067,7 @@ namespace MediaBrowser.Model.Dlna
.Where(i => i.Type == CodecType.Video &&
i.ContainsAnyCodec(playlistItem.VideoCodecs, container, useSubContainer) &&
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoRangeType, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isInterlaced, refFrames, numStreams, numVideoStreams, numAudioStreams, videoCodecTag, isAvc)))
// Reverse codec profiles for backward compatibility - first codec profile has higher priority
.Reverse();
foreach (var condition in appliedVideoConditions)
@@ -1090,6 +1099,7 @@ namespace MediaBrowser.Model.Dlna
.Where(i => i.Type == CodecType.VideoAudio &&
i.ContainsAnyCodec(playlistItem.AudioCodecs, container) &&
i.ApplyConditions.All(applyCondition => ConditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, inputAudioSampleRate, inputAudioBitDepth, audioProfile, isSecondaryAudio)))
// Reverse codec profiles for backward compatibility - first codec profile has higher priority
.Reverse();
@@ -1106,6 +1116,7 @@ namespace MediaBrowser.Model.Dlna
}
var maxBitrateSetting = options.GetMaxBitrate(false);
// Honor max rate
if (maxBitrateSetting.HasValue)
{
@@ -1518,7 +1529,7 @@ namespace MediaBrowser.Model.Dlna
new SubtitleProfile
{
Method = SubtitleDeliveryMethod.Encode,
Format = subtitleStream.Codec
Format = subtitleStream.Codec,
};
}
@@ -2309,13 +2320,13 @@ namespace MediaBrowser.Model.Dlna
{
var profile = options.Profile;
var failures = AggregateFailureConditions(
var failures = this.AggregateFailureConditions(
mediaSource,
profile,
"VideoCodecProfile",
profile.ContainerProfiles
.Where(containerProfile => containerProfile.Type == DlnaProfileType.Video && containerProfile.ContainsContainer(container))
.SelectMany(containerProfile => CheckVideoConditions(containerProfile.Conditions, mediaSource, videoStream)));
.SelectMany(containerProfile => this.CheckVideoConditions(containerProfile.Conditions, mediaSource, videoStream)));
return failures;
}
@@ -2334,15 +2345,15 @@ namespace MediaBrowser.Model.Dlna
string videoCodec = videoStream.Codec;
var failures = AggregateFailureConditions(
var failures = this.AggregateFailureConditions(
mediaSource,
profile,
"VideoCodecProfile",
profile.CodecProfiles
.Where(codecProfile => codecProfile.Type == CodecType.Video &&
codecProfile.ContainsAnyCodec(videoCodec, container) &&
!CheckVideoConditions(codecProfile.ApplyConditions, mediaSource, videoStream).Any())
.SelectMany(codecProfile => CheckVideoConditions(codecProfile.Conditions, mediaSource, videoStream)));
!this.CheckVideoConditions(codecProfile.ApplyConditions.ToArray(), mediaSource, videoStream).Any())
.SelectMany(codecProfile => this.CheckVideoConditions(codecProfile.Conditions.ToArray(), mediaSource, videoStream)));
return failures;
}
@@ -2373,7 +2384,7 @@ namespace MediaBrowser.Model.Dlna
? GetProfileConditionsForVideoAudio(profile.CodecProfiles, container, audioCodec, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, audioProfile, isSecondaryAudio)
: GetProfileConditionsForAudio(profile.CodecProfiles, container, audioCodec, audioChannels, audioBitrate, audioSampleRate, audioBitDepth, true);
var failures = AggregateFailureConditions(mediaSource, profile, "AudioCodecProfile", audioFailureConditions);
var failures = this.AggregateFailureConditions(mediaSource, profile, "AudioCodecProfile", audioFailureConditions);
return failures;
}
@@ -2390,7 +2401,7 @@ namespace MediaBrowser.Model.Dlna
/// <returns>Transcode reasons if the audio stream is not fully compatible for direct playback.</returns>
private TranscodeReason GetCompatibilityAudioCodecDirect(MediaOptions options, MediaSourceInfo mediaSource, string container, MediaStream audioStream, bool isVideo, bool isSecondaryAudio)
{
var failures = GetCompatibilityAudioCodec(options, mediaSource, container, audioStream, null, isVideo, isSecondaryAudio);
var failures = this.GetCompatibilityAudioCodec(options, mediaSource, container, audioStream, null, isVideo, isSecondaryAudio);
if (audioStream.IsExternal)
{
@@ -2400,4 +2411,3 @@ namespace MediaBrowser.Model.Dlna
return failures;
}
}
}
+9 -7
View File
@@ -4,12 +4,12 @@
#pragma warning disable CA1819 // Properties should not return arrays
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Text;
using global::System;
using global::System.Collections.Generic;
using global::System.ComponentModel;
using global::System.Globalization;
using global::System.Linq;
using global::System.Text;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Model.Drawing;
@@ -618,8 +618,10 @@ public class StreamInfo
int? totalBitrate = TargetTotalBitrate;
double totalSeconds = RunTimeTicks.Value;
// Convert to ms
totalSeconds /= 10000;
// Convert to seconds
totalSeconds /= 1000;
@@ -1241,7 +1243,7 @@ public class StreamInfo
Format = subtitleProfile.Format,
Index = stream.Index,
DeliveryMethod = subtitleProfile.Method,
DisplayTitle = stream.DisplayTitle
DisplayTitle = stream.DisplayTitle,
};
if (info.DeliveryMethod == SubtitleDeliveryMethod.External)
@@ -4,36 +4,34 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
/// <summary>
/// Delivery method to use during playback of a specific subtitle format.
/// </summary>
public enum SubtitleDeliveryMethod
{
/// <summary>
/// Burn the subtitles in the video track.
/// </summary>
Encode = 0,
namespace MediaBrowser.Model.Dlna;
/// <summary>
/// Delivery method to use during playback of a specific subtitle format.
/// </summary>
public enum SubtitleDeliveryMethod
{
/// <summary>
/// Burn the subtitles in the video track.
/// </summary>
Encode = 0,
/// <summary>
/// Embed the subtitles in the file or stream.
/// </summary>
Embed = 1,
/// <summary>
/// Embed the subtitles in the file or stream.
/// </summary>
Embed = 1,
/// <summary>
/// Serve the subtitles as an external file.
/// </summary>
External = 2,
/// <summary>
/// Serve the subtitles as an external file.
/// </summary>
External = 2,
/// <summary>
/// Serve the subtitles as a separate HLS stream.
/// </summary>
Hls = 3,
/// <summary>
/// Serve the subtitles as a separate HLS stream.
/// </summary>
Hls = 3,
/// <summary>
/// Drop the subtitle.
/// </summary>
Drop = 4
}
}
/// <summary>
/// Drop the subtitle.
/// </summary>
Drop = 4,
}
+3 -3
View File
@@ -2,13 +2,13 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dlna;
#nullable disable
using System.Xml.Serialization;
using global::System.Xml.Serialization;
using MediaBrowser.Model.Extensions;
namespace MediaBrowser.Model.Dlna;
/// <summary>
/// A class for subtitle profile information.
/// </summary>
+13 -15
View File
@@ -5,26 +5,24 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public class SubtitleStreamInfo
{
public string Url { get; set; }
namespace MediaBrowser.Model.Dlna;
public class SubtitleStreamInfo
{
public string Url { get; set; }
public string Language { get; set; }
public string Language { get; set; }
public string Name { get; set; }
public string Name { get; set; }
public bool IsForced { get; set; }
public bool IsForced { get; set; }
public string Format { get; set; }
public string Format { get; set; }
public string DisplayTitle { get; set; }
public string DisplayTitle { get; set; }
public int Index { get; set; }
public int Index { get; set; }
public SubtitleDeliveryMethod DeliveryMethod { get; set; }
public SubtitleDeliveryMethod DeliveryMethod { get; set; }
public bool IsExternalUrl { get; set; }
}
}
public bool IsExternalUrl { get; set; }
}
+6 -8
View File
@@ -4,11 +4,9 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dlna
{
public enum TranscodeSeekInfo
{
Auto = 0,
Bytes = 1
}
}
namespace MediaBrowser.Model.Dlna;
public enum TranscodeSeekInfo
{
Auto = 0,
Bytes = 1,
}
@@ -2,13 +2,13 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.ComponentModel;
using System.Xml.Serialization;
using Jellyfin.Data.Enums;
namespace MediaBrowser.Model.Dlna;
using global::System;
using global::System.ComponentModel;
using global::System.Xml.Serialization;
using Jellyfin.Data.Enums;
/// <summary>
/// A class for transcoding profile information.
/// Note for client developers: Conditions defined in <see cref="CodecProfile"/> has higher priority and can override values defined here.
+110 -112
View File
@@ -2,129 +2,127 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
namespace MediaBrowser.Model.Drawing;
using global::System;
namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Class DrawingUtils.
/// </summary>
public static class DrawingUtils
{
/// <summary>
/// Resizes a set of dimensions.
/// </summary>
/// <param name="size">The original size object.</param>
/// <param name="width">A new fixed width, if desired.</param>
/// <param name="height">A new fixed height, if desired.</param>
/// <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,
int width,
int height,
int maxWidth,
int maxHeight)
{
int newWidth = size.Width;
int newHeight = size.Height;
/// <summary>
/// Class DrawingUtils.
/// </summary>
public static class DrawingUtils
{
/// <summary>
/// Resizes a set of dimensions.
/// </summary>
/// <param name="size">The original size object.</param>
/// <param name="width">A new fixed width, if desired.</param>
/// <param name="height">A new fixed height, if desired.</param>
/// <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,
int width,
int height,
int maxWidth,
int maxHeight)
{
int newWidth = size.Width;
int newHeight = size.Height;
if (width > 0 && height > 0)
{
newWidth = width;
newHeight = height;
}
else if (height > 0)
{
newWidth = GetNewWidth(newHeight, newWidth, height);
newHeight = height;
}
else if (width > 0)
{
newHeight = GetNewHeight(newHeight, newWidth, width);
newWidth = width;
}
if (width > 0 && height > 0)
{
newWidth = width;
newHeight = height;
}
else if (height > 0)
{
newWidth = GetNewWidth(newHeight, newWidth, height);
newHeight = height;
}
else if (width > 0)
{
newHeight = GetNewHeight(newHeight, newWidth, width);
newWidth = width;
}
if (maxHeight > 0 && maxHeight < newHeight)
{
newWidth = GetNewWidth(newHeight, newWidth, maxHeight);
newHeight = maxHeight;
}
if (maxHeight > 0 && maxHeight < newHeight)
{
newWidth = GetNewWidth(newHeight, newWidth, maxHeight);
newHeight = maxHeight;
}
if (maxWidth > 0 && maxWidth < newWidth)
{
newHeight = GetNewHeight(newHeight, newWidth, maxWidth);
newWidth = maxWidth;
}
if (maxWidth > 0 && maxWidth < newWidth)
{
newHeight = GetNewHeight(newHeight, newWidth, maxWidth);
newWidth = maxWidth;
}
return new ImageDimensions(newWidth, newHeight);
}
return new ImageDimensions(newWidth, newHeight);
}
/// <summary>
/// Scale down to fill box.
/// Returns original size if both width and height are null or zero.
/// </summary>
/// <param name="size">The original size object.</param>
/// <param name="fillWidth">A new fixed width, if desired.</param>
/// <param name="fillHeight">A new fixed height, if desired.</param>
/// <returns>A new size object or size.</returns>
public static ImageDimensions ResizeFill(
ImageDimensions size,
int? fillWidth,
int? fillHeight)
{
// Return original size if input is invalid.
if ((fillWidth is null || fillWidth == 0)
&& (fillHeight is null || fillHeight == 0))
{
return size;
}
/// <summary>
/// Scale down to fill box.
/// Returns original size if both width and height are null or zero.
/// </summary>
/// <param name="size">The original size object.</param>
/// <param name="fillWidth">A new fixed width, if desired.</param>
/// <param name="fillHeight">A new fixed height, if desired.</param>
/// <returns>A new size object or size.</returns>
public static ImageDimensions ResizeFill(
ImageDimensions size,
int? fillWidth,
int? fillHeight)
{
// Return original size if input is invalid.
if ((fillWidth is null || fillWidth == 0)
&& (fillHeight is null || fillHeight == 0))
{
return size;
}
if (fillWidth is null || fillWidth == 0)
{
fillWidth = 1;
}
if (fillWidth is null || fillWidth == 0)
{
fillWidth = 1;
}
if (fillHeight is null || fillHeight == 0)
{
fillHeight = 1;
}
if (fillHeight is null || fillHeight == 0)
{
fillHeight = 1;
}
double widthRatio = size.Width / (double)fillWidth;
double heightRatio = size.Height / (double)fillHeight;
double scaleRatio = Math.Min(widthRatio, heightRatio);
double widthRatio = size.Width / (double)fillWidth;
double heightRatio = size.Height / (double)fillHeight;
double scaleRatio = Math.Min(widthRatio, heightRatio);
// Clamp to current size.
if (scaleRatio < 1)
{
return size;
}
// Clamp to current size.
if (scaleRatio < 1)
{
return size;
}
int newWidth = Convert.ToInt32(Math.Ceiling(size.Width / scaleRatio));
int newHeight = Convert.ToInt32(Math.Ceiling(size.Height / scaleRatio));
int newWidth = Convert.ToInt32(Math.Ceiling(size.Width / scaleRatio));
int newHeight = Convert.ToInt32(Math.Ceiling(size.Height / scaleRatio));
return new ImageDimensions(newWidth, newHeight);
}
return new ImageDimensions(newWidth, newHeight);
}
/// <summary>
/// Gets the new width.
/// </summary>
/// <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>
private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight)
=> Convert.ToInt32((double)newHeight / currentHeight * currentWidth);
/// <summary>
/// Gets the new width.
/// </summary>
/// <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>
private static int GetNewWidth(int currentHeight, int currentWidth, int newHeight)
=> Convert.ToInt32((double)newHeight / currentHeight * currentWidth);
/// <summary>
/// Gets the new height.
/// </summary>
/// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param>
/// <param name="newWidth">The new width.</param>
/// <returns>System.Double.</returns>
private static int GetNewHeight(int currentHeight, int currentWidth, int newWidth)
=> Convert.ToInt32((double)newWidth / currentWidth * currentHeight);
}
}
/// <summary>
/// Gets the new height.
/// </summary>
/// <param name="currentHeight">Height of the current.</param>
/// <param name="currentWidth">Width of the current.</param>
/// <param name="newWidth">The new width.</param>
/// <returns>System.Double.</returns>
private static int GetNewHeight(int currentHeight, int currentWidth, int newWidth)
=> Convert.ToInt32((double)newWidth / currentWidth * currentHeight);
}
+36 -38
View File
@@ -4,46 +4,44 @@
#pragma warning disable CS1591
using System.Globalization;
using global::System.Globalization;
namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Struct ImageDimensions.
/// </summary>
public readonly struct ImageDimensions
{
public ImageDimensions(int width, int height)
{
Width = width;
Height = height;
}
namespace MediaBrowser.Model.Drawing;
/// <summary>
/// Struct ImageDimensions.
/// </summary>
public readonly struct ImageDimensions
{
public ImageDimensions(int width, int height)
{
Width = width;
Height = height;
}
/// <summary>
/// Gets the height.
/// </summary>
/// <value>The height.</value>
public int Height { get; }
/// <summary>
/// Gets the height.
/// </summary>
/// <value>The height.</value>
public int Height { get; }
/// <summary>
/// Gets the width.
/// </summary>
/// <value>The width.</value>
public int Width { get; }
/// <summary>
/// Gets the width.
/// </summary>
/// <value>The width.</value>
public int Width { get; }
public bool Equals(ImageDimensions size)
{
return Width.Equals(size.Width) && Height.Equals(size.Height);
}
public bool Equals(ImageDimensions size)
{
return Width.Equals(size.Width) && Height.Equals(size.Height);
}
/// <inheritdoc />
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"{0}-{1}",
Width,
Height);
}
}
}
/// <inheritdoc />
public override string ToString()
{
return string.Format(
CultureInfo.InvariantCulture,
"{0}-{1}",
Width,
Height);
}
}
+31 -33
View File
@@ -2,41 +2,39 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Drawing
{
/// <summary>
/// Enum ImageOutputFormat.
/// </summary>
public enum ImageFormat
{
/// <summary>
/// BMP format.
/// </summary>
Bmp,
namespace MediaBrowser.Model.Drawing;
/// <summary>
/// Enum ImageOutputFormat.
/// </summary>
public enum ImageFormat
{
/// <summary>
/// BMP format.
/// </summary>
Bmp,
/// <summary>
/// GIF format.
/// </summary>
Gif,
/// <summary>
/// GIF format.
/// </summary>
Gif,
/// <summary>
/// JPG format.
/// </summary>
Jpg,
/// <summary>
/// JPG format.
/// </summary>
Jpg,
/// <summary>
/// PNG format.
/// </summary>
Png,
/// <summary>
/// PNG format.
/// </summary>
Png,
/// <summary>
/// WEBP format.
/// </summary>
Webp,
/// <summary>
/// WEBP format.
/// </summary>
Webp,
/// <summary>
/// SVG format.
/// </summary>
Svg,
}
}
/// <summary>
/// SVG format.
/// </summary>
Svg,
}
@@ -2,11 +2,11 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.ComponentModel;
using System.Net.Mime;
namespace MediaBrowser.Model.Drawing;
using global::System.ComponentModel;
using global::System.Net.Mime;
/// <summary>
/// Extension class for the <see cref="ImageFormat" /> enum.
/// </summary>
@@ -27,7 +27,7 @@ public static class ImageFormatExtensions
ImageFormat.Png => MediaTypeNames.Image.Png,
ImageFormat.Webp => MediaTypeNames.Image.Webp,
ImageFormat.Svg => MediaTypeNames.Image.Svg,
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat))
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat)),
};
/// <summary>
@@ -45,6 +45,6 @@ public static class ImageFormatExtensions
ImageFormat.Png => ".png",
ImageFormat.Webp => ".webp",
ImageFormat.Svg => ".svg",
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat))
_ => throw new InvalidEnumArgumentException(nameof(format), (int)format, typeof(ImageFormat)),
};
}
+12 -14
View File
@@ -4,17 +4,15 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Drawing
{
public enum ImageOrientation
{
TopLeft = 1,
TopRight = 2,
BottomRight = 3,
BottomLeft = 4,
LeftTop = 5,
RightTop = 6,
RightBottom = 7,
LeftBottom = 8,
}
}
namespace MediaBrowser.Model.Drawing;
public enum ImageOrientation
{
TopLeft = 1,
TopRight = 2,
BottomRight = 3,
BottomLeft = 4,
LeftTop = 5,
RightTop = 6,
RightBottom = 7,
LeftBottom = 8,
}
@@ -52,5 +52,5 @@ public enum ImageResolution
/// <summary>
/// 2160p.
/// </summary>
P2160 = 8
P2160 = 8,
}
File diff suppressed because it is too large Load Diff
+50 -52
View File
@@ -2,63 +2,61 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dto;
#nullable disable
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Entities;
using global::System;
using global::System.Collections.Generic;
using global::System.ComponentModel;
using global::System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// This is used by the api to get information about a Person within a BaseItem.
/// </summary>
public class BaseItemPerson
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// This is used by the api to get information about a Person within a BaseItem.
/// </summary>
public class BaseItemPerson
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the role.
/// </summary>
/// <value>The role.</value>
public string Role { get; set; }
/// <summary>
/// Gets or sets the role.
/// </summary>
/// <value>The role.</value>
public string Role { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
[DefaultValue(PersonKind.Unknown)]
public PersonKind Type { get; set; }
/// <summary>
/// Gets or sets the type.
/// </summary>
/// <value>The type.</value>
[DefaultValue(PersonKind.Unknown)]
public PersonKind Type { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <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 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>
/// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool HasPrimaryImage => PrimaryImageTag is not null;
}
}
/// <summary>
/// Gets a value indicating whether this instance has primary image.
/// </summary>
/// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
[JsonIgnore]
public bool HasPrimaryImage => PrimaryImageTag is not null;
}
@@ -2,15 +2,15 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace MediaBrowser.Model.Dto;
using global::System.Collections.Generic;
using global::System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions.Json.Converters;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Dto;
/// <summary>
/// Client capabilities dto.
/// </summary>
@@ -67,7 +67,7 @@ public class ClientCapabilitiesDto
SupportsPersistentIdentifier = SupportsPersistentIdentifier,
DeviceProfile = DeviceProfile,
AppStoreUrl = AppStoreUrl,
IconUrl = IconUrl
IconUrl = IconUrl,
};
}
}
+2 -2
View File
@@ -2,10 +2,10 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
namespace MediaBrowser.Model.Dto;
using global::System;
/// <summary>
/// A DTO representing device information.
/// </summary>
+89 -91
View File
@@ -2,109 +2,107 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
using Jellyfin.Database.Implementations.Enums;
namespace MediaBrowser.Model.Dto;
using global::System.Collections.Generic;
using Jellyfin.Database.Implementations.Enums;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Defines the display preferences for any item that supports them (usually Folders).
/// </summary>
public class DisplayPreferencesDto
{
/// <summary>
/// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
/// </summary>
public DisplayPreferencesDto()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
PrimaryImageWidth = 250;
ShowBackdrop = true;
CustomPrefs = new Dictionary<string, string?>();
}
/// <summary>
/// Defines the display preferences for any item that supports them (usually Folders).
/// </summary>
public class DisplayPreferencesDto
{
/// <summary>
/// Initializes a new instance of the <see cref="DisplayPreferencesDto" /> class.
/// </summary>
public DisplayPreferencesDto()
{
RememberIndexing = false;
PrimaryImageHeight = 250;
PrimaryImageWidth = 250;
ShowBackdrop = true;
CustomPrefs = new Dictionary<string, string?>();
}
/// <summary>
/// Gets or sets the user id.
/// </summary>
/// <value>The user id.</value>
public string? Id { get; set; }
/// <summary>
/// Gets or sets the user id.
/// </summary>
/// <value>The user id.</value>
public string? Id { get; set; }
/// <summary>
/// Gets or sets the type of the view.
/// </summary>
/// <value>The type of the view.</value>
public string? ViewType { get; set; }
/// <summary>
/// Gets or sets the type of the view.
/// </summary>
/// <value>The type of the view.</value>
public string? ViewType { get; set; }
/// <summary>
/// Gets or sets the sort by.
/// </summary>
/// <value>The sort by.</value>
public string? SortBy { get; set; }
/// <summary>
/// Gets or sets the sort by.
/// </summary>
/// <value>The sort by.</value>
public string? SortBy { get; set; }
/// <summary>
/// Gets or sets the index by.
/// </summary>
/// <value>The index by.</value>
public string? IndexBy { get; set; }
/// <summary>
/// Gets or sets the index by.
/// </summary>
/// <value>The index by.</value>
public string? IndexBy { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [remember indexing].
/// </summary>
/// <value><c>true</c> if [remember indexing]; otherwise, <c>false</c>.</value>
public bool RememberIndexing { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [remember indexing].
/// </summary>
/// <value><c>true</c> if [remember indexing]; otherwise, <c>false</c>.</value>
public bool RememberIndexing { get; set; }
/// <summary>
/// Gets or sets the height of the primary image.
/// </summary>
/// <value>The height of the primary image.</value>
public int PrimaryImageHeight { get; set; }
/// <summary>
/// Gets or sets the height of the primary image.
/// </summary>
/// <value>The height of the primary image.</value>
public int PrimaryImageHeight { get; set; }
/// <summary>
/// Gets or sets the width of the primary image.
/// </summary>
/// <value>The width of the primary image.</value>
public int PrimaryImageWidth { get; set; }
/// <summary>
/// Gets or sets the width of the primary image.
/// </summary>
/// <value>The width of the primary image.</value>
public int PrimaryImageWidth { get; set; }
/// <summary>
/// Gets or sets the custom prefs.
/// </summary>
/// <value>The custom prefs.</value>
public Dictionary<string, string?> CustomPrefs { get; set; }
/// <summary>
/// Gets or sets the custom prefs.
/// </summary>
/// <value>The custom prefs.</value>
public Dictionary<string, string?> CustomPrefs { get; set; }
/// <summary>
/// Gets or sets the scroll direction.
/// </summary>
/// <value>The scroll direction.</value>
public ScrollDirection ScrollDirection { get; set; }
/// <summary>
/// Gets or sets the scroll direction.
/// </summary>
/// <value>The scroll direction.</value>
public ScrollDirection ScrollDirection { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to show backdrops on this item.
/// </summary>
/// <value><c>true</c> if showing backdrops; otherwise, <c>false</c>.</value>
public bool ShowBackdrop { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to show backdrops on this item.
/// </summary>
/// <value><c>true</c> if showing backdrops; otherwise, <c>false</c>.</value>
public bool ShowBackdrop { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [remember sorting].
/// </summary>
/// <value><c>true</c> if [remember sorting]; otherwise, <c>false</c>.</value>
public bool RememberSorting { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [remember sorting].
/// </summary>
/// <value><c>true</c> if [remember sorting]; otherwise, <c>false</c>.</value>
public bool RememberSorting { get; set; }
/// <summary>
/// Gets or sets the sort order.
/// </summary>
/// <value>The sort order.</value>
public SortOrder SortOrder { get; set; }
/// <summary>
/// Gets or sets the sort order.
/// </summary>
/// <value>The sort order.</value>
public SortOrder SortOrder { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [show sidebar].
/// </summary>
/// <value><c>true</c> if [show sidebar]; otherwise, <c>false</c>.</value>
public bool ShowSidebar { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [show sidebar].
/// </summary>
/// <value><c>true</c> if [show sidebar]; otherwise, <c>false</c>.</value>
public bool ShowSidebar { get; set; }
/// <summary>
/// Gets or sets the client.
/// </summary>
public string? Client { get; set; }
}
}
/// <summary>
/// Gets or sets the client.
/// </summary>
public string? Client { get; set; }
}
+5 -7
View File
@@ -5,10 +5,8 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public interface IHasServerId
{
string ServerId { get; }
}
}
namespace MediaBrowser.Model.Dto;
public interface IHasServerId
{
string ServerId { get; }
}
+12 -14
View File
@@ -2,17 +2,15 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Interface IItemDto.
/// </summary>
public interface IItemDto
{
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
double? PrimaryImageAspectRatio { get; set; }
}
}
namespace MediaBrowser.Model.Dto;
/// <summary>
/// Interface IItemDto.
/// </summary>
public interface IItemDto
{
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
double? PrimaryImageAspectRatio { get; set; }
}
+47 -49
View File
@@ -2,61 +2,59 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dto;
#nullable disable
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class ImageInfo.
/// </summary>
public class ImageInfo
{
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
public ImageType ImageType { get; set; }
/// <summary>
/// Class ImageInfo.
/// </summary>
public class ImageInfo
{
/// <summary>
/// Gets or sets the type of the image.
/// </summary>
/// <value>The type of the image.</value>
public ImageType ImageType { get; set; }
/// <summary>
/// Gets or sets the index of the image.
/// </summary>
/// <value>The index of the image.</value>
public int? ImageIndex { get; set; }
/// <summary>
/// Gets or sets the index of the image.
/// </summary>
/// <value>The index of the image.</value>
public int? ImageIndex { get; set; }
/// <summary>
/// Gets or sets the image tag.
/// </summary>
public string ImageTag { get; set; }
/// <summary>
/// Gets or sets the image tag.
/// </summary>
public string ImageTag { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <value>The path.</value>
public string Path { get; set; }
/// <summary>
/// Gets or sets the path.
/// </summary>
/// <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 blurhash.
/// </summary>
/// <value>The blurhash.</value>
public string BlurHash { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the height.
/// </summary>
/// <value>The height.</value>
public int? Height { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the width.
/// </summary>
/// <value>The width.</value>
public int? Width { get; set; }
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
public long Size { get; set; }
}
}
/// <summary>
/// Gets or sets the size.
/// </summary>
/// <value>The size.</value>
public long Size { get; set; }
}
+75 -77
View File
@@ -2,92 +2,90 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class LibrarySummary.
/// </summary>
public class ItemCounts
{
/// <summary>
/// Gets or sets the movie count.
/// </summary>
/// <value>The movie count.</value>
public int MovieCount { get; set; }
namespace MediaBrowser.Model.Dto;
/// <summary>
/// Class LibrarySummary.
/// </summary>
public class ItemCounts
{
/// <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; }
/// <summary>
/// Gets or sets the series count.
/// </summary>
/// <value>The series count.</value>
public int SeriesCount { 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 episode count.
/// </summary>
/// <value>The episode count.</value>
public int EpisodeCount { get; set; }
/// <summary>
/// Gets or sets the artist count.
/// </summary>
/// <value>The artist count.</value>
public int ArtistCount { get; set; }
/// <summary>
/// Gets or sets the artist count.
/// </summary>
/// <value>The artist count.</value>
public int ArtistCount { get; set; }
/// <summary>
/// Gets or sets the program count.
/// </summary>
/// <value>The program count.</value>
public int ProgramCount { get; set; }
/// <summary>
/// Gets or sets the program count.
/// </summary>
/// <value>The program count.</value>
public int ProgramCount { 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 trailer count.
/// </summary>
/// <value>The trailer count.</value>
public int TrailerCount { 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 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; }
/// <summary>
/// Gets or sets the album count.
/// </summary>
/// <value>The album count.</value>
public int AlbumCount { get; set; }
/// <summary>
/// Gets or sets the music video count.
/// </summary>
/// <value>The music video count.</value>
public int MusicVideoCount { get; set; }
/// <summary>
/// Gets or sets the music video count.
/// </summary>
/// <value>The music video count.</value>
public int MusicVideoCount { get; set; }
/// <summary>
/// Gets or sets the box set count.
/// </summary>
/// <value>The box set count.</value>
public int BoxSetCount { get; set; }
/// <summary>
/// Gets or sets the box set count.
/// </summary>
/// <value>The box set count.</value>
public int BoxSetCount { get; set; }
/// <summary>
/// Gets or sets the book count.
/// </summary>
/// <value>The book count.</value>
public int BookCount { get; set; }
/// <summary>
/// Gets or sets the book count.
/// </summary>
/// <value>The book count.</value>
public int BookCount { get; set; }
/// <summary>
/// Gets or sets the item count.
/// </summary>
/// <value>The item count.</value>
public int ItemCount { get; set; }
/// <summary>
/// Gets or sets the item count.
/// </summary>
/// <value>The item count.</value>
public int ItemCount { get; set; }
/// <summary>
/// Adds all counts.
/// </summary>
/// <returns>The total of the counts.</returns>
public int TotalItemCount()
{
return MovieCount + SeriesCount + EpisodeCount + ArtistCount + ProgramCount + TrailerCount + SongCount + AlbumCount + MusicVideoCount + BoxSetCount + BookCount;
}
}
}
/// <summary>
/// Adds all counts.
/// </summary>
/// <returns>The total of the counts.</returns>
public int TotalItemCount()
{
return MovieCount + SeriesCount + EpisodeCount + ArtistCount + ProgramCount + TrailerCount + SongCount + AlbumCount + MusicVideoCount + BoxSetCount + BookCount;
}
}
+200 -202
View File
@@ -5,263 +5,261 @@
#nullable disable
#pragma warning disable CS1591
using System.Collections.Generic;
using System.ComponentModel;
using System.Text.Json.Serialization;
using global::System.Collections.Generic;
using global::System.ComponentModel;
using global::System.Text.Json.Serialization;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Dto
{
public class MediaSourceInfo
{
public MediaSourceInfo()
{
Formats = [];
MediaStreams = [];
MediaAttachments = [];
RequiredHttpHeaders = [];
SupportsTranscoding = true;
SupportsDirectStream = true;
SupportsDirectPlay = true;
SupportsProbing = true;
UseMostCompatibleTranscodingProfile = false;
DefaultAudioIndexSource = AudioIndexSource.None;
}
namespace MediaBrowser.Model.Dto;
public class MediaSourceInfo
{
public MediaSourceInfo()
{
Formats = [];
MediaStreams = [];
MediaAttachments = [];
RequiredHttpHeaders = [];
SupportsTranscoding = true;
SupportsDirectStream = true;
SupportsDirectPlay = true;
SupportsProbing = true;
UseMostCompatibleTranscodingProfile = false;
DefaultAudioIndexSource = AudioIndexSource.None;
}
public MediaProtocol Protocol { get; set; }
public MediaProtocol Protocol { get; set; }
public string Id { get; set; }
public string Id { get; set; }
public string Path { get; set; }
public string Path { get; set; }
public string EncoderPath { get; set; }
public string EncoderPath { get; set; }
public MediaProtocol? EncoderProtocol { get; set; }
public MediaProtocol? EncoderProtocol { get; set; }
public MediaSourceType Type { get; set; }
public MediaSourceType Type { get; set; }
public string Container { get; set; }
public string Container { get; set; }
public long? Size { get; set; }
public long? Size { get; set; }
public string Name { get; set; }
public string Name { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the media is remote.
/// Differentiate internet url vs local network.
/// </summary>
public bool IsRemote { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the media is remote.
/// Differentiate internet url vs local network.
/// </summary>
public bool IsRemote { get; set; }
public string ETag { get; set; }
public string ETag { get; set; }
public long? RunTimeTicks { get; set; }
public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; }
public bool ReadAtNativeFramerate { get; set; }
public bool IgnoreDts { get; set; }
public bool IgnoreDts { get; set; }
public bool IgnoreIndex { get; set; }
public bool IgnoreIndex { get; set; }
public bool GenPtsInput { get; set; }
public bool GenPtsInput { get; set; }
public bool SupportsTranscoding { get; set; }
public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; }
public bool SupportsDirectStream { get; set; }
public bool SupportsDirectPlay { get; set; }
public bool SupportsDirectPlay { get; set; }
public bool IsInfiniteStream { get; set; }
public bool IsInfiniteStream { get; set; }
[DefaultValue(false)]
public bool UseMostCompatibleTranscodingProfile { get; set; }
[DefaultValue(false)]
public bool UseMostCompatibleTranscodingProfile { get; set; }
public bool RequiresOpening { get; set; }
public bool RequiresOpening { get; set; }
public string OpenToken { get; set; }
public string OpenToken { get; set; }
public bool RequiresClosing { get; set; }
public bool RequiresClosing { get; set; }
public string LiveStreamId { get; set; }
public string LiveStreamId { get; set; }
public int? BufferMs { get; set; }
public int? BufferMs { get; set; }
public bool RequiresLooping { get; set; }
public bool RequiresLooping { get; set; }
public bool SupportsProbing { get; set; }
public bool SupportsProbing { get; set; }
public VideoType? VideoType { get; set; }
public VideoType? VideoType { get; set; }
public IsoType? IsoType { get; set; }
public IsoType? IsoType { get; set; }
public Video3DFormat? Video3DFormat { get; set; }
public Video3DFormat? Video3DFormat { get; set; }
public IReadOnlyList<MediaStream> MediaStreams { get; set; }
public IReadOnlyList<MediaStream> MediaStreams { get; set; }
public IReadOnlyList<MediaAttachment> MediaAttachments { get; set; }
public IReadOnlyList<MediaAttachment> MediaAttachments { get; set; }
public string[] Formats { get; set; }
public string[] Formats { get; set; }
public int? Bitrate { get; set; }
public int? Bitrate { get; set; }
public int? FallbackMaxStreamingBitrate { get; set; }
public int? FallbackMaxStreamingBitrate { get; set; }
public TransportStreamTimestamp? Timestamp { get; set; }
public TransportStreamTimestamp? Timestamp { get; set; }
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
public string TranscodingUrl { get; set; }
public string TranscodingUrl { get; set; }
public MediaStreamProtocol TranscodingSubProtocol { get; set; }
public MediaStreamProtocol TranscodingSubProtocol { get; set; }
public string TranscodingContainer { get; set; }
public string TranscodingContainer { get; set; }
public int? AnalyzeDurationMs { get; set; }
public int? AnalyzeDurationMs { get; set; }
[JsonIgnore]
public TranscodeReason TranscodeReasons { get; set; }
[JsonIgnore]
public TranscodeReason TranscodeReasons { get; set; }
[JsonIgnore]
public AudioIndexSource DefaultAudioIndexSource { get; set; }
[JsonIgnore]
public AudioIndexSource DefaultAudioIndexSource { get; set; }
public int? DefaultAudioStreamIndex { get; set; }
public int? DefaultAudioStreamIndex { get; set; }
public int? DefaultSubtitleStreamIndex { get; set; }
public int? DefaultSubtitleStreamIndex { get; set; }
public bool HasSegments { get; set; }
public bool HasSegments { get; set; }
[JsonIgnore]
public MediaStream VideoStream
{
get
{
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Video)
{
return i;
}
}
[JsonIgnore]
public MediaStream VideoStream
{
get
{
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Video)
{
return i;
}
}
return null;
}
}
return null;
}
}
public void InferTotalBitrate(bool force = false)
{
if (MediaStreams is null)
{
return;
}
public void InferTotalBitrate(bool force = false)
{
if (MediaStreams is null)
{
return;
}
if (!force && Bitrate.HasValue)
{
return;
}
if (!force && Bitrate.HasValue)
{
return;
}
var bitrate = 0;
foreach (var stream in MediaStreams)
{
if (!stream.IsExternal)
{
bitrate += stream.BitRate ?? 0;
}
}
var bitrate = 0;
foreach (var stream in MediaStreams)
{
if (!stream.IsExternal)
{
bitrate += stream.BitRate ?? 0;
}
}
if (bitrate > 0)
{
Bitrate = bitrate;
}
}
public MediaStream GetDefaultAudioStream(int? defaultIndex)
{
if (defaultIndex.HasValue && defaultIndex != -1)
{
var val = defaultIndex.Value;
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio && i.Index == val)
{
return i;
}
}
}
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio && i.IsDefault)
{
return i;
}
}
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio)
{
return i;
}
}
return null;
}
public MediaStream GetMediaStream(MediaStreamType type, int index)
{
foreach (var i in MediaStreams)
{
if (i.Type == type && i.Index == index)
{
return i;
}
}
return null;
}
public int? GetStreamCount(MediaStreamType type)
{
int numMatches = 0;
int numStreams = 0;
foreach (var i in MediaStreams)
{
numStreams++;
if (i.Type == type)
{
numMatches++;
}
}
if (numStreams == 0)
{
return null;
}
return numMatches;
}
public bool? IsSecondaryAudio(MediaStream stream)
{
if (stream.IsExternal)
{
return false;
}
// Look for the first audio track
foreach (var currentStream in MediaStreams)
{
if (currentStream.Type == MediaStreamType.Audio && !currentStream.IsExternal)
{
return currentStream.Index != stream.Index;
}
}
return null;
}
}
}
if (bitrate > 0)
{
Bitrate = bitrate;
}
}
public MediaStream GetDefaultAudioStream(int? defaultIndex)
{
if (defaultIndex.HasValue && defaultIndex != -1)
{
var val = defaultIndex.Value;
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio && i.Index == val)
{
return i;
}
}
}
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio && i.IsDefault)
{
return i;
}
}
foreach (var i in MediaStreams)
{
if (i.Type == MediaStreamType.Audio)
{
return i;
}
}
return null;
}
public MediaStream GetMediaStream(MediaStreamType type, int index)
{
foreach (var i in MediaStreams)
{
if (i.Type == type && i.Index == index)
{
return i;
}
}
return null;
}
public int? GetStreamCount(MediaStreamType type)
{
int numMatches = 0;
int numStreams = 0;
foreach (var i in MediaStreams)
{
numStreams++;
if (i.Type == type)
{
numMatches++;
}
}
if (numStreams == 0)
{
return null;
}
return numMatches;
}
public bool? IsSecondaryAudio(MediaStream stream)
{
if (stream.IsExternal)
{
return false;
}
// Look for the first audio track
foreach (var currentStream in MediaStreams)
{
if (currentStream.Type == MediaStreamType.Audio && !currentStream.IsExternal)
{
return currentStream.Index != stream.Index;
}
}
return null;
}
}
+7 -9
View File
@@ -4,12 +4,10 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public enum MediaSourceType
{
Default = 0,
Grouping = 1,
Placeholder = 2
}
}
namespace MediaBrowser.Model.Dto;
public enum MediaSourceType
{
Default = 0,
Grouping = 1,
Placeholder = 2,
}
+3 -3
View File
@@ -2,14 +2,14 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
namespace MediaBrowser.Model.Dto;
using global::System.Collections.Generic;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Providers;
namespace MediaBrowser.Model.Dto;
/// <summary>
/// A class representing metadata editor information.
/// </summary>
+7 -9
View File
@@ -5,14 +5,12 @@
#nullable disable
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Dto
{
public class NameGuidPair
{
public string Name { get; set; }
namespace MediaBrowser.Model.Dto;
public class NameGuidPair
{
public string Name { get; set; }
public Guid Id { get; set; }
}
}
public Guid Id { get; set; }
}
+14 -16
View File
@@ -5,20 +5,18 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public class NameIdPair
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
namespace MediaBrowser.Model.Dto;
public class NameIdPair
{
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
}
}
/// <summary>
/// Gets or sets the identifier.
/// </summary>
/// <value>The identifier.</value>
public string Id { get; set; }
}
+22 -24
View File
@@ -5,30 +5,28 @@
#nullable disable
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public class NameValuePair
{
public NameValuePair()
{
}
namespace MediaBrowser.Model.Dto;
public class NameValuePair
{
public NameValuePair()
{
}
public NameValuePair(string name, string value)
{
Name = name;
Value = value;
}
public NameValuePair(string name, string value)
{
Name = name;
Value = value;
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; }
}
}
/// <summary>
/// Gets or sets the value.
/// </summary>
/// <value>The value.</value>
public string Value { get; set; }
}
+4 -4
View File
@@ -2,12 +2,12 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Model.Dto;
using global::System;
using global::System.Collections.Generic;
using MediaBrowser.Model.Entities;
/// <summary>
/// DTO for playlists.
/// </summary>
+6 -8
View File
@@ -4,11 +4,9 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public enum RatingType
{
Score,
Likes
}
}
namespace MediaBrowser.Model.Dto;
public enum RatingType
{
Score,
Likes
}
+10 -12
View File
@@ -5,19 +5,17 @@
#nullable disable
#pragma warning disable CS1591
using System;
using System.Collections.Generic;
using global::System;
using global::System.Collections.Generic;
namespace MediaBrowser.Model.Dto
{
public class RecommendationDto
{
public IReadOnlyCollection<BaseItemDto> Items { get; set; }
namespace MediaBrowser.Model.Dto;
public class RecommendationDto
{
public IReadOnlyCollection<BaseItemDto> Items { get; set; }
public RecommendationType RecommendationType { get; set; }
public RecommendationType RecommendationType { get; set; }
public string BaselineItemName { get; set; }
public string BaselineItemName { get; set; }
public Guid CategoryId { get; set; }
}
}
public Guid CategoryId { get; set; }
}
+10 -12
View File
@@ -4,20 +4,18 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Dto
{
public enum RecommendationType
{
SimilarToRecentlyPlayed = 0,
namespace MediaBrowser.Model.Dto;
public enum RecommendationType
{
SimilarToRecentlyPlayed = 0,
SimilarToLikedItem = 1,
SimilarToLikedItem = 1,
HasDirectorFromRecentlyPlayed = 2,
HasDirectorFromRecentlyPlayed = 2,
HasActorFromRecentlyPlayed = 3,
HasActorFromRecentlyPlayed = 3,
HasLikedDirector = 4,
HasLikedDirector = 4,
HasLikedActor = 5
}
}
HasLikedActor = 5,
}
+4 -4
View File
@@ -2,13 +2,13 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using System.Collections.Generic;
namespace MediaBrowser.Model.Dto;
using global::System;
using global::System.Collections.Generic;
using Jellyfin.Data.Enums;
using MediaBrowser.Model.Session;
namespace MediaBrowser.Model.Dto;
/// <summary>
/// Session info DTO.
/// </summary>
+3 -3
View File
@@ -2,11 +2,11 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
using Jellyfin.Database.Implementations.Entities;
namespace MediaBrowser.Model.Dto;
using global::System;
using Jellyfin.Database.Implementations.Entities;
/// <summary>
/// The trickplay api model.
/// </summary>
+63 -65
View File
@@ -2,79 +2,77 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
namespace MediaBrowser.Model.Dto;
using global::System;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// This is used by the api to get information about a item user data.
/// </summary>
public class UpdateUserItemDataDto
{
/// <summary>
/// Gets or sets the rating.
/// </summary>
/// <value>The rating.</value>
public double? Rating { get; set; }
/// <summary>
/// This is used by the api to get information about a item user data.
/// </summary>
public class UpdateUserItemDataDto
{
/// <summary>
/// Gets or sets the rating.
/// </summary>
/// <value>The rating.</value>
public double? Rating { get; set; }
/// <summary>
/// Gets or sets the played percentage.
/// </summary>
/// <value>The played percentage.</value>
public double? PlayedPercentage { get; set; }
/// <summary>
/// Gets or sets the played percentage.
/// </summary>
/// <value>The played percentage.</value>
public double? PlayedPercentage { get; set; }
/// <summary>
/// Gets or sets the unplayed item count.
/// </summary>
/// <value>The unplayed item count.</value>
public int? UnplayedItemCount { get; set; }
/// <summary>
/// Gets or sets the unplayed item count.
/// </summary>
/// <value>The unplayed item count.</value>
public int? UnplayedItemCount { get; set; }
/// <summary>
/// Gets or sets the playback position ticks.
/// </summary>
/// <value>The playback position ticks.</value>
public long? PlaybackPositionTicks { get; set; }
/// <summary>
/// Gets or sets the playback position ticks.
/// </summary>
/// <value>The playback position ticks.</value>
public long? PlaybackPositionTicks { get; set; }
/// <summary>
/// Gets or sets the play count.
/// </summary>
/// <value>The play count.</value>
public int? PlayCount { get; set; }
/// <summary>
/// Gets or sets the play count.
/// </summary>
/// <value>The play count.</value>
public int? PlayCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value><c>true</c> if this instance is favorite; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value><c>true</c> if this instance is favorite; otherwise, <c>false</c>.</value>
public bool? IsFavorite { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UpdateUserItemDataDto" /> is likes.
/// </summary>
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
public bool? Likes { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UpdateUserItemDataDto" /> is likes.
/// </summary>
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
public bool? Likes { get; set; }
/// <summary>
/// Gets or sets the last played date.
/// </summary>
/// <value>The last played date.</value>
public DateTime? LastPlayedDate { get; set; }
/// <summary>
/// Gets or sets the last played date.
/// </summary>
/// <value>The last played date.</value>
public DateTime? LastPlayedDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is played.
/// </summary>
/// <value><c>true</c> if played; otherwise, <c>false</c>.</value>
public bool? Played { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is played.
/// </summary>
/// <value><c>true</c> if played; otherwise, <c>false</c>.</value>
public bool? Played { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>The key.</value>
public string? Key { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>The key.</value>
public string? Key { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string? ItemId { get; set; }
}
}
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public string? ItemId { get; set; }
}
+97 -99
View File
@@ -2,119 +2,117 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Dto;
#nullable disable
using System;
using System.ComponentModel;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Users;
using global::System;
using global::System.ComponentModel;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class UserDto.
/// </summary>
public class UserDto : IItemDto, IHasServerId
{
/// <summary>
/// Initializes a new instance of the <see cref="UserDto"/> class.
/// </summary>
public UserDto()
{
Configuration = new UserConfiguration();
Policy = new UserPolicy();
}
/// <summary>
/// Class UserDto.
/// </summary>
public class UserDto : IItemDto, IHasServerId
{
/// <summary>
/// Initializes a new instance of the <see cref="UserDto"/> class.
/// </summary>
public UserDto()
{
Configuration = new UserConfiguration();
Policy = new UserPolicy();
}
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string Name { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the server identifier.
/// </summary>
/// <value>The server identifier.</value>
public string ServerId { get; set; }
/// <summary>
/// Gets or sets the name of the server.
/// This is not used by the server and is for client-side usage only.
/// </summary>
/// <value>The name of the server.</value>
public string ServerName { get; set; }
/// <summary>
/// Gets or sets the name of the server.
/// This is not used by the server and is for client-side usage only.
/// </summary>
/// <value>The name of the server.</value>
public string ServerName { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
/// <value>The id.</value>
public Guid Id { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets the primary image tag.
/// </summary>
/// <value>The primary image tag.</value>
public string PrimaryImageTag { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance has password.
/// </summary>
/// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
[Obsolete("This information is no longer provided")]
public bool? HasPassword { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether this instance has password.
/// </summary>
/// <value><c>true</c> if this instance has password; otherwise, <c>false</c>.</value>
[Obsolete("This information is no longer provided")]
public bool? HasPassword { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether this instance has configured password.
/// </summary>
/// <value><c>true</c> if this instance has configured password; otherwise, <c>false</c>.</value>
[Obsolete("This is always true")]
public bool? HasConfiguredPassword { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether this instance has configured password.
/// </summary>
/// <value><c>true</c> if this instance has configured password; otherwise, <c>false</c>.</value>
[Obsolete("This is always true")]
public bool? HasConfiguredPassword { get; set; } = true;
/// <summary>
/// Gets or sets a value indicating whether this instance has configured easy password.
/// </summary>
/// <value><c>true</c> if this instance has configured easy password; otherwise, <c>false</c>.</value>
[Obsolete("Easy Password has been replaced with Quick Connect")]
public bool? HasConfiguredEasyPassword { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether this instance has configured easy password.
/// </summary>
/// <value><c>true</c> if this instance has configured easy password; otherwise, <c>false</c>.</value>
[Obsolete("Easy Password has been replaced with Quick Connect")]
public bool? HasConfiguredEasyPassword { get; set; } = false;
/// <summary>
/// Gets or sets whether async login is enabled or not.
/// </summary>
public bool? EnableAutoLogin { get; set; }
/// <summary>
/// Gets or sets whether async login is enabled or not.
/// </summary>
public bool? EnableAutoLogin { get; set; }
/// <summary>
/// Gets or sets the last login date.
/// </summary>
/// <value>The last login date.</value>
public DateTime? LastLoginDate { get; set; }
/// <summary>
/// Gets or sets the last login date.
/// </summary>
/// <value>The last login date.</value>
public DateTime? LastLoginDate { get; set; }
/// <summary>
/// Gets or sets the last activity date.
/// </summary>
/// <value>The last activity date.</value>
public DateTime? LastActivityDate { get; set; }
/// <summary>
/// Gets or sets the last activity date.
/// </summary>
/// <value>The last activity date.</value>
public DateTime? LastActivityDate { get; set; }
/// <summary>
/// Gets or sets the configuration.
/// </summary>
/// <value>The configuration.</value>
public UserConfiguration Configuration { get; set; }
/// <summary>
/// Gets or sets the configuration.
/// </summary>
/// <value>The configuration.</value>
public UserConfiguration Configuration { get; set; }
/// <summary>
/// Gets or sets the policy.
/// </summary>
/// <value>The policy.</value>
public UserPolicy Policy { get; set; }
/// <summary>
/// Gets or sets the policy.
/// </summary>
/// <value>The policy.</value>
public UserPolicy Policy { get; set; }
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
public double? PrimaryImageAspectRatio { get; set; }
/// <summary>
/// Gets or sets the primary image aspect ratio.
/// </summary>
/// <value>The primary image aspect ratio.</value>
public double? PrimaryImageAspectRatio { get; set; }
/// <inheritdoc />
public override string ToString()
{
return Name ?? base.ToString();
}
}
}
/// <inheritdoc />
public override string ToString()
{
return Name ?? base.ToString();
}
}
+63 -65
View File
@@ -2,79 +2,77 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System;
namespace MediaBrowser.Model.Dto;
using global::System;
namespace MediaBrowser.Model.Dto
{
/// <summary>
/// Class UserItemDataDto.
/// </summary>
public class UserItemDataDto
{
/// <summary>
/// Gets or sets the rating.
/// </summary>
/// <value>The rating.</value>
public double? Rating { get; set; }
/// <summary>
/// Class UserItemDataDto.
/// </summary>
public class UserItemDataDto
{
/// <summary>
/// Gets or sets the rating.
/// </summary>
/// <value>The rating.</value>
public double? Rating { get; set; }
/// <summary>
/// Gets or sets the played percentage.
/// </summary>
/// <value>The played percentage.</value>
public double? PlayedPercentage { get; set; }
/// <summary>
/// Gets or sets the played percentage.
/// </summary>
/// <value>The played percentage.</value>
public double? PlayedPercentage { get; set; }
/// <summary>
/// Gets or sets the unplayed item count.
/// </summary>
/// <value>The unplayed item count.</value>
public int? UnplayedItemCount { get; set; }
/// <summary>
/// Gets or sets the unplayed item count.
/// </summary>
/// <value>The unplayed item count.</value>
public int? UnplayedItemCount { get; set; }
/// <summary>
/// Gets or sets the playback position ticks.
/// </summary>
/// <value>The playback position ticks.</value>
public long PlaybackPositionTicks { get; set; }
/// <summary>
/// Gets or sets the playback position ticks.
/// </summary>
/// <value>The playback position ticks.</value>
public long PlaybackPositionTicks { get; set; }
/// <summary>
/// Gets or sets the play count.
/// </summary>
/// <value>The play count.</value>
public int PlayCount { get; set; }
/// <summary>
/// Gets or sets the play count.
/// </summary>
/// <value>The play count.</value>
public int PlayCount { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value><c>true</c> if this instance is favorite; otherwise, <c>false</c>.</value>
public bool IsFavorite { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is favorite.
/// </summary>
/// <value><c>true</c> if this instance is favorite; otherwise, <c>false</c>.</value>
public bool IsFavorite { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is likes.
/// </summary>
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
public bool? Likes { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is likes.
/// </summary>
/// <value><c>null</c> if [likes] contains no value, <c>true</c> if [likes]; otherwise, <c>false</c>.</value>
public bool? Likes { get; set; }
/// <summary>
/// Gets or sets the last played date.
/// </summary>
/// <value>The last played date.</value>
public DateTime? LastPlayedDate { get; set; }
/// <summary>
/// Gets or sets the last played date.
/// </summary>
/// <value>The last played date.</value>
public DateTime? LastPlayedDate { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is played.
/// </summary>
/// <value><c>true</c> if played; otherwise, <c>false</c>.</value>
public bool Played { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this <see cref="UserItemDataDto" /> is played.
/// </summary>
/// <value><c>true</c> if played; otherwise, <c>false</c>.</value>
public bool Played { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>The key.</value>
public required string Key { get; set; }
/// <summary>
/// Gets or sets the key.
/// </summary>
/// <value>The key.</value>
public required string Key { get; set; }
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public Guid ItemId { get; set; }
}
}
/// <summary>
/// Gets or sets the item identifier.
/// </summary>
/// <value>The item identifier.</value>
public Guid ItemId { get; set; }
}
+25 -27
View File
@@ -4,35 +4,33 @@
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Class ChapterInfo.
/// </summary>
public class ChapterInfo
{
/// <summary>
/// Gets or sets the start position ticks.
/// </summary>
/// <value>The start position ticks.</value>
public long StartPositionTicks { get; set; }
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Class ChapterInfo.
/// </summary>
public class ChapterInfo
{
/// <summary>
/// Gets or sets the start position ticks.
/// </summary>
/// <value>The start position ticks.</value>
public long StartPositionTicks { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the name.
/// </summary>
/// <value>The name.</value>
public string? Name { get; set; }
/// <summary>
/// Gets or sets the image path.
/// </summary>
/// <value>The image path.</value>
public string? ImagePath { get; set; }
/// <summary>
/// Gets or sets the image path.
/// </summary>
/// <value>The image path.</value>
public string? ImagePath { get; set; }
public DateTime ImageDateModified { get; set; }
public DateTime ImageDateModified { get; set; }
public string? ImageTag { get; set; }
}
}
public string? ImageTag { get; set; }
}
@@ -49,5 +49,5 @@ public enum CollectionTypeOptions
/// <summary>
/// Mixed Movies and TV Shows.
/// </summary>
mixed = 7
mixed = 7,
}
@@ -19,5 +19,5 @@ public enum DeinterlaceMethod
/// <summary>
/// BWDIF.
/// </summary>
bwdif = 1
bwdif = 1,
}
@@ -35,5 +35,5 @@ public enum DownMixStereoAlgorithms
/// AC-4 standard algorithm with its default gain values.
/// Defined in ETSI TS 103 190 Section 6.2.17.
/// </summary>
Ac4 = 4
Ac4 = 4,
}
+1 -1
View File
@@ -64,5 +64,5 @@ public enum EncoderPreset
/// <summary>
/// Ultrafast preset.
/// </summary>
ultrafast = 10
ultrafast = 10,
}
+16 -18
View File
@@ -4,21 +4,19 @@
#pragma warning disable CS1591
namespace MediaBrowser.Model.Entities
{
public enum ExtraType
{
Unknown = 0,
Clip = 1,
Trailer = 2,
BehindTheScenes = 3,
DeletedScene = 4,
Interview = 5,
Scene = 6,
Sample = 7,
ThemeSong = 8,
ThemeVideo = 9,
Featurette = 10,
Short = 11
}
}
namespace MediaBrowser.Model.Entities;
public enum ExtraType
{
Unknown = 0,
Clip = 1,
Trailer = 2,
BehindTheScenes = 3,
DeletedScene = 4,
Interview = 5,
Scene = 6,
Sample = 7,
ThemeSong = 8,
ThemeVideo = 9,
Featurette = 10,
Short = 11,
}
@@ -49,5 +49,5 @@ public enum HardwareAccelerationType
/// <summary>
/// Rockchip Media Process Platform (RKMPP).
/// </summary>
rkmpp = 7
rkmpp = 7,
}
+13 -15
View File
@@ -2,19 +2,17 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities;
using global::System.Collections.Generic;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary>
public interface IHasProviderIds
{
/// <summary>
/// Gets or sets the provider ids.
/// </summary>
/// <value>The provider ids.</value>
Dictionary<string, string> ProviderIds { get; set; }
}
}
/// <summary>
/// Since BaseItem and DTOBaseItem both have ProviderIds, this interface helps avoid code repetition by using extension methods.
/// </summary>
public interface IHasProviderIds
{
/// <summary>
/// Gets or sets the provider ids.
/// </summary>
/// <value>The provider ids.</value>
Dictionary<string, string> ProviderIds { get; set; }
}
+2 -2
View File
@@ -2,10 +2,10 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
using System.Collections.Generic;
namespace MediaBrowser.Model.Entities;
using global::System.Collections.Generic;
/// <summary>
/// Interface for access to shares.
/// </summary>
+63 -65
View File
@@ -2,80 +2,78 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum ImageType.
/// </summary>
public enum ImageType
{
/// <summary>
/// The primary.
/// </summary>
Primary = 0,
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum ImageType.
/// </summary>
public enum ImageType
{
/// <summary>
/// The primary.
/// </summary>
Primary = 0,
/// <summary>
/// The art.
/// </summary>
Art = 1,
/// <summary>
/// The art.
/// </summary>
Art = 1,
/// <summary>
/// The backdrop.
/// </summary>
Backdrop = 2,
/// <summary>
/// The backdrop.
/// </summary>
Backdrop = 2,
/// <summary>
/// The banner.
/// </summary>
Banner = 3,
/// <summary>
/// The banner.
/// </summary>
Banner = 3,
/// <summary>
/// The logo.
/// </summary>
Logo = 4,
/// <summary>
/// The logo.
/// </summary>
Logo = 4,
/// <summary>
/// The thumb.
/// </summary>
Thumb = 5,
/// <summary>
/// The thumb.
/// </summary>
Thumb = 5,
/// <summary>
/// The disc.
/// </summary>
Disc = 6,
/// <summary>
/// The disc.
/// </summary>
Disc = 6,
/// <summary>
/// The box.
/// </summary>
Box = 7,
/// <summary>
/// The box.
/// </summary>
Box = 7,
/// <summary>
/// The screenshot.
/// </summary>
/// <remarks>
/// This enum value is obsolete.
/// XmlSerializer does not serialize/deserialize objects that are marked as [Obsolete].
/// </remarks>
Screenshot = 8,
/// <summary>
/// The screenshot.
/// </summary>
/// <remarks>
/// This enum value is obsolete.
/// XmlSerializer does not serialize/deserialize objects that are marked as [Obsolete].
/// </remarks>
Screenshot = 8,
/// <summary>
/// The menu.
/// </summary>
Menu = 9,
/// <summary>
/// The menu.
/// </summary>
Menu = 9,
/// <summary>
/// The chapter image.
/// </summary>
Chapter = 10,
/// <summary>
/// The chapter image.
/// </summary>
Chapter = 10,
/// <summary>
/// The box rear.
/// </summary>
BoxRear = 11,
/// <summary>
/// The box rear.
/// </summary>
BoxRear = 11,
/// <summary>
/// The user profile image.
/// </summary>
Profile = 12
}
}
/// <summary>
/// The user profile image.
/// </summary>
Profile = 12,
}
+15 -17
View File
@@ -2,21 +2,19 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum IsoType.
/// </summary>
public enum IsoType
{
/// <summary>
/// The DVD.
/// </summary>
Dvd,
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum IsoType.
/// </summary>
public enum IsoType
{
/// <summary>
/// The DVD.
/// </summary>
Dvd,
/// <summary>
/// The blu ray.
/// </summary>
BluRay
}
}
/// <summary>
/// The blu ray.
/// </summary>
BluRay
}
@@ -4,60 +4,58 @@
#pragma warning disable CS1591
using System;
using global::System;
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// 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>();
}
namespace MediaBrowser.Model.Entities;
/// <summary>
/// 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 added to.
/// </summary>
/// <value>The folders added to.</value>
public string[] FoldersAddedTo { get; set; }
/// <summary>
/// Gets or sets the folders removed from.
/// </summary>
/// <value>The folders removed from.</value>
public string[] FoldersRemovedFrom { get; set; }
/// <summary>
/// Gets or sets the folders removed from.
/// </summary>
/// <value>The folders removed from.</value>
public string[] FoldersRemovedFrom { get; set; }
/// <summary>
/// Gets or sets the items added.
/// </summary>
/// <value>The items added.</value>
public string[] ItemsAdded { get; set; }
/// <summary>
/// Gets or sets the items added.
/// </summary>
/// <value>The items added.</value>
public string[] ItemsAdded { get; set; }
/// <summary>
/// Gets or sets the items removed.
/// </summary>
/// <value>The items removed.</value>
public string[] ItemsRemoved { get; set; }
/// <summary>
/// Gets or sets the items removed.
/// </summary>
/// <value>The items removed.</value>
public string[] ItemsRemoved { get; set; }
/// <summary>
/// Gets or sets the items updated.
/// </summary>
/// <value>The items updated.</value>
public string[] ItemsUpdated { get; set; }
/// <summary>
/// Gets or sets the items updated.
/// </summary>
/// <value>The items updated.</value>
public string[] ItemsUpdated { get; set; }
public string[] CollectionFolders { get; set; }
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;
}
}
public bool IsEmpty => FoldersAddedTo.Length == 0 && FoldersRemovedFrom.Length == 0 && ItemsAdded.Length == 0 && ItemsRemoved.Length == 0 && ItemsUpdated.Length == 0 && CollectionFolders.Length == 0;
}
+23 -25
View File
@@ -2,31 +2,29 @@
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace MediaBrowser.Model.Entities
{
/// <summary>
/// Enum LocationType.
/// </summary>
public enum LocationType
{
/// <summary>
/// The file system.
/// </summary>
FileSystem = 0,
namespace MediaBrowser.Model.Entities;
/// <summary>
/// Enum LocationType.
/// </summary>
public enum LocationType
{
/// <summary>
/// The file system.
/// </summary>
FileSystem = 0,
/// <summary>
/// The remote.
/// </summary>
Remote = 1,
/// <summary>
/// The remote.
/// </summary>
Remote = 1,
/// <summary>
/// The virtual.
/// </summary>
Virtual = 2,
/// <summary>
/// The virtual.
/// </summary>
Virtual = 2,
/// <summary>
/// The offline.
/// </summary>
Offline = 3
}
}
/// <summary>
/// The offline.
/// </summary>
Offline = 3,
}

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