diff options
| author | Dominik <git@secnd.me> | 2023-06-15 19:38:42 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-15 19:38:42 +0200 |
| commit | 17f1e8d19b1fd693893d66d2275ed8ae2476344e (patch) | |
| tree | 7f48be975faa92042769870957587b3c7864f631 /Jellyfin.Api/Models | |
| parent | e8ae7e5c38e28f13fa8de295e26c930cb46d9b79 (diff) | |
| parent | 6771b5cabe96b4b3cbd1cd0c998d564f3dd17ed4 (diff) | |
Merge branch 'master' into segment-deletion
Diffstat (limited to 'Jellyfin.Api/Models')
60 files changed, 1705 insertions, 1891 deletions
diff --git a/Jellyfin.Api/Models/ClientLogDtos/ClientLogDocumentResponseDto.cs b/Jellyfin.Api/Models/ClientLogDtos/ClientLogDocumentResponseDto.cs index 44509a9c0..168247fd5 100644 --- a/Jellyfin.Api/Models/ClientLogDtos/ClientLogDocumentResponseDto.cs +++ b/Jellyfin.Api/Models/ClientLogDtos/ClientLogDocumentResponseDto.cs @@ -1,22 +1,21 @@ -namespace Jellyfin.Api.Models.ClientLogDtos +namespace Jellyfin.Api.Models.ClientLogDtos; + +/// <summary> +/// Client log document response dto. +/// </summary> +public class ClientLogDocumentResponseDto { /// <summary> - /// Client log document response dto. + /// Initializes a new instance of the <see cref="ClientLogDocumentResponseDto"/> class. /// </summary> - public class ClientLogDocumentResponseDto + /// <param name="fileName">The file name.</param> + public ClientLogDocumentResponseDto(string fileName) { - /// <summary> - /// Initializes a new instance of the <see cref="ClientLogDocumentResponseDto"/> class. - /// </summary> - /// <param name="fileName">The file name.</param> - public ClientLogDocumentResponseDto(string fileName) - { - FileName = fileName; - } - - /// <summary> - /// Gets the resulting filename. - /// </summary> - public string FileName { get; } + FileName = fileName; } + + /// <summary> + /// Gets the resulting filename. + /// </summary> + public string FileName { get; } } diff --git a/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs b/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs index 3b827ec12..5a48345eb 100644 --- a/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs +++ b/Jellyfin.Api/Models/ConfigurationDtos/MediaEncoderPathDto.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Models.ConfigurationDtos +namespace Jellyfin.Api.Models.ConfigurationDtos; + +/// <summary> +/// Media Encoder Path Dto. +/// </summary> +public class MediaEncoderPathDto { /// <summary> - /// Media Encoder Path Dto. + /// Gets or sets media encoder path. /// </summary> - public class MediaEncoderPathDto - { - /// <summary> - /// Gets or sets media encoder path. - /// </summary> - public string Path { get; set; } = null!; + public string Path { get; set; } = null!; - /// <summary> - /// Gets or sets media encoder path type. - /// </summary> - public string PathType { get; set; } = null!; - } + /// <summary> + /// Gets or sets media encoder path type. + /// </summary> + public string PathType { get; set; } = null!; } diff --git a/Jellyfin.Api/Models/ConfigurationPageInfo.cs b/Jellyfin.Api/Models/ConfigurationPageInfo.cs index ec4a0d1a1..e7bcd6c53 100644 --- a/Jellyfin.Api/Models/ConfigurationPageInfo.cs +++ b/Jellyfin.Api/Models/ConfigurationPageInfo.cs @@ -2,66 +2,65 @@ using System; using MediaBrowser.Common.Plugins; using MediaBrowser.Model.Plugins; -namespace Jellyfin.Api.Models +namespace Jellyfin.Api.Models; + +/// <summary> +/// The configuration page info. +/// </summary> +public class ConfigurationPageInfo { /// <summary> - /// The configuration page info. + /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. /// </summary> - public class ConfigurationPageInfo + /// <param name="plugin">Instance of <see cref="IPlugin"/> interface.</param> + /// <param name="page">Instance of <see cref="PluginPageInfo"/> interface.</param> + public ConfigurationPageInfo(IPlugin? plugin, PluginPageInfo page) { - /// <summary> - /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. - /// </summary> - /// <param name="plugin">Instance of <see cref="IPlugin"/> interface.</param> - /// <param name="page">Instance of <see cref="PluginPageInfo"/> interface.</param> - public ConfigurationPageInfo(IPlugin? plugin, PluginPageInfo page) - { - Name = page.Name; - EnableInMainMenu = page.EnableInMainMenu; - MenuSection = page.MenuSection; - MenuIcon = page.MenuIcon; - DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin?.Name : page.DisplayName; - PluginId = plugin?.Id; - } + Name = page.Name; + EnableInMainMenu = page.EnableInMainMenu; + MenuSection = page.MenuSection; + MenuIcon = page.MenuIcon; + DisplayName = string.IsNullOrWhiteSpace(page.DisplayName) ? plugin?.Name : page.DisplayName; + PluginId = plugin?.Id; + } - /// <summary> - /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. - /// </summary> - public ConfigurationPageInfo() - { - Name = string.Empty; - } + /// <summary> + /// Initializes a new instance of the <see cref="ConfigurationPageInfo"/> class. + /// </summary> + public ConfigurationPageInfo() + { + Name = string.Empty; + } - /// <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 a value indicating whether the configurations page is enabled in the main menu. - /// </summary> - public bool EnableInMainMenu { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the configurations page is enabled in the main menu. + /// </summary> + public bool EnableInMainMenu { get; set; } - /// <summary> - /// Gets or sets the menu section. - /// </summary> - public string? MenuSection { get; set; } + /// <summary> + /// Gets or sets the menu section. + /// </summary> + public string? MenuSection { get; set; } - /// <summary> - /// Gets or sets the menu icon. - /// </summary> - public string? MenuIcon { get; set; } + /// <summary> + /// Gets or sets the menu icon. + /// </summary> + public string? MenuIcon { get; set; } - /// <summary> - /// Gets or sets the display name. - /// </summary> - public string? DisplayName { get; set; } + /// <summary> + /// Gets or sets the display name. + /// </summary> + public string? DisplayName { get; set; } - /// <summary> - /// Gets or sets the plugin id. - /// </summary> - /// <value>The plugin id.</value> - public Guid? PluginId { get; set; } - } + /// <summary> + /// Gets or sets the plugin id. + /// </summary> + /// <value>The plugin id.</value> + public Guid? PluginId { get; set; } } diff --git a/Jellyfin.Api/Models/EnvironmentDtos/DefaultDirectoryBrowserInfoDto.cs b/Jellyfin.Api/Models/EnvironmentDtos/DefaultDirectoryBrowserInfoDto.cs index 92be15b8a..c438e5a97 100644 --- a/Jellyfin.Api/Models/EnvironmentDtos/DefaultDirectoryBrowserInfoDto.cs +++ b/Jellyfin.Api/Models/EnvironmentDtos/DefaultDirectoryBrowserInfoDto.cs @@ -1,13 +1,12 @@ -namespace Jellyfin.Api.Models.EnvironmentDtos +namespace Jellyfin.Api.Models.EnvironmentDtos; + +/// <summary> +/// Default directory browser info. +/// </summary> +public class DefaultDirectoryBrowserInfoDto { /// <summary> - /// Default directory browser info. + /// Gets or sets the path. /// </summary> - public class DefaultDirectoryBrowserInfoDto - { - /// <summary> - /// Gets or sets the path. - /// </summary> - public string? Path { get; set; } - } + public string? Path { get; set; } } diff --git a/Jellyfin.Api/Models/EnvironmentDtos/ValidatePathDto.cs b/Jellyfin.Api/Models/EnvironmentDtos/ValidatePathDto.cs index 418c11c2d..c54205bfa 100644 --- a/Jellyfin.Api/Models/EnvironmentDtos/ValidatePathDto.cs +++ b/Jellyfin.Api/Models/EnvironmentDtos/ValidatePathDto.cs @@ -1,23 +1,22 @@ -namespace Jellyfin.Api.Models.EnvironmentDtos +namespace Jellyfin.Api.Models.EnvironmentDtos; + +/// <summary> +/// Validate path object. +/// </summary> +public class ValidatePathDto { /// <summary> - /// Validate path object. + /// Gets or sets a value indicating whether validate if path is writable. /// </summary> - public class ValidatePathDto - { - /// <summary> - /// Gets or sets a value indicating whether validate if path is writable. - /// </summary> - public bool ValidateWritable { get; set; } + public bool ValidateWritable { get; set; } - /// <summary> - /// Gets or sets the path. - /// </summary> - public string? Path { get; set; } + /// <summary> + /// Gets or sets the path. + /// </summary> + public string? Path { get; set; } - /// <summary> - /// Gets or sets is path file. - /// </summary> - public bool? IsFile { get; set; } - } + /// <summary> + /// Gets or sets is path file. + /// </summary> + public bool? IsFile { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryDtos/LibraryOptionInfoDto.cs b/Jellyfin.Api/Models/LibraryDtos/LibraryOptionInfoDto.cs index 358434434..6401522f6 100644 --- a/Jellyfin.Api/Models/LibraryDtos/LibraryOptionInfoDto.cs +++ b/Jellyfin.Api/Models/LibraryDtos/LibraryOptionInfoDto.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Models.LibraryDtos +namespace Jellyfin.Api.Models.LibraryDtos; + +/// <summary> +/// Library option info dto. +/// </summary> +public class LibraryOptionInfoDto { /// <summary> - /// Library option info dto. + /// Gets or sets name. /// </summary> - public class LibraryOptionInfoDto - { - /// <summary> - /// Gets or sets name. - /// </summary> - public string? Name { get; set; } + public string? Name { get; set; } - /// <summary> - /// Gets or sets a value indicating whether default enabled. - /// </summary> - public bool DefaultEnabled { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether default enabled. + /// </summary> + public bool DefaultEnabled { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryDtos/LibraryOptionsResultDto.cs b/Jellyfin.Api/Models/LibraryDtos/LibraryOptionsResultDto.cs index 7de44aa65..78efacd94 100644 --- a/Jellyfin.Api/Models/LibraryDtos/LibraryOptionsResultDto.cs +++ b/Jellyfin.Api/Models/LibraryDtos/LibraryOptionsResultDto.cs @@ -1,31 +1,30 @@ using System; using System.Collections.Generic; -namespace Jellyfin.Api.Models.LibraryDtos +namespace Jellyfin.Api.Models.LibraryDtos; + +/// <summary> +/// Library options result dto. +/// </summary> +public class LibraryOptionsResultDto { /// <summary> - /// Library options result dto. + /// Gets or sets the metadata savers. /// </summary> - public class LibraryOptionsResultDto - { - /// <summary> - /// Gets or sets the metadata savers. - /// </summary> - public IReadOnlyList<LibraryOptionInfoDto> MetadataSavers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); + public IReadOnlyList<LibraryOptionInfoDto> MetadataSavers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); - /// <summary> - /// Gets or sets the metadata readers. - /// </summary> - public IReadOnlyList<LibraryOptionInfoDto> MetadataReaders { get; set; } = Array.Empty<LibraryOptionInfoDto>(); + /// <summary> + /// Gets or sets the metadata readers. + /// </summary> + public IReadOnlyList<LibraryOptionInfoDto> MetadataReaders { get; set; } = Array.Empty<LibraryOptionInfoDto>(); - /// <summary> - /// Gets or sets the subtitle fetchers. - /// </summary> - public IReadOnlyList<LibraryOptionInfoDto> SubtitleFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); + /// <summary> + /// Gets or sets the subtitle fetchers. + /// </summary> + public IReadOnlyList<LibraryOptionInfoDto> SubtitleFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); - /// <summary> - /// Gets or sets the type options. - /// </summary> - public IReadOnlyList<LibraryTypeOptionsDto> TypeOptions { get; set; } = Array.Empty<LibraryTypeOptionsDto>(); - } + /// <summary> + /// Gets or sets the type options. + /// </summary> + public IReadOnlyList<LibraryTypeOptionsDto> TypeOptions { get; set; } = Array.Empty<LibraryTypeOptionsDto>(); } diff --git a/Jellyfin.Api/Models/LibraryDtos/LibraryTypeOptionsDto.cs b/Jellyfin.Api/Models/LibraryDtos/LibraryTypeOptionsDto.cs index 20f45196d..125a6746e 100644 --- a/Jellyfin.Api/Models/LibraryDtos/LibraryTypeOptionsDto.cs +++ b/Jellyfin.Api/Models/LibraryDtos/LibraryTypeOptionsDto.cs @@ -3,36 +3,35 @@ using System.Collections.Generic; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; -namespace Jellyfin.Api.Models.LibraryDtos +namespace Jellyfin.Api.Models.LibraryDtos; + +/// <summary> +/// Library type options dto. +/// </summary> +public class LibraryTypeOptionsDto { /// <summary> - /// Library type options dto. + /// Gets or sets the type. /// </summary> - public class LibraryTypeOptionsDto - { - /// <summary> - /// Gets or sets the type. - /// </summary> - public string? Type { get; set; } + public string? Type { get; set; } - /// <summary> - /// Gets or sets the metadata fetchers. - /// </summary> - public IReadOnlyList<LibraryOptionInfoDto> MetadataFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); + /// <summary> + /// Gets or sets the metadata fetchers. + /// </summary> + public IReadOnlyList<LibraryOptionInfoDto> MetadataFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); - /// <summary> - /// Gets or sets the image fetchers. - /// </summary> - public IReadOnlyList<LibraryOptionInfoDto> ImageFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); + /// <summary> + /// Gets or sets the image fetchers. + /// </summary> + public IReadOnlyList<LibraryOptionInfoDto> ImageFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>(); - /// <summary> - /// Gets or sets the supported image types. - /// </summary> - public IReadOnlyList<ImageType> SupportedImageTypes { get; set; } = Array.Empty<ImageType>(); + /// <summary> + /// Gets or sets the supported image types. + /// </summary> + public IReadOnlyList<ImageType> SupportedImageTypes { get; set; } = Array.Empty<ImageType>(); - /// <summary> - /// Gets or sets the default image options. - /// </summary> - public IReadOnlyList<ImageOption> DefaultImageOptions { get; set; } = Array.Empty<ImageOption>(); - } + /// <summary> + /// Gets or sets the default image options. + /// </summary> + public IReadOnlyList<ImageOption> DefaultImageOptions { get; set; } = Array.Empty<ImageOption>(); } diff --git a/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoDto.cs b/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoDto.cs index f93638898..b34e0bba5 100644 --- a/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoDto.cs +++ b/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoDto.cs @@ -1,16 +1,15 @@ using System; using System.Collections.Generic; -namespace Jellyfin.Api.Models.LibraryDtos +namespace Jellyfin.Api.Models.LibraryDtos; + +/// <summary> +/// Media Update Info Dto. +/// </summary> +public class MediaUpdateInfoDto { /// <summary> - /// Media Update Info Dto. + /// Gets or sets the list of updates. /// </summary> - public class MediaUpdateInfoDto - { - /// <summary> - /// Gets or sets the list of updates. - /// </summary> - public IReadOnlyList<MediaUpdateInfoPathDto> Updates { get; set; } = Array.Empty<MediaUpdateInfoPathDto>(); - } + public IReadOnlyList<MediaUpdateInfoPathDto> Updates { get; set; } = Array.Empty<MediaUpdateInfoPathDto>(); } diff --git a/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs b/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs index 852315b92..5bbaea669 100644 --- a/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs +++ b/Jellyfin.Api/Models/LibraryDtos/MediaUpdateInfoPathDto.cs @@ -1,19 +1,18 @@ -namespace Jellyfin.Api.Models.LibraryDtos +namespace Jellyfin.Api.Models.LibraryDtos; + +/// <summary> +/// The media update info path. +/// </summary> +public class MediaUpdateInfoPathDto { /// <summary> - /// The media update info path. + /// Gets or sets media path. /// </summary> - public class MediaUpdateInfoPathDto - { - /// <summary> - /// Gets or sets media path. - /// </summary> - public string? Path { get; set; } + public string? Path { get; set; } - /// <summary> - /// Gets or sets media update type. - /// Created, Modified, Deleted. - /// </summary> - public string? UpdateType { get; set; } - } + /// <summary> + /// Gets or sets media update type. + /// Created, Modified, Deleted. + /// </summary> + public string? UpdateType { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cs index ab68d5223..16d3f65c9 100644 --- a/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cs +++ b/Jellyfin.Api/Models/LibraryStructureDto/AddVirtualFolderDto.cs @@ -1,15 +1,14 @@ using MediaBrowser.Model.Configuration; -namespace Jellyfin.Api.Models.LibraryStructureDto +namespace Jellyfin.Api.Models.LibraryStructureDto; + +/// <summary> +/// Add virtual folder dto. +/// </summary> +public class AddVirtualFolderDto { /// <summary> - /// Add virtual folder dto. + /// Gets or sets library options. /// </summary> - public class AddVirtualFolderDto - { - /// <summary> - /// Gets or sets library options. - /// </summary> - public LibraryOptions? LibraryOptions { get; set; } - } + public LibraryOptions? LibraryOptions { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryStructureDto/MediaPathDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/MediaPathDto.cs index 8b26ec317..94ffc5238 100644 --- a/Jellyfin.Api/Models/LibraryStructureDto/MediaPathDto.cs +++ b/Jellyfin.Api/Models/LibraryStructureDto/MediaPathDto.cs @@ -1,27 +1,26 @@ using System.ComponentModel.DataAnnotations; using MediaBrowser.Model.Configuration; -namespace Jellyfin.Api.Models.LibraryStructureDto +namespace Jellyfin.Api.Models.LibraryStructureDto; + +/// <summary> +/// Media Path dto. +/// </summary> +public class MediaPathDto { /// <summary> - /// Media Path dto. + /// Gets or sets the name of the library. /// </summary> - public class MediaPathDto - { - /// <summary> - /// Gets or sets the name of the library. - /// </summary> - [Required] - public string? Name { get; set; } + [Required] + public string? Name { get; set; } - /// <summary> - /// Gets or sets the path to add. - /// </summary> - public string? Path { get; set; } + /// <summary> + /// Gets or sets the path to add. + /// </summary> + public string? Path { get; set; } - /// <summary> - /// Gets or sets the path info. - /// </summary> - public MediaPathInfo? PathInfo { get; set; } - } + /// <summary> + /// Gets or sets the path info. + /// </summary> + public MediaPathInfo? PathInfo { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs index c78ed51f7..225c7c7bc 100644 --- a/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs +++ b/Jellyfin.Api/Models/LibraryStructureDto/UpdateLibraryOptionsDto.cs @@ -1,21 +1,20 @@ using System; using MediaBrowser.Model.Configuration; -namespace Jellyfin.Api.Models.LibraryStructureDto +namespace Jellyfin.Api.Models.LibraryStructureDto; + +/// <summary> +/// Update library options dto. +/// </summary> +public class UpdateLibraryOptionsDto { /// <summary> - /// Update library options dto. + /// Gets or sets the library item id. /// </summary> - public class UpdateLibraryOptionsDto - { - /// <summary> - /// Gets or sets the library item id. - /// </summary> - public Guid Id { get; set; } + public Guid Id { get; set; } - /// <summary> - /// Gets or sets library options. - /// </summary> - public LibraryOptions? LibraryOptions { get; set; } - } + /// <summary> + /// Gets or sets library options. + /// </summary> + public LibraryOptions? LibraryOptions { get; set; } } diff --git a/Jellyfin.Api/Models/LibraryStructureDto/UpdateMediaPathRequestDto.cs b/Jellyfin.Api/Models/LibraryStructureDto/UpdateMediaPathRequestDto.cs index fbd4985f9..a4d33f3b9 100644 --- a/Jellyfin.Api/Models/LibraryStructureDto/UpdateMediaPathRequestDto.cs +++ b/Jellyfin.Api/Models/LibraryStructureDto/UpdateMediaPathRequestDto.cs @@ -1,23 +1,22 @@ using System.ComponentModel.DataAnnotations; using MediaBrowser.Model.Configuration; -namespace Jellyfin.Api.Models.LibraryStructureDto +namespace Jellyfin.Api.Models.LibraryStructureDto; + +/// <summary> +/// Update library options dto. +/// </summary> +public class UpdateMediaPathRequestDto { /// <summary> - /// Update library options dto. + /// Gets or sets the library name. /// </summary> - public class UpdateMediaPathRequestDto - { - /// <summary> - /// Gets or sets the library name. - /// </summary> - [Required] - public string Name { get; set; } = null!; + [Required] + public string Name { get; set; } = null!; - /// <summary> - /// Gets or sets library folder path information. - /// </summary> - [Required] - public MediaPathInfo PathInfo { get; set; } = null!; - } + /// <summary> + /// Gets or sets library folder path information. + /// </summary> + [Required] + public MediaPathInfo PathInfo { get; set; } = null!; } diff --git a/Jellyfin.Api/Models/LiveTvDtos/ChannelMappingOptionsDto.cs b/Jellyfin.Api/Models/LiveTvDtos/ChannelMappingOptionsDto.cs index f43822da7..75222ed01 100644 --- a/Jellyfin.Api/Models/LiveTvDtos/ChannelMappingOptionsDto.cs +++ b/Jellyfin.Api/Models/LiveTvDtos/ChannelMappingOptionsDto.cs @@ -1,36 +1,32 @@ using System; using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Dto; -namespace Jellyfin.Api.Models.LiveTvDtos +namespace Jellyfin.Api.Models.LiveTvDtos; + +/// <summary> +/// Channel mapping options dto. +/// </summary> +public class ChannelMappingOptionsDto { /// <summary> - /// Channel mapping options dto. + /// Gets or sets list of tuner channels. /// </summary> - public class ChannelMappingOptionsDto - { - /// <summary> - /// Gets or sets list of tuner channels. - /// </summary> - [SuppressMessage("Microsoft.Performance", "CA2227:ReadOnlyRemoveSetter", MessageId = "TunerChannels", Justification = "Imported from ServiceStack")] - public List<TunerChannelMapping> TunerChannels { get; set; } = null!; + required public IReadOnlyList<TunerChannelMapping> TunerChannels { get; set; } - /// <summary> - /// Gets or sets list of provider channels. - /// </summary> - [SuppressMessage("Microsoft.Performance", "CA2227:ReadOnlyRemoveSetter", MessageId = "ProviderChannels", Justification = "Imported from ServiceStack")] - public List<NameIdPair> ProviderChannels { get; set; } = null!; + /// <summary> + /// Gets or sets list of provider channels. + /// </summary> + required public IReadOnlyList<NameIdPair> ProviderChannels { get; set; } - /// <summary> - /// Gets or sets list of mappings. - /// </summary> - public IReadOnlyList<NameValuePair> Mappings { get; set; } = Array.Empty<NameValuePair>(); + /// <summary> + /// Gets or sets list of mappings. + /// </summary> + public IReadOnlyList<NameValuePair> Mappings { get; set; } = Array.Empty<NameValuePair>(); - /// <summary> - /// Gets or sets provider name. - /// </summary> - public string? ProviderName { get; set; } - } + /// <summary> + /// Gets or sets provider name. + /// </summary> + public string? ProviderName { get; set; } } diff --git a/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs b/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs index 411e4c550..5e7dd689e 100644 --- a/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs +++ b/Jellyfin.Api/Models/LiveTvDtos/GetProgramsDto.cs @@ -6,174 +6,173 @@ using Jellyfin.Extensions.Json.Converters; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; -namespace Jellyfin.Api.Models.LiveTvDtos +namespace Jellyfin.Api.Models.LiveTvDtos; + +/// <summary> +/// Get programs dto. +/// </summary> +public class GetProgramsDto { /// <summary> - /// Get programs dto. - /// </summary> - public class GetProgramsDto - { - /// <summary> - /// Gets or sets the channels to return guide information for. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<Guid> ChannelIds { get; set; } = Array.Empty<Guid>(); - - /// <summary> - /// Gets or sets optional. Filter by user id. - /// </summary> - public Guid UserId { get; set; } - - /// <summary> - /// Gets or sets the minimum premiere start date. - /// Optional. - /// </summary> - public DateTime? MinStartDate { get; set; } - - /// <summary> - /// Gets or sets filter by programs that have completed airing, or not. - /// Optional. - /// </summary> - public bool? HasAired { get; set; } - - /// <summary> - /// Gets or sets filter by programs that are currently airing, or not. - /// Optional. - /// </summary> - public bool? IsAiring { get; set; } - - /// <summary> - /// Gets or sets the maximum premiere start date. - /// Optional. - /// </summary> - public DateTime? MaxStartDate { get; set; } - - /// <summary> - /// Gets or sets the minimum premiere end date. - /// Optional. - /// </summary> - public DateTime? MinEndDate { get; set; } - - /// <summary> - /// Gets or sets the maximum premiere end date. - /// Optional. - /// </summary> - public DateTime? MaxEndDate { get; set; } - - /// <summary> - /// Gets or sets filter for movies. - /// Optional. - /// </summary> - public bool? IsMovie { get; set; } - - /// <summary> - /// Gets or sets filter for series. - /// Optional. - /// </summary> - public bool? IsSeries { get; set; } - - /// <summary> - /// Gets or sets filter for news. - /// Optional. - /// </summary> - public bool? IsNews { get; set; } - - /// <summary> - /// Gets or sets filter for kids. - /// Optional. - /// </summary> - public bool? IsKids { get; set; } - - /// <summary> - /// Gets or sets filter for sports. - /// Optional. - /// </summary> - public bool? IsSports { get; set; } - - /// <summary> - /// Gets or sets the record index to start at. All items with a lower index will be dropped from the results. - /// Optional. - /// </summary> - public int? StartIndex { get; set; } - - /// <summary> - /// Gets or sets the maximum number of records to return. - /// Optional. - /// </summary> - public int? Limit { get; set; } - - /// <summary> - /// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. - /// Optional. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<string> SortBy { get; set; } = Array.Empty<string>(); - - /// <summary> - /// Gets or sets sort Order - Ascending,Descending. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<SortOrder> SortOrder { get; set; } = Array.Empty<SortOrder>(); - - /// <summary> - /// Gets or sets the genres to return guide information for. - /// </summary> - [JsonConverter(typeof(JsonPipeDelimitedArrayConverterFactory))] - public IReadOnlyList<string> Genres { get; set; } = Array.Empty<string>(); - - /// <summary> - /// Gets or sets the genre ids to return guide information for. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<Guid> GenreIds { get; set; } = Array.Empty<Guid>(); - - /// <summary> - /// Gets or sets include image information in output. - /// Optional. - /// </summary> - public bool? EnableImages { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether retrieve total record count. - /// </summary> - public bool EnableTotalRecordCount { get; set; } = true; - - /// <summary> - /// Gets or sets the max number of images to return, per image type. - /// Optional. - /// </summary> - public int? ImageTypeLimit { get; set; } - - /// <summary> - /// Gets or sets the image types to include in the output. - /// Optional. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<ImageType> EnableImageTypes { get; set; } = Array.Empty<ImageType>(); - - /// <summary> - /// Gets or sets include user data. - /// Optional. - /// </summary> - public bool? EnableUserData { get; set; } - - /// <summary> - /// Gets or sets filter by series timer id. - /// Optional. - /// </summary> - public string? SeriesTimerId { get; set; } - - /// <summary> - /// Gets or sets filter by library series id. - /// Optional. - /// </summary> - public Guid LibrarySeriesId { get; set; } - - /// <summary> - /// Gets or sets specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines. - /// Optional. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<ItemFields> Fields { get; set; } = Array.Empty<ItemFields>(); - } + /// Gets or sets the channels to return guide information for. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<Guid> ChannelIds { get; set; } = Array.Empty<Guid>(); + + /// <summary> + /// Gets or sets optional. Filter by user id. + /// </summary> + public Guid UserId { get; set; } + + /// <summary> + /// Gets or sets the minimum premiere start date. + /// Optional. + /// </summary> + public DateTime? MinStartDate { get; set; } + + /// <summary> + /// Gets or sets filter by programs that have completed airing, or not. + /// Optional. + /// </summary> + public bool? HasAired { get; set; } + + /// <summary> + /// Gets or sets filter by programs that are currently airing, or not. + /// Optional. + /// </summary> + public bool? IsAiring { get; set; } + + /// <summary> + /// Gets or sets the maximum premiere start date. + /// Optional. + /// </summary> + public DateTime? MaxStartDate { get; set; } + + /// <summary> + /// Gets or sets the minimum premiere end date. + /// Optional. + /// </summary> + public DateTime? MinEndDate { get; set; } + + /// <summary> + /// Gets or sets the maximum premiere end date. + /// Optional. + /// </summary> + public DateTime? MaxEndDate { get; set; } + + /// <summary> + /// Gets or sets filter for movies. + /// Optional. + /// </summary> + public bool? IsMovie { get; set; } + + /// <summary> + /// Gets or sets filter for series. + /// Optional. + /// </summary> + public bool? IsSeries { get; set; } + + /// <summary> + /// Gets or sets filter for news. + /// Optional. + /// </summary> + public bool? IsNews { get; set; } + + /// <summary> + /// Gets or sets filter for kids. + /// Optional. + /// </summary> + public bool? IsKids { get; set; } + + /// <summary> + /// Gets or sets filter for sports. + /// Optional. + /// </summary> + public bool? IsSports { get; set; } + + /// <summary> + /// Gets or sets the record index to start at. All items with a lower index will be dropped from the results. + /// Optional. + /// </summary> + public int? StartIndex { get; set; } + + /// <summary> + /// Gets or sets the maximum number of records to return. + /// Optional. + /// </summary> + public int? Limit { get; set; } + + /// <summary> + /// Gets or sets specify one or more sort orders, comma delimited. Options: Name, StartDate. + /// Optional. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<string> SortBy { get; set; } = Array.Empty<string>(); + + /// <summary> + /// Gets or sets sort Order - Ascending,Descending. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<SortOrder> SortOrder { get; set; } = Array.Empty<SortOrder>(); + + /// <summary> + /// Gets or sets the genres to return guide information for. + /// </summary> + [JsonConverter(typeof(JsonPipeDelimitedArrayConverterFactory))] + public IReadOnlyList<string> Genres { get; set; } = Array.Empty<string>(); + + /// <summary> + /// Gets or sets the genre ids to return guide information for. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<Guid> GenreIds { get; set; } = Array.Empty<Guid>(); + + /// <summary> + /// Gets or sets include image information in output. + /// Optional. + /// </summary> + public bool? EnableImages { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether retrieve total record count. + /// </summary> + public bool EnableTotalRecordCount { get; set; } = true; + + /// <summary> + /// Gets or sets the max number of images to return, per image type. + /// Optional. + /// </summary> + public int? ImageTypeLimit { get; set; } + + /// <summary> + /// Gets or sets the image types to include in the output. + /// Optional. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<ImageType> EnableImageTypes { get; set; } = Array.Empty<ImageType>(); + + /// <summary> + /// Gets or sets include user data. + /// Optional. + /// </summary> + public bool? EnableUserData { get; set; } + + /// <summary> + /// Gets or sets filter by series timer id. + /// Optional. + /// </summary> + public string? SeriesTimerId { get; set; } + + /// <summary> + /// Gets or sets filter by library series id. + /// Optional. + /// </summary> + public Guid LibrarySeriesId { get; set; } + + /// <summary> + /// Gets or sets specify additional fields of information to return in the output. This allows multiple, comma delimited. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines. + /// Optional. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<ItemFields> Fields { get; set; } = Array.Empty<ItemFields>(); } diff --git a/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs b/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs index e7501bd9f..2dbaece5e 100644 --- a/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs +++ b/Jellyfin.Api/Models/LiveTvDtos/SetChannelMappingDto.cs @@ -1,28 +1,27 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.LiveTvDtos +namespace Jellyfin.Api.Models.LiveTvDtos; + +/// <summary> +/// Set channel mapping dto. +/// </summary> +public class SetChannelMappingDto { /// <summary> - /// Set channel mapping dto. + /// Gets or sets the provider id. /// </summary> - public class SetChannelMappingDto - { - /// <summary> - /// Gets or sets the provider id. - /// </summary> - [Required] - public string ProviderId { get; set; } = string.Empty; + [Required] + public string ProviderId { get; set; } = string.Empty; - /// <summary> - /// Gets or sets the tuner channel id. - /// </summary> - [Required] - public string TunerChannelId { get; set; } = string.Empty; + /// <summary> + /// Gets or sets the tuner channel id. + /// </summary> + [Required] + public string TunerChannelId { get; set; } = string.Empty; - /// <summary> - /// Gets or sets the provider channel id. - /// </summary> - [Required] - public string ProviderChannelId { get; set; } = string.Empty; - } + /// <summary> + /// Gets or sets the provider channel id. + /// </summary> + [Required] + public string ProviderChannelId { get; set; } = string.Empty; } diff --git a/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs b/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs index 704542326..99b3f7020 100644 --- a/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs +++ b/Jellyfin.Api/Models/MediaInfoDtos/OpenLiveStreamDto.cs @@ -3,76 +3,75 @@ using System.Collections.Generic; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.MediaInfo; -namespace Jellyfin.Api.Models.MediaInfoDtos +namespace Jellyfin.Api.Models.MediaInfoDtos; + +/// <summary> +/// Open live stream dto. +/// </summary> +public class OpenLiveStreamDto { /// <summary> - /// Open live stream dto. + /// Gets or sets the open token. /// </summary> - public class OpenLiveStreamDto - { - /// <summary> - /// Gets or sets the open token. - /// </summary> - public string? OpenToken { get; set; } + public string? OpenToken { get; set; } - /// <summary> - /// Gets or sets the user id. - /// </summary> - public Guid? UserId { get; set; } + /// <summary> + /// Gets or sets the user id. + /// </summary> + public Guid? UserId { get; set; } - /// <summary> - /// Gets or sets the play session id. - /// </summary> - public string? PlaySessionId { get; set; } + /// <summary> + /// Gets or sets the play session id. + /// </summary> + public string? PlaySessionId { get; set; } - /// <summary> - /// Gets or sets the max streaming bitrate. - /// </summary> - public int? MaxStreamingBitrate { get; set; } + /// <summary> + /// Gets or sets the max streaming bitrate. + /// </summary> + public int? MaxStreamingBitrate { get; set; } - /// <summary> - /// Gets or sets the start time in ticks. - /// </summary> - public long? StartTimeTicks { get; set; } + /// <summary> + /// Gets or sets the start time in ticks. + /// </summary> + public long? StartTimeTicks { get; set; } - /// <summary> - /// Gets or sets the audio stream index. - /// </summary> - public int? AudioStreamIndex { get; set; } + /// <summary> + /// Gets or sets the audio stream index. + /// </summary> + public int? AudioStreamIndex { get; set; } - /// <summary> - /// Gets or sets the subtitle stream index. - /// </summary> - public int? SubtitleStreamIndex { get; set; } + /// <summary> + /// Gets or sets the subtitle stream index. + /// </summary> + public int? SubtitleStreamIndex { get; set; } - /// <summary> - /// Gets or sets the max audio channels. - /// </summary> - public int? MaxAudioChannels { get; set; } + /// <summary> + /// Gets or sets the max audio channels. + /// </summary> + public int? MaxAudioChannels { 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 a value indicating whether to enable direct play. - /// </summary> - public bool? EnableDirectPlay { get; set; } + /// <summary> + /// Gets or sets a value indicating whether to enable direct play. + /// </summary> + public bool? EnableDirectPlay { get; set; } - /// <summary> - /// Gets or sets a value indicating whether to enale direct stream. - /// </summary> - public bool? EnableDirectStream { get; set; } + /// <summary> + /// Gets or sets a value indicating whether to enale direct stream. + /// </summary> + public bool? EnableDirectStream { get; set; } - /// <summary> - /// Gets or sets the device profile. - /// </summary> - public DeviceProfile? DeviceProfile { get; set; } + /// <summary> + /// Gets or sets the device profile. + /// </summary> + public DeviceProfile? DeviceProfile { get; set; } - /// <summary> - /// Gets or sets the device play protocols. - /// </summary> - public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; } = Array.Empty<MediaProtocol>(); - } + /// <summary> + /// Gets or sets the device play protocols. + /// </summary> + public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; } = Array.Empty<MediaProtocol>(); } diff --git a/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs b/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs index c6bd5e56e..0ef1867cd 100644 --- a/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs +++ b/Jellyfin.Api/Models/MediaInfoDtos/PlaybackInfoDto.cs @@ -1,86 +1,85 @@ using System; using MediaBrowser.Model.Dlna; -namespace Jellyfin.Api.Models.MediaInfoDtos +namespace Jellyfin.Api.Models.MediaInfoDtos; + +/// <summary> +/// Plabyback info dto. +/// </summary> +public class PlaybackInfoDto { /// <summary> - /// Plabyback info dto. + /// Gets or sets the playback userId. + /// </summary> + public Guid? UserId { get; set; } + + /// <summary> + /// Gets or sets the max streaming bitrate. + /// </summary> + public int? MaxStreamingBitrate { get; set; } + + /// <summary> + /// Gets or sets the start time in ticks. + /// </summary> + public long? StartTimeTicks { get; set; } + + /// <summary> + /// Gets or sets the audio stream index. + /// </summary> + public int? AudioStreamIndex { get; set; } + + /// <summary> + /// Gets or sets the subtitle stream index. + /// </summary> + public int? SubtitleStreamIndex { get; set; } + + /// <summary> + /// Gets or sets the max audio channels. + /// </summary> + public int? MaxAudioChannels { get; set; } + + /// <summary> + /// Gets or sets the media source id. + /// </summary> + public string? MediaSourceId { get; set; } + + /// <summary> + /// Gets or sets the live stream id. + /// </summary> + public string? LiveStreamId { get; set; } + + /// <summary> + /// Gets or sets the device profile. + /// </summary> + public DeviceProfile? DeviceProfile { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable direct play. + /// </summary> + public bool? EnableDirectPlay { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable direct stream. + /// </summary> + public bool? EnableDirectStream { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable transcoding. + /// </summary> + public bool? EnableTranscoding { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable video stream copy. + /// </summary> + public bool? AllowVideoStreamCopy { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to allow audio stream copy. + /// </summary> + public bool? AllowAudioStreamCopy { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to auto open the live stream. /// </summary> - public class PlaybackInfoDto - { - /// <summary> - /// Gets or sets the playback userId. - /// </summary> - public Guid? UserId { get; set; } - - /// <summary> - /// Gets or sets the max streaming bitrate. - /// </summary> - public int? MaxStreamingBitrate { get; set; } - - /// <summary> - /// Gets or sets the start time in ticks. - /// </summary> - public long? StartTimeTicks { get; set; } - - /// <summary> - /// Gets or sets the audio stream index. - /// </summary> - public int? AudioStreamIndex { get; set; } - - /// <summary> - /// Gets or sets the subtitle stream index. - /// </summary> - public int? SubtitleStreamIndex { get; set; } - - /// <summary> - /// Gets or sets the max audio channels. - /// </summary> - public int? MaxAudioChannels { get; set; } - - /// <summary> - /// Gets or sets the media source id. - /// </summary> - public string? MediaSourceId { get; set; } - - /// <summary> - /// Gets or sets the live stream id. - /// </summary> - public string? LiveStreamId { get; set; } - - /// <summary> - /// Gets or sets the device profile. - /// </summary> - public DeviceProfile? DeviceProfile { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to enable direct play. - /// </summary> - public bool? EnableDirectPlay { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to enable direct stream. - /// </summary> - public bool? EnableDirectStream { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to enable transcoding. - /// </summary> - public bool? EnableTranscoding { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to enable video stream copy. - /// </summary> - public bool? AllowVideoStreamCopy { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to allow audio stream copy. - /// </summary> - public bool? AllowAudioStreamCopy { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to auto open the live stream. - /// </summary> - public bool? AutoOpenLiveStream { get; set; } - } + public bool? AutoOpenLiveStream { get; set; } } diff --git a/Jellyfin.Api/Models/NotificationDtos/AdminNotificationDto.cs b/Jellyfin.Api/Models/NotificationDtos/AdminNotificationDto.cs deleted file mode 100644 index 2c3a6282f..000000000 --- a/Jellyfin.Api/Models/NotificationDtos/AdminNotificationDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using MediaBrowser.Model.Notifications; - -namespace Jellyfin.Api.Models.NotificationDtos -{ - /// <summary> - /// The admin notification dto. - /// </summary> - public class AdminNotificationDto - { - /// <summary> - /// Gets or sets the notification name. - /// </summary> - public string? Name { get; set; } - - /// <summary> - /// Gets or sets the notification description. - /// </summary> - public string? Description { get; set; } - - /// <summary> - /// Gets or sets the notification level. - /// </summary> - public NotificationLevel? NotificationLevel { get; set; } - - /// <summary> - /// Gets or sets the notification url. - /// </summary> - public string? Url { get; set; } - } -} diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs deleted file mode 100644 index af5239ec2..000000000 --- a/Jellyfin.Api/Models/NotificationDtos/NotificationDto.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using MediaBrowser.Model.Notifications; - -namespace Jellyfin.Api.Models.NotificationDtos -{ - /// <summary> - /// The notification DTO. - /// </summary> - public class NotificationDto - { - /// <summary> - /// Gets or sets the notification ID. Defaults to an empty string. - /// </summary> - public string Id { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the notification's user ID. Defaults to an empty string. - /// </summary> - public string UserId { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the notification date. - /// </summary> - public DateTime Date { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether the notification has been read. Defaults to false. - /// </summary> - public bool IsRead { get; set; } = false; - - /// <summary> - /// Gets or sets the notification's name. Defaults to an empty string. - /// </summary> - public string Name { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the notification's description. Defaults to an empty string. - /// </summary> - public string Description { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the notification's URL. Defaults to an empty string. - /// </summary> - public string Url { get; set; } = string.Empty; - - /// <summary> - /// Gets or sets the notification level. - /// </summary> - public NotificationLevel Level { get; set; } - } -} diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs deleted file mode 100644 index 64e92bd83..000000000 --- a/Jellyfin.Api/Models/NotificationDtos/NotificationResultDto.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Jellyfin.Api.Models.NotificationDtos -{ - /// <summary> - /// A list of notifications with the total record count for pagination. - /// </summary> - public class NotificationResultDto - { - /// <summary> - /// Gets or sets the current page of notifications. - /// </summary> - public IReadOnlyList<NotificationDto> Notifications { get; set; } = Array.Empty<NotificationDto>(); - - /// <summary> - /// Gets or sets the total number of notifications. - /// </summary> - public int TotalRecordCount { get; set; } - } -} diff --git a/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs b/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs deleted file mode 100644 index 0568dea66..000000000 --- a/Jellyfin.Api/Models/NotificationDtos/NotificationsSummaryDto.cs +++ /dev/null @@ -1,20 +0,0 @@ -using MediaBrowser.Model.Notifications; - -namespace Jellyfin.Api.Models.NotificationDtos -{ - /// <summary> - /// The notification summary DTO. - /// </summary> - public class NotificationsSummaryDto - { - /// <summary> - /// Gets or sets the number of unread notifications. - /// </summary> - public int UnreadCount { get; set; } - - /// <summary> - /// Gets or sets the maximum unread notification level. - /// </summary> - public NotificationLevel? MaxUnreadNotificationLevel { get; set; } - } -} diff --git a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs index ab67c8732..480ddab09 100644 --- a/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs +++ b/Jellyfin.Api/Models/PlaybackDtos/TranscodingJobDto.cs @@ -6,279 +6,278 @@ using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Dto; using Microsoft.Extensions.Logging; -namespace Jellyfin.Api.Models.PlaybackDtos +namespace Jellyfin.Api.Models.PlaybackDtos; + +/// <summary> +/// Class TranscodingJob. +/// </summary> +public class TranscodingJobDto : IDisposable { /// <summary> - /// Class TranscodingJob. + /// The process lock. + /// </summary> + [SuppressMessage("Microsoft.Performance", "CA1051:NoVisibleInstanceFields", MessageId = "ProcessLock", Justification = "Imported from ServiceStack")] + [SuppressMessage("Microsoft.Performance", "SA1401:PrivateField", MessageId = "ProcessLock", Justification = "Imported from ServiceStack")] + public readonly object ProcessLock = new object(); + + /// <summary> + /// Timer lock. /// </summary> - public class TranscodingJobDto : IDisposable + private readonly object _timerLock = new object(); + + /// <summary> + /// Initializes a new instance of the <see cref="TranscodingJobDto"/> class. + /// </summary> + /// <param name="logger">Instance of the <see cref="ILogger{TranscodingJobDto}"/> interface.</param> + public TranscodingJobDto(ILogger<TranscodingJobDto> logger) { - /// <summary> - /// The process lock. - /// </summary> - [SuppressMessage("Microsoft.Performance", "CA1051:NoVisibleInstanceFields", MessageId = "ProcessLock", Justification = "Imported from ServiceStack")] - [SuppressMessage("Microsoft.Performance", "SA1401:PrivateField", MessageId = "ProcessLock", Justification = "Imported from ServiceStack")] - public readonly object ProcessLock = new object(); - - /// <summary> - /// Timer lock. - /// </summary> - private readonly object _timerLock = new object(); - - /// <summary> - /// Initializes a new instance of the <see cref="TranscodingJobDto"/> class. - /// </summary> - /// <param name="logger">Instance of the <see cref="ILogger{TranscodingJobDto}"/> interface.</param> - public TranscodingJobDto(ILogger<TranscodingJobDto> logger) - { - Logger = logger; - } + Logger = logger; + } + + /// <summary> + /// Gets or sets the play session identifier. + /// </summary> + /// <value>The play session identifier.</value> + public string? PlaySessionId { get; set; } + + /// <summary> + /// Gets or sets the live stream identifier. + /// </summary> + /// <value>The live stream identifier.</value> + public string? LiveStreamId { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether is live output. + /// </summary> + public bool IsLiveOutput { get; set; } + + /// <summary> + /// Gets or sets the path. + /// </summary> + /// <value>The path.</value> + public MediaSourceInfo? MediaSource { get; set; } + + /// <summary> + /// Gets or sets path. + /// </summary> + public string? Path { get; set; } + + /// <summary> + /// Gets or sets the type. + /// </summary> + /// <value>The type.</value> + public TranscodingJobType Type { get; set; } + + /// <summary> + /// Gets or sets the process. + /// </summary> + /// <value>The process.</value> + public Process? Process { get; set; } + + /// <summary> + /// Gets logger. + /// </summary> + public ILogger<TranscodingJobDto> Logger { get; private set; } + + /// <summary> + /// Gets or sets the active request count. + /// </summary> + /// <value>The active request count.</value> + public int ActiveRequestCount { get; set; } + + /// <summary> + /// Gets or sets the kill timer. + /// </summary> + /// <value>The kill timer.</value> + private Timer? KillTimer { get; set; } + + /// <summary> + /// Gets or sets device id. + /// </summary> + public string? DeviceId { get; set; } + + /// <summary> + /// Gets or sets cancellation token source. + /// </summary> + public CancellationTokenSource? CancellationTokenSource { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether has exited. + /// </summary> + public bool HasExited { get; set; } + + /// <summary> + /// Gets or sets exit code. + /// </summary> + public int ExitCode { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether is user paused. + /// </summary> + public bool IsUserPaused { get; set; } + + /// <summary> + /// Gets or sets id. + /// </summary> + public string? Id { get; set; } + + /// <summary> + /// Gets or sets framerate. + /// </summary> + public float? Framerate { get; set; } + + /// <summary> + /// Gets or sets completion percentage. + /// </summary> + public double? CompletionPercentage { get; set; } - /// <summary> - /// Gets or sets the play session identifier. - /// </summary> - /// <value>The play session identifier.</value> - public string? PlaySessionId { get; set; } - - /// <summary> - /// Gets or sets the live stream identifier. - /// </summary> - /// <value>The live stream identifier.</value> - public string? LiveStreamId { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether is live output. - /// </summary> - public bool IsLiveOutput { get; set; } - - /// <summary> - /// Gets or sets the path. - /// </summary> - /// <value>The path.</value> - public MediaSourceInfo? MediaSource { get; set; } - - /// <summary> - /// Gets or sets path. - /// </summary> - public string? Path { get; set; } - - /// <summary> - /// Gets or sets the type. - /// </summary> - /// <value>The type.</value> - public TranscodingJobType Type { get; set; } - - /// <summary> - /// Gets or sets the process. - /// </summary> - /// <value>The process.</value> - public Process? Process { get; set; } - - /// <summary> - /// Gets logger. - /// </summary> - public ILogger<TranscodingJobDto> Logger { get; private set; } - - /// <summary> - /// Gets or sets the active request count. - /// </summary> - /// <value>The active request count.</value> - public int ActiveRequestCount { get; set; } - - /// <summary> - /// Gets or sets the kill timer. - /// </summary> - /// <value>The kill timer.</value> - private Timer? KillTimer { get; set; } - - /// <summary> - /// Gets or sets device id. - /// </summary> - public string? DeviceId { get; set; } - - /// <summary> - /// Gets or sets cancellation token source. - /// </summary> - public CancellationTokenSource? CancellationTokenSource { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether has exited. - /// </summary> - public bool HasExited { get; set; } - - /// <summary> - /// Gets or sets exit code. - /// </summary> - public int ExitCode { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether is user paused. - /// </summary> - public bool IsUserPaused { get; set; } - - /// <summary> - /// Gets or sets id. - /// </summary> - public string? Id { get; set; } - - /// <summary> - /// Gets or sets framerate. - /// </summary> - public float? Framerate { get; set; } - - /// <summary> - /// Gets or sets completion percentage. - /// </summary> - public double? CompletionPercentage { get; set; } - - /// <summary> - /// Gets or sets bytes downloaded. - /// </summary> - public long BytesDownloaded { get; set; } - - /// <summary> - /// Gets or sets bytes transcoded. - /// </summary> - public long? BytesTranscoded { get; set; } - - /// <summary> - /// Gets or sets bit rate. - /// </summary> - public int? BitRate { get; set; } - - /// <summary> - /// Gets or sets transcoding position ticks. - /// </summary> - public long? TranscodingPositionTicks { get; set; } - - /// <summary> - /// Gets or sets download position ticks. - /// </summary> - public long? DownloadPositionTicks { get; set; } - - /// <summary> - /// Gets or sets transcoding throttler. - /// </summary> - public TranscodingThrottler? TranscodingThrottler { get; set; } - - /// <summary> - /// Gets or sets last ping date. - /// </summary> - public DateTime LastPingDate { get; set; } - - /// <summary> - /// Gets or sets ping timeout. - /// </summary> - public int PingTimeout { get; set; } - - /// <summary> - /// Stop kill timer. - /// </summary> - public void StopKillTimer() + /// <summary> + /// Gets or sets bytes downloaded. + /// </summary> + public long BytesDownloaded { get; set; } + + /// <summary> + /// Gets or sets bytes transcoded. + /// </summary> + public long? BytesTranscoded { get; set; } + + /// <summary> + /// Gets or sets bit rate. + /// </summary> + public int? BitRate { get; set; } + + /// <summary> + /// Gets or sets transcoding position ticks. + /// </summary> + public long? TranscodingPositionTicks { get; set; } + + /// <summary> + /// Gets or sets download position ticks. + /// </summary> + public long? DownloadPositionTicks { get; set; } + + /// <summary> + /// Gets or sets transcoding throttler. + /// </summary> + public TranscodingThrottler? TranscodingThrottler { get; set; } + + /// <summary> + /// Gets or sets last ping date. + /// </summary> + public DateTime LastPingDate { get; set; } + + /// <summary> + /// Gets or sets ping timeout. + /// </summary> + public int PingTimeout { get; set; } + + /// <summary> + /// Stop kill timer. + /// </summary> + public void StopKillTimer() + { + lock (_timerLock) { - lock (_timerLock) - { - KillTimer?.Change(Timeout.Infinite, Timeout.Infinite); - } + KillTimer?.Change(Timeout.Infinite, Timeout.Infinite); } + } - /// <summary> - /// Dispose kill timer. - /// </summary> - public void DisposeKillTimer() + /// <summary> + /// Dispose kill timer. + /// </summary> + public void DisposeKillTimer() + { + lock (_timerLock) { - lock (_timerLock) + if (KillTimer is not null) { - if (KillTimer != null) - { - KillTimer.Dispose(); - KillTimer = null; - } + KillTimer.Dispose(); + KillTimer = null; } } + } + + /// <summary> + /// Start kill timer. + /// </summary> + /// <param name="callback">Callback action.</param> + public void StartKillTimer(Action<object?> callback) + { + StartKillTimer(callback, PingTimeout); + } - /// <summary> - /// Start kill timer. - /// </summary> - /// <param name="callback">Callback action.</param> - public void StartKillTimer(Action<object?> callback) + /// <summary> + /// Start kill timer. + /// </summary> + /// <param name="callback">Callback action.</param> + /// <param name="intervalMs">Callback interval.</param> + public void StartKillTimer(Action<object?> callback, int intervalMs) + { + if (HasExited) { - StartKillTimer(callback, PingTimeout); + return; } - /// <summary> - /// Start kill timer. - /// </summary> - /// <param name="callback">Callback action.</param> - /// <param name="intervalMs">Callback interval.</param> - public void StartKillTimer(Action<object?> callback, int intervalMs) + lock (_timerLock) { - if (HasExited) + if (KillTimer is null) { - return; + Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); + KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite); } - - lock (_timerLock) + else { - if (KillTimer == null) - { - Logger.LogDebug("Starting kill timer at {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); - KillTimer = new Timer(new TimerCallback(callback), this, intervalMs, Timeout.Infinite); - } - else - { - Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); - KillTimer.Change(intervalMs, Timeout.Infinite); - } + Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); + KillTimer.Change(intervalMs, Timeout.Infinite); } } + } - /// <summary> - /// Change kill timer if started. - /// </summary> - public void ChangeKillTimerIfStarted() + /// <summary> + /// Change kill timer if started. + /// </summary> + public void ChangeKillTimerIfStarted() + { + if (HasExited) { - if (HasExited) - { - return; - } + return; + } - lock (_timerLock) + lock (_timerLock) + { + if (KillTimer is not null) { - if (KillTimer != null) - { - var intervalMs = PingTimeout; + var intervalMs = PingTimeout; - Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); - KillTimer.Change(intervalMs, Timeout.Infinite); - } + Logger.LogDebug("Changing kill timer to {0}ms. JobId {1} PlaySessionId {2}", intervalMs, Id, PlaySessionId); + KillTimer.Change(intervalMs, Timeout.Infinite); } } + } - /// <inheritdoc /> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } + /// <inheritdoc /> + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } - /// <summary> - /// Dispose all resources. - /// </summary> - /// <param name="disposing">Whether to dispose all resources.</param> - protected virtual void Dispose(bool disposing) + /// <summary> + /// Dispose all resources. + /// </summary> + /// <param name="disposing">Whether to dispose all resources.</param> + protected virtual void Dispose(bool disposing) + { + if (disposing) { - if (disposing) - { - Process?.Dispose(); - Process = null; - KillTimer?.Dispose(); - KillTimer = null; - CancellationTokenSource?.Dispose(); - CancellationTokenSource = null; - TranscodingThrottler?.Dispose(); - TranscodingThrottler = null; - } + Process?.Dispose(); + Process = null; + KillTimer?.Dispose(); + KillTimer = null; + CancellationTokenSource?.Dispose(); + CancellationTokenSource = null; + TranscodingThrottler?.Dispose(); + TranscodingThrottler = null; } } } diff --git a/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs b/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs index 99376873c..b577c4ea6 100644 --- a/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs +++ b/Jellyfin.Api/Models/PlaybackDtos/TranscodingThrottler.cs @@ -7,214 +7,213 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.IO; using Microsoft.Extensions.Logging; -namespace Jellyfin.Api.Models.PlaybackDtos +namespace Jellyfin.Api.Models.PlaybackDtos; + +/// <summary> +/// Transcoding throttler. +/// </summary> +public class TranscodingThrottler : IDisposable { + private readonly TranscodingJobDto _job; + private readonly ILogger<TranscodingThrottler> _logger; + private readonly IConfigurationManager _config; + private readonly IFileSystem _fileSystem; + private readonly IMediaEncoder _mediaEncoder; + private Timer? _timer; + private bool _isPaused; + /// <summary> - /// Transcoding throttler. + /// Initializes a new instance of the <see cref="TranscodingThrottler"/> class. /// </summary> - public class TranscodingThrottler : IDisposable + /// <param name="job">Transcoding job dto.</param> + /// <param name="logger">Instance of the <see cref="ILogger{TranscodingThrottler}"/> interface.</param> + /// <param name="config">Instance of the <see cref="IConfigurationManager"/> interface.</param> + /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param> + /// <param name="mediaEncoder">Instance of the <see cref="IMediaEncoder"/> interface.</param> + public TranscodingThrottler(TranscodingJobDto job, ILogger<TranscodingThrottler> logger, IConfigurationManager config, IFileSystem fileSystem, IMediaEncoder mediaEncoder) { - private readonly TranscodingJobDto _job; - private readonly ILogger<TranscodingThrottler> _logger; - private readonly IConfigurationManager _config; - private readonly IFileSystem _fileSystem; - private readonly IMediaEncoder _mediaEncoder; - private Timer? _timer; - private bool _isPaused; - - /// <summary> - /// Initializes a new instance of the <see cref="TranscodingThrottler"/> class. - /// </summary> - /// <param name="job">Transcoding job dto.</param> - /// <param name="logger">Instance of the <see cref="ILogger{TranscodingThrottler}"/> interface.</param> - /// <param name="config">Instance of the <see cref="IConfigurationManager"/> interface.</param> - /// <param name="fileSystem">Instance of the <see cref="IFileSystem"/> interface.</param> - /// <param name="mediaEncoder">Instance of the <see cref="IMediaEncoder"/> interface.</param> - public TranscodingThrottler(TranscodingJobDto job, ILogger<TranscodingThrottler> logger, IConfigurationManager config, IFileSystem fileSystem, IMediaEncoder mediaEncoder) - { - _job = job; - _logger = logger; - _config = config; - _fileSystem = fileSystem; - _mediaEncoder = mediaEncoder; - } + _job = job; + _logger = logger; + _config = config; + _fileSystem = fileSystem; + _mediaEncoder = mediaEncoder; + } - /// <summary> - /// Start timer. - /// </summary> - public void Start() - { - _timer = new Timer(TimerCallback, null, 5000, 5000); - } + /// <summary> + /// Start timer. + /// </summary> + public void Start() + { + _timer = new Timer(TimerCallback, null, 5000, 5000); + } - /// <summary> - /// Unpause transcoding. - /// </summary> - /// <returns>A <see cref="Task"/>.</returns> - public async Task UnpauseTranscoding() + /// <summary> + /// Unpause transcoding. + /// </summary> + /// <returns>A <see cref="Task"/>.</returns> + public async Task UnpauseTranscoding() + { + if (_isPaused) { - if (_isPaused) - { - _logger.LogDebug("Sending resume command to ffmpeg"); + _logger.LogDebug("Sending resume command to ffmpeg"); - try - { - var resumeKey = _mediaEncoder.IsPkeyPauseSupported ? "u" : Environment.NewLine; - await _job.Process!.StandardInput.WriteAsync(resumeKey).ConfigureAwait(false); - _isPaused = false; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error resuming transcoding"); - } + try + { + var resumeKey = _mediaEncoder.IsPkeyPauseSupported ? "u" : Environment.NewLine; + await _job.Process!.StandardInput.WriteAsync(resumeKey).ConfigureAwait(false); + _isPaused = false; + } + catch (Exception ex) + { + _logger.LogError(ex, "Error resuming transcoding"); } } + } - /// <summary> - /// Stop throttler. - /// </summary> - /// <returns>A <see cref="Task"/>.</returns> - public async Task Stop() + /// <summary> + /// Stop throttler. + /// </summary> + /// <returns>A <see cref="Task"/>.</returns> + public async Task Stop() + { + DisposeTimer(); + await UnpauseTranscoding().ConfigureAwait(false); + } + + /// <summary> + /// Dispose throttler. + /// </summary> + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// <summary> + /// Dispose throttler. + /// </summary> + /// <param name="disposing">Disposing.</param> + protected virtual void Dispose(bool disposing) + { + if (disposing) { DisposeTimer(); - await UnpauseTranscoding().ConfigureAwait(false); } + } - /// <summary> - /// Dispose throttler. - /// </summary> - public void Dispose() + private EncodingOptions GetOptions() + { + return _config.GetEncodingOptions(); + } + + private async void TimerCallback(object? state) + { + if (_job.HasExited) { - Dispose(true); - GC.SuppressFinalize(this); + DisposeTimer(); + return; } - /// <summary> - /// Dispose throttler. - /// </summary> - /// <param name="disposing">Disposing.</param> - protected virtual void Dispose(bool disposing) + var options = GetOptions(); + + if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleDelaySeconds)) { - if (disposing) - { - DisposeTimer(); - } + await PauseTranscoding().ConfigureAwait(false); } - - private EncodingOptions GetOptions() + else { - return _config.GetEncodingOptions(); + await UnpauseTranscoding().ConfigureAwait(false); } + } - private async void TimerCallback(object? state) + private async Task PauseTranscoding() + { + if (!_isPaused) { - if (_job.HasExited) - { - DisposeTimer(); - return; - } + var pauseKey = _mediaEncoder.IsPkeyPauseSupported ? "p" : "c"; - var options = GetOptions(); + _logger.LogDebug("Sending pause command [{Key}] to ffmpeg", pauseKey); - if (options.EnableThrottling && IsThrottleAllowed(_job, options.ThrottleDelaySeconds)) + try { - await PauseTranscoding().ConfigureAwait(false); + await _job.Process!.StandardInput.WriteAsync(pauseKey).ConfigureAwait(false); + _isPaused = true; } - else + catch (Exception ex) { - await UnpauseTranscoding().ConfigureAwait(false); + _logger.LogError(ex, "Error pausing transcoding"); } } + } - private async Task PauseTranscoding() + private bool IsThrottleAllowed(TranscodingJobDto job, int thresholdSeconds) + { + var bytesDownloaded = job.BytesDownloaded; + var transcodingPositionTicks = job.TranscodingPositionTicks ?? 0; + var downloadPositionTicks = job.DownloadPositionTicks ?? 0; + + var path = job.Path ?? throw new ArgumentException("Path can't be null."); + + var gapLengthInTicks = TimeSpan.FromSeconds(thresholdSeconds).Ticks; + + if (downloadPositionTicks > 0 && transcodingPositionTicks > 0) { - if (!_isPaused) - { - var pauseKey = _mediaEncoder.IsPkeyPauseSupported ? "p" : "c"; + // HLS - time-based consideration - _logger.LogDebug("Sending pause command [{Key}] to ffmpeg", pauseKey); + var targetGap = gapLengthInTicks; + var gap = transcodingPositionTicks - downloadPositionTicks; - try - { - await _job.Process!.StandardInput.WriteAsync(pauseKey).ConfigureAwait(false); - _isPaused = true; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error pausing transcoding"); - } + if (gap < targetGap) + { + _logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap); + return false; } + + _logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap); + return true; } - private bool IsThrottleAllowed(TranscodingJobDto job, int thresholdSeconds) + if (bytesDownloaded > 0 && transcodingPositionTicks > 0) { - var bytesDownloaded = job.BytesDownloaded; - var transcodingPositionTicks = job.TranscodingPositionTicks ?? 0; - var downloadPositionTicks = job.DownloadPositionTicks ?? 0; - - var path = job.Path ?? throw new ArgumentException("Path can't be null."); - - var gapLengthInTicks = TimeSpan.FromSeconds(thresholdSeconds).Ticks; + // Progressive Streaming - byte-based consideration - if (downloadPositionTicks > 0 && transcodingPositionTicks > 0) + try { - // HLS - time-based consideration + var bytesTranscoded = job.BytesTranscoded ?? _fileSystem.GetFileInfo(path).Length; - var targetGap = gapLengthInTicks; - var gap = transcodingPositionTicks - downloadPositionTicks; + // Estimate the bytes the transcoder should be ahead + double gapFactor = gapLengthInTicks; + gapFactor /= transcodingPositionTicks; + var targetGap = bytesTranscoded * gapFactor; + + var gap = bytesTranscoded - bytesDownloaded; if (gap < targetGap) { - _logger.LogDebug("Not throttling transcoder gap {0} target gap {1}", gap, targetGap); + _logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); return false; } - _logger.LogDebug("Throttling transcoder gap {0} target gap {1}", gap, targetGap); + _logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); return true; } - - if (bytesDownloaded > 0 && transcodingPositionTicks > 0) + catch (Exception ex) { - // Progressive Streaming - byte-based consideration - - try - { - var bytesTranscoded = job.BytesTranscoded ?? _fileSystem.GetFileInfo(path).Length; - - // Estimate the bytes the transcoder should be ahead - double gapFactor = gapLengthInTicks; - gapFactor /= transcodingPositionTicks; - var targetGap = bytesTranscoded * gapFactor; - - var gap = bytesTranscoded - bytesDownloaded; - - if (gap < targetGap) - { - _logger.LogDebug("Not throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); - return false; - } - - _logger.LogDebug("Throttling transcoder gap {0} target gap {1} bytes downloaded {2}", gap, targetGap, bytesDownloaded); - return true; - } - catch (Exception ex) - { - _logger.LogError(ex, "Error getting output size"); - return false; - } + _logger.LogError(ex, "Error getting output size"); + return false; } - - _logger.LogDebug("No throttle data for {Path}", path); - return false; } - private void DisposeTimer() + _logger.LogDebug("No throttle data for {Path}", path); + return false; + } + + private void DisposeTimer() + { + if (_timer is not null) { - if (_timer != null) - { - _timer.Dispose(); - _timer = null; - } + _timer.Dispose(); + _timer = null; } } } diff --git a/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs b/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs index 0761b2085..1fba32c5b 100644 --- a/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs +++ b/Jellyfin.Api/Models/PlaylistDtos/CreatePlaylistDto.cs @@ -3,32 +3,31 @@ using System.Collections.Generic; using System.Text.Json.Serialization; using Jellyfin.Extensions.Json.Converters; -namespace Jellyfin.Api.Models.PlaylistDtos +namespace Jellyfin.Api.Models.PlaylistDtos; + +/// <summary> +/// Create new playlist dto. +/// </summary> +public class CreatePlaylistDto { /// <summary> - /// Create new playlist dto. + /// Gets or sets the name of the new playlist. /// </summary> - public class CreatePlaylistDto - { - /// <summary> - /// Gets or sets the name of the new playlist. - /// </summary> - public string? Name { get; set; } + public string? Name { get; set; } - /// <summary> - /// Gets or sets item ids to add to the playlist. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<Guid> Ids { get; set; } = Array.Empty<Guid>(); + /// <summary> + /// Gets or sets item ids to add to the playlist. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<Guid> Ids { get; set; } = Array.Empty<Guid>(); - /// <summary> - /// Gets or sets the user id. - /// </summary> - public Guid? UserId { get; set; } + /// <summary> + /// Gets or sets the user id. + /// </summary> + public Guid? UserId { get; set; } - /// <summary> - /// Gets or sets the media type. - /// </summary> - public string? MediaType { get; set; } - } + /// <summary> + /// Gets or sets the media type. + /// </summary> + public string? MediaType { get; set; } } diff --git a/Jellyfin.Api/Models/SessionDtos/ClientCapabilitiesDto.cs b/Jellyfin.Api/Models/SessionDtos/ClientCapabilitiesDto.cs index fa62472e1..b88be33b2 100644 --- a/Jellyfin.Api/Models/SessionDtos/ClientCapabilitiesDto.cs +++ b/Jellyfin.Api/Models/SessionDtos/ClientCapabilitiesDto.cs @@ -5,84 +5,83 @@ using Jellyfin.Extensions.Json.Converters; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Session; -namespace Jellyfin.Api.Models.SessionDtos +namespace Jellyfin.Api.Models.SessionDtos; + +/// <summary> +/// Client capabilities dto. +/// </summary> +public class ClientCapabilitiesDto { /// <summary> - /// Client capabilities dto. + /// Gets or sets the list of playable media types. /// </summary> - public class ClientCapabilitiesDto - { - /// <summary> - /// Gets or sets the list of playable media types. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<string> PlayableMediaTypes { get; set; } = Array.Empty<string>(); + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<string> PlayableMediaTypes { get; set; } = Array.Empty<string>(); - /// <summary> - /// Gets or sets the list of supported commands. - /// </summary> - [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] - public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = Array.Empty<GeneralCommandType>(); + /// <summary> + /// Gets or sets the list of supported commands. + /// </summary> + [JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))] + public IReadOnlyList<GeneralCommandType> SupportedCommands { get; set; } = Array.Empty<GeneralCommandType>(); - /// <summary> - /// Gets or sets a value indicating whether session supports media control. - /// </summary> - public bool SupportsMediaControl { get; set; } + /// <summary> + /// Gets or sets a value indicating whether session supports media control. + /// </summary> + public bool SupportsMediaControl { get; set; } - /// <summary> - /// Gets or sets a value indicating whether session supports content uploading. - /// </summary> - public bool SupportsContentUploading { get; set; } + /// <summary> + /// Gets or sets a value indicating whether session supports content uploading. + /// </summary> + public bool SupportsContentUploading { get; set; } - /// <summary> - /// Gets or sets the message callback url. - /// </summary> - public string? MessageCallbackUrl { get; set; } + /// <summary> + /// Gets or sets the message callback url. + /// </summary> + public string? MessageCallbackUrl { get; set; } - /// <summary> - /// Gets or sets a value indicating whether session supports a persistent identifier. - /// </summary> - public bool SupportsPersistentIdentifier { get; set; } + /// <summary> + /// Gets or sets a value indicating whether session supports a persistent identifier. + /// </summary> + public bool SupportsPersistentIdentifier { get; set; } - /// <summary> - /// Gets or sets a value indicating whether session supports sync. - /// </summary> - public bool SupportsSync { get; set; } + /// <summary> + /// Gets or sets a value indicating whether session supports sync. + /// </summary> + public bool SupportsSync { get; set; } - /// <summary> - /// Gets or sets the device profile. - /// </summary> - public DeviceProfile? DeviceProfile { get; set; } + /// <summary> + /// Gets or sets the device profile. + /// </summary> + public DeviceProfile? DeviceProfile { get; set; } - /// <summary> - /// Gets or sets the app store url. - /// </summary> - public string? AppStoreUrl { get; set; } + /// <summary> + /// Gets or sets the app store url. + /// </summary> + public string? AppStoreUrl { get; set; } - /// <summary> - /// Gets or sets the icon url. - /// </summary> - public string? IconUrl { get; set; } + /// <summary> + /// Gets or sets the icon url. + /// </summary> + public string? IconUrl { get; set; } - /// <summary> - /// Convert the dto to the full <see cref="ClientCapabilities"/> model. - /// </summary> - /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns> - public ClientCapabilities ToClientCapabilities() + /// <summary> + /// Convert the dto to the full <see cref="ClientCapabilities"/> model. + /// </summary> + /// <returns>The converted <see cref="ClientCapabilities"/> model.</returns> + public ClientCapabilities ToClientCapabilities() + { + return new ClientCapabilities { - return new ClientCapabilities - { - PlayableMediaTypes = PlayableMediaTypes, - SupportedCommands = SupportedCommands, - SupportsMediaControl = SupportsMediaControl, - SupportsContentUploading = SupportsContentUploading, - MessageCallbackUrl = MessageCallbackUrl, - SupportsPersistentIdentifier = SupportsPersistentIdentifier, - SupportsSync = SupportsSync, - DeviceProfile = DeviceProfile, - AppStoreUrl = AppStoreUrl, - IconUrl = IconUrl - }; - } + PlayableMediaTypes = PlayableMediaTypes, + SupportedCommands = SupportedCommands, + SupportsMediaControl = SupportsMediaControl, + SupportsContentUploading = SupportsContentUploading, + MessageCallbackUrl = MessageCallbackUrl, + SupportsPersistentIdentifier = SupportsPersistentIdentifier, + SupportsSync = SupportsSync, + DeviceProfile = DeviceProfile, + AppStoreUrl = AppStoreUrl, + IconUrl = IconUrl + }; } } diff --git a/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs index a5f012245..402707819 100644 --- a/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs +++ b/Jellyfin.Api/Models/StartupDtos/StartupConfigurationDto.cs @@ -1,23 +1,22 @@ -namespace Jellyfin.Api.Models.StartupDtos +namespace Jellyfin.Api.Models.StartupDtos; + +/// <summary> +/// The startup configuration DTO. +/// </summary> +public class StartupConfigurationDto { /// <summary> - /// The startup configuration DTO. + /// Gets or sets UI language culture. /// </summary> - public class StartupConfigurationDto - { - /// <summary> - /// Gets or sets UI language culture. - /// </summary> - public string? UICulture { get; set; } + public string? UICulture { get; set; } - /// <summary> - /// Gets or sets the metadata country code. - /// </summary> - public string? MetadataCountryCode { get; set; } + /// <summary> + /// Gets or sets the metadata country code. + /// </summary> + public string? MetadataCountryCode { get; set; } - /// <summary> - /// Gets or sets the preferred language for the metadata. - /// </summary> - public string? PreferredMetadataLanguage { get; set; } - } + /// <summary> + /// Gets or sets the preferred language for the metadata. + /// </summary> + public string? PreferredMetadataLanguage { get; set; } } diff --git a/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs index 4027ba41a..0e7be24c4 100644 --- a/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs +++ b/Jellyfin.Api/Models/StartupDtos/StartupRemoteAccessDto.cs @@ -1,22 +1,21 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.StartupDtos +namespace Jellyfin.Api.Models.StartupDtos; + +/// <summary> +/// Startup remote access dto. +/// </summary> +public class StartupRemoteAccessDto { /// <summary> - /// Startup remote access dto. + /// Gets or sets a value indicating whether enable remote access. /// </summary> - public class StartupRemoteAccessDto - { - /// <summary> - /// Gets or sets a value indicating whether enable remote access. - /// </summary> - [Required] - public bool EnableRemoteAccess { get; set; } + [Required] + public bool EnableRemoteAccess { get; set; } - /// <summary> - /// Gets or sets a value indicating whether enable automatic port mapping. - /// </summary> - [Required] - public bool EnableAutomaticPortMapping { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether enable automatic port mapping. + /// </summary> + [Required] + public bool EnableAutomaticPortMapping { get; set; } } diff --git a/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs b/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs index e4c973548..f473bbcef 100644 --- a/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs +++ b/Jellyfin.Api/Models/StartupDtos/StartupUserDto.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Models.StartupDtos +namespace Jellyfin.Api.Models.StartupDtos; + +/// <summary> +/// The startup user DTO. +/// </summary> +public class StartupUserDto { /// <summary> - /// The startup user DTO. + /// Gets or sets the username. /// </summary> - public class StartupUserDto - { - /// <summary> - /// Gets or sets the username. - /// </summary> - public string? Name { get; set; } + public string? Name { get; set; } - /// <summary> - /// Gets or sets the user's password. - /// </summary> - public string? Password { get; set; } - } + /// <summary> + /// Gets or sets the user's password. + /// </summary> + public string? Password { get; set; } } diff --git a/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs index 3791fadbe..4f1abb1ff 100644 --- a/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs +++ b/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs @@ -1,13 +1,12 @@ -namespace Jellyfin.Api.Models.StreamingDtos +namespace Jellyfin.Api.Models.StreamingDtos; + +/// <summary> +/// The hls video request dto. +/// </summary> +public class HlsAudioRequestDto : StreamingRequestDto { /// <summary> - /// The hls video request dto. + /// Gets or sets a value indicating whether enable adaptive bitrate streaming. /// </summary> - public class HlsAudioRequestDto : StreamingRequestDto - { - /// <summary> - /// Gets or sets a value indicating whether enable adaptive bitrate streaming. - /// </summary> - public bool EnableAdaptiveBitrateStreaming { get; set; } - } + public bool EnableAdaptiveBitrateStreaming { get; set; } } diff --git a/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs index 7a4be091b..1cd3d0132 100644 --- a/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs +++ b/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs @@ -1,13 +1,12 @@ -namespace Jellyfin.Api.Models.StreamingDtos +namespace Jellyfin.Api.Models.StreamingDtos; + +/// <summary> +/// The hls video request dto. +/// </summary> +public class HlsVideoRequestDto : VideoRequestDto { /// <summary> - /// The hls video request dto. + /// Gets or sets a value indicating whether enable adaptive bitrate streaming. /// </summary> - public class HlsVideoRequestDto : VideoRequestDto - { - /// <summary> - /// Gets or sets a value indicating whether enable adaptive bitrate streaming. - /// </summary> - public bool EnableAdaptiveBitrateStreaming { get; set; } - } + public bool EnableAdaptiveBitrateStreaming { get; set; } } diff --git a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs index 8182e3c9e..b75272d3f 100644 --- a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs +++ b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs @@ -5,192 +5,191 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Dlna; -namespace Jellyfin.Api.Models.StreamingDtos +namespace Jellyfin.Api.Models.StreamingDtos; + +/// <summary> +/// The stream state dto. +/// </summary> +public class StreamState : EncodingJobInfo, IDisposable { + private readonly IMediaSourceManager _mediaSourceManager; + private readonly TranscodingJobHelper _transcodingJobHelper; + private bool _disposed; + + /// <summary> + /// Initializes a new instance of the <see cref="StreamState" /> class. + /// </summary> + /// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager" /> interface.</param> + /// <param name="transcodingType">The <see cref="TranscodingJobType" />.</param> + /// <param name="transcodingJobHelper">The <see cref="TranscodingJobHelper" /> singleton.</param> + public StreamState(IMediaSourceManager mediaSourceManager, TranscodingJobType transcodingType, TranscodingJobHelper transcodingJobHelper) + : base(transcodingType) + { + _mediaSourceManager = mediaSourceManager; + _transcodingJobHelper = transcodingJobHelper; + } + + /// <summary> + /// Gets or sets the requested url. + /// </summary> + public string? RequestedUrl { get; set; } + /// <summary> - /// The stream state dto. + /// Gets or sets the request. /// </summary> - public class StreamState : EncodingJobInfo, IDisposable + public StreamingRequestDto Request { - private readonly IMediaSourceManager _mediaSourceManager; - private readonly TranscodingJobHelper _transcodingJobHelper; - private bool _disposed; - - /// <summary> - /// Initializes a new instance of the <see cref="StreamState" /> class. - /// </summary> - /// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager" /> interface.</param> - /// <param name="transcodingType">The <see cref="TranscodingJobType" />.</param> - /// <param name="transcodingJobHelper">The <see cref="TranscodingJobHelper" /> singleton.</param> - public StreamState(IMediaSourceManager mediaSourceManager, TranscodingJobType transcodingType, TranscodingJobHelper transcodingJobHelper) - : base(transcodingType) + get => (StreamingRequestDto)BaseRequest; + set { - _mediaSourceManager = mediaSourceManager; - _transcodingJobHelper = transcodingJobHelper; + BaseRequest = value; + IsVideoRequest = VideoRequest is not null; } + } + + /// <summary> + /// Gets the video request. + /// </summary> + public VideoRequestDto? VideoRequest => Request as VideoRequestDto; + + /// <summary> + /// Gets or sets the direct stream provicer. + /// </summary> + /// <remarks> + /// Deprecated. + /// </remarks> + public IDirectStreamProvider? DirectStreamProvider { get; set; } + + /// <summary> + /// Gets or sets the path to wait for. + /// </summary> + public string? WaitForPath { get; set; } - /// <summary> - /// Gets or sets the requested url. - /// </summary> - public string? RequestedUrl { get; set; } + /// <summary> + /// Gets a value indicating whether the request outputs video. + /// </summary> + public bool IsOutputVideo => Request is VideoRequestDto; - /// <summary> - /// Gets or sets the request. - /// </summary> - public StreamingRequestDto Request + /// <summary> + /// Gets the segment length. + /// </summary> + public int SegmentLength + { + get { - get => (StreamingRequestDto)BaseRequest; - set + if (Request.SegmentLength.HasValue) { - BaseRequest = value; - IsVideoRequest = VideoRequest != null; + return Request.SegmentLength.Value; } - } - /// <summary> - /// Gets the video request. - /// </summary> - public VideoRequestDto? VideoRequest => Request as VideoRequestDto; - - /// <summary> - /// Gets or sets the direct stream provicer. - /// </summary> - /// <remarks> - /// Deprecated. - /// </remarks> - public IDirectStreamProvider? DirectStreamProvider { get; set; } - - /// <summary> - /// Gets or sets the path to wait for. - /// </summary> - public string? WaitForPath { get; set; } - - /// <summary> - /// Gets a value indicating whether the request outputs video. - /// </summary> - public bool IsOutputVideo => Request is VideoRequestDto; - - /// <summary> - /// Gets the segment length. - /// </summary> - public int SegmentLength - { - get + if (EncodingHelper.IsCopyCodec(OutputVideoCodec)) { - if (Request.SegmentLength.HasValue) + var userAgent = UserAgent ?? string.Empty; + + if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1 + || userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1 + || userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 + || userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 + || userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1) { - return Request.SegmentLength.Value; + return 6; } - if (EncodingHelper.IsCopyCodec(OutputVideoCodec)) + if (IsSegmentedLiveStream) { - var userAgent = UserAgent ?? string.Empty; - - if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1 - || userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1 - || userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1 - || userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 - || userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1) - { - return 6; - } - - if (IsSegmentedLiveStream) - { - return 3; - } - - return 6; + return 3; } - return 3; + return 6; } + + return 3; } + } - /// <summary> - /// Gets the minimum number of segments. - /// </summary> - public int MinSegments + /// <summary> + /// Gets the minimum number of segments. + /// </summary> + public int MinSegments + { + get { - get + if (Request.MinSegments.HasValue) { - if (Request.MinSegments.HasValue) - { - return Request.MinSegments.Value; - } - - return SegmentLength >= 10 ? 2 : 3; + return Request.MinSegments.Value; } - } - /// <summary> - /// Gets or sets the user agent. - /// </summary> - public string? UserAgent { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to estimate the content length. - /// </summary> - public bool EstimateContentLength { get; set; } - - /// <summary> - /// Gets or sets the transcode seek info. - /// </summary> - public TranscodeSeekInfo TranscodeSeekInfo { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether to enable dlna headers. - /// </summary> - public bool EnableDlnaHeaders { get; set; } - - /// <summary> - /// Gets or sets the device profile. - /// </summary> - public DeviceProfile? DeviceProfile { get; set; } - - /// <summary> - /// Gets or sets the transcoding job. - /// </summary> - public TranscodingJobDto? TranscodingJob { get; set; } - - /// <inheritdoc /> - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); + return SegmentLength >= 10 ? 2 : 3; } + } + + /// <summary> + /// Gets or sets the user agent. + /// </summary> + public string? UserAgent { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to estimate the content length. + /// </summary> + public bool EstimateContentLength { get; set; } + + /// <summary> + /// Gets or sets the transcode seek info. + /// </summary> + public TranscodeSeekInfo TranscodeSeekInfo { get; set; } + + /// <summary> + /// Gets or sets a value indicating whether to enable dlna headers. + /// </summary> + public bool EnableDlnaHeaders { get; set; } + + /// <summary> + /// Gets or sets the device profile. + /// </summary> + public DeviceProfile? DeviceProfile { get; set; } - /// <inheritdoc /> - public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) + /// <summary> + /// Gets or sets the transcoding job. + /// </summary> + public TranscodingJobDto? TranscodingJob { get; set; } + + /// <inheritdoc /> + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// <inheritdoc /> + public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate) + { + _transcodingJobHelper.ReportTranscodingProgress(TranscodingJob!, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate); + } + + /// <summary> + /// Disposes the stream state. + /// </summary> + /// <param name="disposing">Whether the object is currently being disposed.</param> + protected virtual void Dispose(bool disposing) + { + if (_disposed) { - _transcodingJobHelper.ReportTranscodingProgress(TranscodingJob!, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate); + return; } - /// <summary> - /// Disposes the stream state. - /// </summary> - /// <param name="disposing">Whether the object is currently being disposed.</param> - protected virtual void Dispose(bool disposing) + if (disposing) { - if (_disposed) + // REVIEW: Is this the right place for this? + if (MediaSource.RequiresClosing + && string.IsNullOrWhiteSpace(Request.LiveStreamId) + && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId)) { - return; - } - - if (disposing) - { - // REVIEW: Is this the right place for this? - if (MediaSource.RequiresClosing - && string.IsNullOrWhiteSpace(Request.LiveStreamId) - && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId)) - { - _mediaSourceManager.CloseLiveStream(MediaSource.LiveStreamId).GetAwaiter().GetResult(); - } + _mediaSourceManager.CloseLiveStream(MediaSource.LiveStreamId).GetAwaiter().GetResult(); } + } - TranscodingJob = null; + TranscodingJob = null; - _disposed = true; - } + _disposed = true; } } diff --git a/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs index f8b0212b6..389d6006d 100644 --- a/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs +++ b/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs @@ -1,55 +1,54 @@ using MediaBrowser.Controller.MediaEncoding; -namespace Jellyfin.Api.Models.StreamingDtos +namespace Jellyfin.Api.Models.StreamingDtos; + +/// <summary> +/// The audio streaming request dto. +/// </summary> +public class StreamingRequestDto : BaseEncodingJobOptions { /// <summary> - /// The audio streaming request dto. - /// </summary> - public class StreamingRequestDto : BaseEncodingJobOptions - { - /// <summary> - /// Gets or sets the device profile. - /// </summary> - public string? DeviceProfileId { get; set; } - - /// <summary> - /// Gets or sets the params. - /// </summary> - public string? Params { get; set; } - - /// <summary> - /// Gets or sets the play session id. - /// </summary> - public string? PlaySessionId { get; set; } - - /// <summary> - /// Gets or sets the tag. - /// </summary> - public string? Tag { get; set; } - - /// <summary> - /// Gets or sets the segment container. - /// </summary> - public string? SegmentContainer { get; set; } - - /// <summary> - /// Gets or sets the segment length. - /// </summary> - public int? SegmentLength { get; set; } - - /// <summary> - /// Gets or sets the min segments. - /// </summary> - public int? MinSegments { get; set; } - - /// <summary> - /// Gets or sets the position of the requested segment in ticks. - /// </summary> - public long CurrentRuntimeTicks { get; set; } - - /// <summary> - /// Gets or sets the actual segment length in ticks. - /// </summary> - public long ActualSegmentLengthTicks { get; set; } - } + /// Gets or sets the device profile. + /// </summary> + public string? DeviceProfileId { get; set; } + + /// <summary> + /// Gets or sets the params. + /// </summary> + public string? Params { get; set; } + + /// <summary> + /// Gets or sets the play session id. + /// </summary> + public string? PlaySessionId { get; set; } + + /// <summary> + /// Gets or sets the tag. + /// </summary> + public string? Tag { get; set; } + + /// <summary> + /// Gets or sets the segment container. + /// </summary> + public string? SegmentContainer { get; set; } + + /// <summary> + /// Gets or sets the segment length. + /// </summary> + public int? SegmentLength { get; set; } + + /// <summary> + /// Gets or sets the min segments. + /// </summary> + public int? MinSegments { get; set; } + + /// <summary> + /// Gets or sets the position of the requested segment in ticks. + /// </summary> + public long CurrentRuntimeTicks { get; set; } + + /// <summary> + /// Gets or sets the actual segment length in ticks. + /// </summary> + public long ActualSegmentLengthTicks { get; set; } } diff --git a/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs index cce2a89d4..60c529d4a 100644 --- a/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs +++ b/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs @@ -1,19 +1,18 @@ -namespace Jellyfin.Api.Models.StreamingDtos +namespace Jellyfin.Api.Models.StreamingDtos; + +/// <summary> +/// The video request dto. +/// </summary> +public class VideoRequestDto : StreamingRequestDto { /// <summary> - /// The video request dto. + /// Gets a value indicating whether this instance has fixed resolution. /// </summary> - public class VideoRequestDto : StreamingRequestDto - { - /// <summary> - /// Gets a value indicating whether this instance has fixed resolution. - /// </summary> - /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value> - public bool HasFixedResolution => Width.HasValue || Height.HasValue; + /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value> + public bool HasFixedResolution => Width.HasValue || Height.HasValue; - /// <summary> - /// Gets or sets a value indicating whether to enable subtitles in the manifest. - /// </summary> - public bool EnableSubtitlesInManifest { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether to enable subtitles in the manifest. + /// </summary> + public bool EnableSubtitlesInManifest { get; set; } } diff --git a/Jellyfin.Api/Models/SubtitleDtos/UploadSubtitleDto.cs b/Jellyfin.Api/Models/SubtitleDtos/UploadSubtitleDto.cs index be0595798..3c903ea6b 100644 --- a/Jellyfin.Api/Models/SubtitleDtos/UploadSubtitleDto.cs +++ b/Jellyfin.Api/Models/SubtitleDtos/UploadSubtitleDto.cs @@ -1,34 +1,33 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.SubtitleDtos +namespace Jellyfin.Api.Models.SubtitleDtos; + +/// <summary> +/// Upload subtitles dto. +/// </summary> +public class UploadSubtitleDto { /// <summary> - /// Upload subtitles dto. + /// Gets or sets the subtitle language. /// </summary> - public class UploadSubtitleDto - { - /// <summary> - /// Gets or sets the subtitle language. - /// </summary> - [Required] - public string Language { get; set; } = string.Empty; + [Required] + public string Language { get; set; } = string.Empty; - /// <summary> - /// Gets or sets the subtitle format. - /// </summary> - [Required] - public string Format { get; set; } = string.Empty; + /// <summary> + /// Gets or sets the subtitle format. + /// </summary> + [Required] + public string Format { get; set; } = string.Empty; - /// <summary> - /// Gets or sets a value indicating whether the subtitle is forced. - /// </summary> - [Required] - public bool IsForced { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the subtitle is forced. + /// </summary> + [Required] + public bool IsForced { get; set; } - /// <summary> - /// Gets or sets the subtitle data. - /// </summary> - [Required] - public string Data { get; set; } = string.Empty; - } + /// <summary> + /// Gets or sets the subtitle data. + /// </summary> + [Required] + public string Data { get; set; } = string.Empty; } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/BufferRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/BufferRequestDto.cs index 479c44084..e7613911e 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/BufferRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/BufferRequestDto.cs @@ -1,42 +1,41 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class BufferRequestDto. +/// </summary> +public class BufferRequestDto { /// <summary> - /// Class BufferRequestDto. + /// Initializes a new instance of the <see cref="BufferRequestDto"/> class. /// </summary> - public class BufferRequestDto + public BufferRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="BufferRequestDto"/> class. - /// </summary> - public BufferRequestDto() - { - PlaylistItemId = Guid.Empty; - } + PlaylistItemId = Guid.Empty; + } - /// <summary> - /// Gets or sets when the request has been made by the client. - /// </summary> - /// <value>The date of the request.</value> - public DateTime When { get; set; } + /// <summary> + /// Gets or sets when the request has been made by the client. + /// </summary> + /// <value>The date of the request.</value> + public DateTime When { get; set; } - /// <summary> - /// Gets or sets the position ticks. - /// </summary> - /// <value>The position ticks.</value> - public long PositionTicks { get; set; } + /// <summary> + /// Gets or sets the position ticks. + /// </summary> + /// <value>The position ticks.</value> + public long PositionTicks { get; set; } - /// <summary> - /// Gets or sets a value indicating whether the client playback is unpaused. - /// </summary> - /// <value>The client playback status.</value> - public bool IsPlaying { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the client playback is unpaused. + /// </summary> + /// <value>The client playback status.</value> + public bool IsPlaying { get; set; } - /// <summary> - /// Gets or sets the playlist item identifier of the playing item. - /// </summary> - /// <value>The playlist item identifier.</value> - public Guid PlaylistItemId { get; set; } - } + /// <summary> + /// Gets or sets the playlist item identifier of the playing item. + /// </summary> + /// <value>The playlist item identifier.</value> + public Guid PlaylistItemId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/IgnoreWaitRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/IgnoreWaitRequestDto.cs index 4c30b7be4..8ccd831bd 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/IgnoreWaitRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/IgnoreWaitRequestDto.cs @@ -1,14 +1,13 @@ -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class IgnoreWaitRequestDto. +/// </summary> +public class IgnoreWaitRequestDto { /// <summary> - /// Class IgnoreWaitRequestDto. + /// Gets or sets a value indicating whether the client should be ignored. /// </summary> - public class IgnoreWaitRequestDto - { - /// <summary> - /// Gets or sets a value indicating whether the client should be ignored. - /// </summary> - /// <value>The client group-wait status.</value> - public bool IgnoreWait { get; set; } - } + /// <value>The client group-wait status.</value> + public bool IgnoreWait { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/JoinGroupRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/JoinGroupRequestDto.cs index ed97b8d6a..89ba511af 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/JoinGroupRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/JoinGroupRequestDto.cs @@ -1,16 +1,15 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class JoinGroupRequestDto. +/// </summary> +public class JoinGroupRequestDto { /// <summary> - /// Class JoinGroupRequestDto. + /// Gets or sets the group identifier. /// </summary> - public class JoinGroupRequestDto - { - /// <summary> - /// Gets or sets the group identifier. - /// </summary> - /// <value>The identifier of the group to join.</value> - public Guid GroupId { get; set; } - } + /// <value>The identifier of the group to join.</value> + public Guid GroupId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/MovePlaylistItemRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/MovePlaylistItemRequestDto.cs index 3af25f3e3..220d147f2 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/MovePlaylistItemRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/MovePlaylistItemRequestDto.cs @@ -1,30 +1,29 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class MovePlaylistItemRequestDto. +/// </summary> +public class MovePlaylistItemRequestDto { /// <summary> - /// Class MovePlaylistItemRequestDto. + /// Initializes a new instance of the <see cref="MovePlaylistItemRequestDto"/> class. /// </summary> - public class MovePlaylistItemRequestDto + public MovePlaylistItemRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="MovePlaylistItemRequestDto"/> class. - /// </summary> - public MovePlaylistItemRequestDto() - { - PlaylistItemId = Guid.Empty; - } + PlaylistItemId = Guid.Empty; + } - /// <summary> - /// Gets or sets the playlist identifier of the item. - /// </summary> - /// <value>The playlist identifier of the item.</value> - public Guid PlaylistItemId { get; set; } + /// <summary> + /// Gets or sets the playlist identifier of the item. + /// </summary> + /// <value>The playlist identifier of the item.</value> + public Guid PlaylistItemId { get; set; } - /// <summary> - /// Gets or sets the new position. - /// </summary> - /// <value>The new position.</value> - public int NewIndex { get; set; } - } + /// <summary> + /// Gets or sets the new position. + /// </summary> + /// <value>The new position.</value> + public int NewIndex { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/NewGroupRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/NewGroupRequestDto.cs index 441d7be36..32a3bb444 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/NewGroupRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/NewGroupRequestDto.cs @@ -1,22 +1,21 @@ -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class NewGroupRequestDto. +/// </summary> +public class NewGroupRequestDto { /// <summary> - /// Class NewGroupRequestDto. + /// Initializes a new instance of the <see cref="NewGroupRequestDto"/> class. /// </summary> - public class NewGroupRequestDto + public NewGroupRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="NewGroupRequestDto"/> class. - /// </summary> - public NewGroupRequestDto() - { - GroupName = string.Empty; - } - - /// <summary> - /// Gets or sets the group name. - /// </summary> - /// <value>The name of the new group.</value> - public string GroupName { get; set; } + GroupName = string.Empty; } + + /// <summary> + /// Gets or sets the group name. + /// </summary> + /// <value>The name of the new group.</value> + public string GroupName { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/NextItemRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/NextItemRequestDto.cs index f59a93f13..b5223af5d 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/NextItemRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/NextItemRequestDto.cs @@ -1,24 +1,23 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class NextItemRequestDto. +/// </summary> +public class NextItemRequestDto { /// <summary> - /// Class NextItemRequestDto. + /// Initializes a new instance of the <see cref="NextItemRequestDto"/> class. /// </summary> - public class NextItemRequestDto + public NextItemRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="NextItemRequestDto"/> class. - /// </summary> - public NextItemRequestDto() - { - PlaylistItemId = Guid.Empty; - } - - /// <summary> - /// Gets or sets the playing item identifier. - /// </summary> - /// <value>The playing item identifier.</value> - public Guid PlaylistItemId { get; set; } + PlaylistItemId = Guid.Empty; } + + /// <summary> + /// Gets or sets the playing item identifier. + /// </summary> + /// <value>The playing item identifier.</value> + public Guid PlaylistItemId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/PingRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/PingRequestDto.cs index c4ac06856..f13395057 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/PingRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/PingRequestDto.cs @@ -1,14 +1,13 @@ -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class PingRequestDto. +/// </summary> +public class PingRequestDto { /// <summary> - /// Class PingRequestDto. + /// Gets or sets the ping time. /// </summary> - public class PingRequestDto - { - /// <summary> - /// Gets or sets the ping time. - /// </summary> - /// <value>The ping time.</value> - public long Ping { get; set; } - } + /// <value>The ping time.</value> + public long Ping { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/PlayRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/PlayRequestDto.cs index 844388cd9..e0edaf5e0 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/PlayRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/PlayRequestDto.cs @@ -1,37 +1,36 @@ using System; using System.Collections.Generic; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class PlayRequestDto. +/// </summary> +public class PlayRequestDto { /// <summary> - /// Class PlayRequestDto. + /// Initializes a new instance of the <see cref="PlayRequestDto"/> class. /// </summary> - public class PlayRequestDto + public PlayRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="PlayRequestDto"/> class. - /// </summary> - public PlayRequestDto() - { - PlayingQueue = Array.Empty<Guid>(); - } + PlayingQueue = Array.Empty<Guid>(); + } - /// <summary> - /// Gets or sets the playing queue. - /// </summary> - /// <value>The playing queue.</value> - public IReadOnlyList<Guid> PlayingQueue { get; set; } + /// <summary> + /// Gets or sets the playing queue. + /// </summary> + /// <value>The playing queue.</value> + public IReadOnlyList<Guid> PlayingQueue { get; set; } - /// <summary> - /// Gets or sets the position of the playing item in the queue. - /// </summary> - /// <value>The playing item position.</value> - public int PlayingItemPosition { get; set; } + /// <summary> + /// Gets or sets the position of the playing item in the queue. + /// </summary> + /// <value>The playing item position.</value> + public int PlayingItemPosition { get; set; } - /// <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 start position ticks. + /// </summary> + /// <value>The start position ticks.</value> + public long StartPositionTicks { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/PreviousItemRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/PreviousItemRequestDto.cs index 7fd4a49be..f52bd7f46 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/PreviousItemRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/PreviousItemRequestDto.cs @@ -1,24 +1,23 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class PreviousItemRequestDto. +/// </summary> +public class PreviousItemRequestDto { /// <summary> - /// Class PreviousItemRequestDto. + /// Initializes a new instance of the <see cref="PreviousItemRequestDto"/> class. /// </summary> - public class PreviousItemRequestDto + public PreviousItemRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="PreviousItemRequestDto"/> class. - /// </summary> - public PreviousItemRequestDto() - { - PlaylistItemId = Guid.Empty; - } - - /// <summary> - /// Gets or sets the playing item identifier. - /// </summary> - /// <value>The playing item identifier.</value> - public Guid PlaylistItemId { get; set; } + PlaylistItemId = Guid.Empty; } + + /// <summary> + /// Gets or sets the playing item identifier. + /// </summary> + /// <value>The playing item identifier.</value> + public Guid PlaylistItemId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/QueueRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/QueueRequestDto.cs index 2b187f443..c2c2fba04 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/QueueRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/QueueRequestDto.cs @@ -2,31 +2,30 @@ using System; using System.Collections.Generic; using MediaBrowser.Model.SyncPlay; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class QueueRequestDto. +/// </summary> +public class QueueRequestDto { /// <summary> - /// Class QueueRequestDto. + /// Initializes a new instance of the <see cref="QueueRequestDto"/> class. /// </summary> - public class QueueRequestDto + public QueueRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="QueueRequestDto"/> class. - /// </summary> - public QueueRequestDto() - { - ItemIds = Array.Empty<Guid>(); - } + ItemIds = Array.Empty<Guid>(); + } - /// <summary> - /// Gets or sets the items to enqueue. - /// </summary> - /// <value>The items to enqueue.</value> - public IReadOnlyList<Guid> ItemIds { get; set; } + /// <summary> + /// Gets or sets the items to enqueue. + /// </summary> + /// <value>The items to enqueue.</value> + public IReadOnlyList<Guid> ItemIds { get; set; } - /// <summary> - /// Gets or sets the mode in which to add the new items. - /// </summary> - /// <value>The enqueue mode.</value> - public GroupQueueMode Mode { get; set; } - } + /// <summary> + /// Gets or sets the mode in which to add the new items. + /// </summary> + /// <value>The enqueue mode.</value> + public GroupQueueMode Mode { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/ReadyRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/ReadyRequestDto.cs index d9c193016..d8be75ef1 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/ReadyRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/ReadyRequestDto.cs @@ -1,42 +1,41 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class ReadyRequest. +/// </summary> +public class ReadyRequestDto { /// <summary> - /// Class ReadyRequest. + /// Initializes a new instance of the <see cref="ReadyRequestDto"/> class. /// </summary> - public class ReadyRequestDto + public ReadyRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="ReadyRequestDto"/> class. - /// </summary> - public ReadyRequestDto() - { - PlaylistItemId = Guid.Empty; - } + PlaylistItemId = Guid.Empty; + } - /// <summary> - /// Gets or sets when the request has been made by the client. - /// </summary> - /// <value>The date of the request.</value> - public DateTime When { get; set; } + /// <summary> + /// Gets or sets when the request has been made by the client. + /// </summary> + /// <value>The date of the request.</value> + public DateTime When { get; set; } - /// <summary> - /// Gets or sets the position ticks. - /// </summary> - /// <value>The position ticks.</value> - public long PositionTicks { get; set; } + /// <summary> + /// Gets or sets the position ticks. + /// </summary> + /// <value>The position ticks.</value> + public long PositionTicks { get; set; } - /// <summary> - /// Gets or sets a value indicating whether the client playback is unpaused. - /// </summary> - /// <value>The client playback status.</value> - public bool IsPlaying { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the client playback is unpaused. + /// </summary> + /// <value>The client playback status.</value> + public bool IsPlaying { get; set; } - /// <summary> - /// Gets or sets the playlist item identifier of the playing item. - /// </summary> - /// <value>The playlist item identifier.</value> - public Guid PlaylistItemId { get; set; } - } + /// <summary> + /// Gets or sets the playlist item identifier of the playing item. + /// </summary> + /// <value>The playlist item identifier.</value> + public Guid PlaylistItemId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/RemoveFromPlaylistRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/RemoveFromPlaylistRequestDto.cs index 226a584e1..2c7234272 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/RemoveFromPlaylistRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/RemoveFromPlaylistRequestDto.cs @@ -1,37 +1,36 @@ using System; using System.Collections.Generic; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class RemoveFromPlaylistRequestDto. +/// </summary> +public class RemoveFromPlaylistRequestDto { /// <summary> - /// Class RemoveFromPlaylistRequestDto. + /// Initializes a new instance of the <see cref="RemoveFromPlaylistRequestDto"/> class. /// </summary> - public class RemoveFromPlaylistRequestDto + public RemoveFromPlaylistRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="RemoveFromPlaylistRequestDto"/> class. - /// </summary> - public RemoveFromPlaylistRequestDto() - { - PlaylistItemIds = Array.Empty<Guid>(); - } + PlaylistItemIds = Array.Empty<Guid>(); + } - /// <summary> - /// Gets or sets the playlist identifiers of the items. Ignored when clearing the playlist. - /// </summary> - /// <value>The playlist identifiers of the items.</value> - public IReadOnlyList<Guid> PlaylistItemIds { get; set; } + /// <summary> + /// Gets or sets the playlist identifiers of the items. Ignored when clearing the playlist. + /// </summary> + /// <value>The playlist identifiers of the items.</value> + public IReadOnlyList<Guid> PlaylistItemIds { get; set; } - /// <summary> - /// Gets or sets a value indicating whether the entire playlist should be cleared. - /// </summary> - /// <value>Whether the entire playlist should be cleared.</value> - public bool ClearPlaylist { get; set; } + /// <summary> + /// Gets or sets a value indicating whether the entire playlist should be cleared. + /// </summary> + /// <value>Whether the entire playlist should be cleared.</value> + public bool ClearPlaylist { get; set; } - /// <summary> - /// Gets or sets a value indicating whether the playing item should be removed as well. Used only when clearing the playlist. - /// </summary> - /// <value>Whether the playing item should be removed as well.</value> - public bool ClearPlayingItem { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether the playing item should be removed as well. Used only when clearing the playlist. + /// </summary> + /// <value>Whether the playing item should be removed as well.</value> + public bool ClearPlayingItem { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/SeekRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/SeekRequestDto.cs index b9af0be7f..f461417e9 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/SeekRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/SeekRequestDto.cs @@ -1,14 +1,13 @@ -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class SeekRequestDto. +/// </summary> +public class SeekRequestDto { /// <summary> - /// Class SeekRequestDto. + /// Gets or sets the position ticks. /// </summary> - public class SeekRequestDto - { - /// <summary> - /// Gets or sets the position ticks. - /// </summary> - /// <value>The position ticks.</value> - public long PositionTicks { get; set; } - } + /// <value>The position ticks.</value> + public long PositionTicks { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/SetPlaylistItemRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/SetPlaylistItemRequestDto.cs index b937679fc..40e665039 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/SetPlaylistItemRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/SetPlaylistItemRequestDto.cs @@ -1,24 +1,23 @@ using System; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class SetPlaylistItemRequestDto. +/// </summary> +public class SetPlaylistItemRequestDto { /// <summary> - /// Class SetPlaylistItemRequestDto. + /// Initializes a new instance of the <see cref="SetPlaylistItemRequestDto"/> class. /// </summary> - public class SetPlaylistItemRequestDto + public SetPlaylistItemRequestDto() { - /// <summary> - /// Initializes a new instance of the <see cref="SetPlaylistItemRequestDto"/> class. - /// </summary> - public SetPlaylistItemRequestDto() - { - PlaylistItemId = Guid.Empty; - } - - /// <summary> - /// Gets or sets the playlist identifier of the playing item. - /// </summary> - /// <value>The playlist identifier of the playing item.</value> - public Guid PlaylistItemId { get; set; } + PlaylistItemId = Guid.Empty; } + + /// <summary> + /// Gets or sets the playlist identifier of the playing item. + /// </summary> + /// <value>The playlist identifier of the playing item.</value> + public Guid PlaylistItemId { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/SetRepeatModeRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/SetRepeatModeRequestDto.cs index e748fc3e0..387d1ea77 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/SetRepeatModeRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/SetRepeatModeRequestDto.cs @@ -1,16 +1,15 @@ using MediaBrowser.Model.SyncPlay; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class SetRepeatModeRequestDto. +/// </summary> +public class SetRepeatModeRequestDto { /// <summary> - /// Class SetRepeatModeRequestDto. + /// Gets or sets the repeat mode. /// </summary> - public class SetRepeatModeRequestDto - { - /// <summary> - /// Gets or sets the repeat mode. - /// </summary> - /// <value>The repeat mode.</value> - public GroupRepeatMode Mode { get; set; } - } + /// <value>The repeat mode.</value> + public GroupRepeatMode Mode { get; set; } } diff --git a/Jellyfin.Api/Models/SyncPlayDtos/SetShuffleModeRequestDto.cs b/Jellyfin.Api/Models/SyncPlayDtos/SetShuffleModeRequestDto.cs index 0e427f4a4..a67e3958c 100644 --- a/Jellyfin.Api/Models/SyncPlayDtos/SetShuffleModeRequestDto.cs +++ b/Jellyfin.Api/Models/SyncPlayDtos/SetShuffleModeRequestDto.cs @@ -1,16 +1,15 @@ using MediaBrowser.Model.SyncPlay; -namespace Jellyfin.Api.Models.SyncPlayDtos +namespace Jellyfin.Api.Models.SyncPlayDtos; + +/// <summary> +/// Class SetShuffleModeRequestDto. +/// </summary> +public class SetShuffleModeRequestDto { /// <summary> - /// Class SetShuffleModeRequestDto. + /// Gets or sets the shuffle mode. /// </summary> - public class SetShuffleModeRequestDto - { - /// <summary> - /// Gets or sets the shuffle mode. - /// </summary> - /// <value>The shuffle mode.</value> - public GroupShuffleMode Mode { get; set; } - } + /// <value>The shuffle mode.</value> + public GroupShuffleMode Mode { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/AuthenticateUserByName.cs b/Jellyfin.Api/Models/UserDtos/AuthenticateUserByName.cs index 41f7b169e..70c18a98a 100644 --- a/Jellyfin.Api/Models/UserDtos/AuthenticateUserByName.cs +++ b/Jellyfin.Api/Models/UserDtos/AuthenticateUserByName.cs @@ -1,26 +1,17 @@ -using System; +namespace Jellyfin.Api.Models.UserDtos; -namespace Jellyfin.Api.Models.UserDtos +/// <summary> +/// The authenticate user by name request body. +/// </summary> +public class AuthenticateUserByName { /// <summary> - /// The authenticate user by name request body. + /// Gets or sets the username. /// </summary> - public class AuthenticateUserByName - { - /// <summary> - /// Gets or sets the username. - /// </summary> - public string? Username { get; set; } + public string? Username { get; set; } - /// <summary> - /// Gets or sets the plain text password. - /// </summary> - public string? Pw { get; set; } - - /// <summary> - /// Gets or sets the sha1-hashed password. - /// </summary> - [Obsolete("Send password using pw field")] - public string? Password { get; set; } - } + /// <summary> + /// Gets or sets the plain text password. + /// </summary> + public string? Pw { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/CreateUserByName.cs b/Jellyfin.Api/Models/UserDtos/CreateUserByName.cs index 1c88d3628..6b6d9682b 100644 --- a/Jellyfin.Api/Models/UserDtos/CreateUserByName.cs +++ b/Jellyfin.Api/Models/UserDtos/CreateUserByName.cs @@ -1,18 +1,20 @@ -namespace Jellyfin.Api.Models.UserDtos +using System.ComponentModel.DataAnnotations; + +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// The create user by name request body. +/// </summary> +public class CreateUserByName { /// <summary> - /// The create user by name request body. + /// Gets or sets the username. /// </summary> - public class CreateUserByName - { - /// <summary> - /// Gets or sets the username. - /// </summary> - public string? Name { get; set; } + [Required] + required public string Name { get; set; } - /// <summary> - /// Gets or sets the password. - /// </summary> - public string? Password { get; set; } - } + /// <summary> + /// Gets or sets the password. + /// </summary> + public string? Password { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs index b31c6539c..a0631fd07 100644 --- a/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs +++ b/Jellyfin.Api/Models/UserDtos/ForgotPasswordDto.cs @@ -1,16 +1,15 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.UserDtos +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// Forgot Password request body DTO. +/// </summary> +public class ForgotPasswordDto { /// <summary> - /// Forgot Password request body DTO. + /// Gets or sets the entered username to have its password reset. /// </summary> - public class ForgotPasswordDto - { - /// <summary> - /// Gets or sets the entered username to have its password reset. - /// </summary> - [Required] - public string? EnteredUsername { get; set; } - } + [Required] + required public string EnteredUsername { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/ForgotPasswordPinDto.cs b/Jellyfin.Api/Models/UserDtos/ForgotPasswordPinDto.cs index 62780e23c..79b8a5d63 100644 --- a/Jellyfin.Api/Models/UserDtos/ForgotPasswordPinDto.cs +++ b/Jellyfin.Api/Models/UserDtos/ForgotPasswordPinDto.cs @@ -1,16 +1,15 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.UserDtos +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// Forgot Password Pin enter request body DTO. +/// </summary> +public class ForgotPasswordPinDto { /// <summary> - /// Forgot Password Pin enter request body DTO. + /// Gets or sets the entered pin to have the password reset. /// </summary> - public class ForgotPasswordPinDto - { - /// <summary> - /// Gets or sets the entered pin to have the password reset. - /// </summary> - [Required] - public string? Pin { get; set; } - } + [Required] + required public string Pin { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/QuickConnectDto.cs b/Jellyfin.Api/Models/UserDtos/QuickConnectDto.cs index 9493c08c2..245002f80 100644 --- a/Jellyfin.Api/Models/UserDtos/QuickConnectDto.cs +++ b/Jellyfin.Api/Models/UserDtos/QuickConnectDto.cs @@ -1,16 +1,15 @@ using System.ComponentModel.DataAnnotations; -namespace Jellyfin.Api.Models.UserDtos +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// The quick connect request body. +/// </summary> +public class QuickConnectDto { /// <summary> - /// The quick connect request body. + /// Gets or sets the quick connect secret. /// </summary> - public class QuickConnectDto - { - /// <summary> - /// Gets or sets the quick connect secret. - /// </summary> - [Required] - public string Secret { get; set; } = null!; - } + [Required] + public string Secret { get; set; } = null!; } diff --git a/Jellyfin.Api/Models/UserDtos/UpdateUserEasyPassword.cs b/Jellyfin.Api/Models/UserDtos/UpdateUserEasyPassword.cs index 0a173ea1a..80b6203bc 100644 --- a/Jellyfin.Api/Models/UserDtos/UpdateUserEasyPassword.cs +++ b/Jellyfin.Api/Models/UserDtos/UpdateUserEasyPassword.cs @@ -1,23 +1,22 @@ -namespace Jellyfin.Api.Models.UserDtos +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// The update user easy password request body. +/// </summary> +public class UpdateUserEasyPassword { /// <summary> - /// The update user easy password request body. + /// Gets or sets the new sha1-hashed password. /// </summary> - public class UpdateUserEasyPassword - { - /// <summary> - /// Gets or sets the new sha1-hashed password. - /// </summary> - public string? NewPassword { get; set; } + public string? NewPassword { get; set; } - /// <summary> - /// Gets or sets the new password. - /// </summary> - public string? NewPw { get; set; } + /// <summary> + /// Gets or sets the new password. + /// </summary> + public string? NewPw { get; set; } - /// <summary> - /// Gets or sets a value indicating whether to reset the password. - /// </summary> - public bool ResetPassword { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether to reset the password. + /// </summary> + public bool ResetPassword { get; set; } } diff --git a/Jellyfin.Api/Models/UserDtos/UpdateUserPassword.cs b/Jellyfin.Api/Models/UserDtos/UpdateUserPassword.cs index 8288dbbc4..5347fcc9a 100644 --- a/Jellyfin.Api/Models/UserDtos/UpdateUserPassword.cs +++ b/Jellyfin.Api/Models/UserDtos/UpdateUserPassword.cs @@ -1,28 +1,27 @@ -namespace Jellyfin.Api.Models.UserDtos +namespace Jellyfin.Api.Models.UserDtos; + +/// <summary> +/// The update user password request body. +/// </summary> +public class UpdateUserPassword { /// <summary> - /// The update user password request body. + /// Gets or sets the current sha1-hashed password. /// </summary> - public class UpdateUserPassword - { - /// <summary> - /// Gets or sets the current sha1-hashed password. - /// </summary> - public string? CurrentPassword { get; set; } + public string? CurrentPassword { get; set; } - /// <summary> - /// Gets or sets the current plain text password. - /// </summary> - public string? CurrentPw { get; set; } + /// <summary> + /// Gets or sets the current plain text password. + /// </summary> + public string? CurrentPw { get; set; } - /// <summary> - /// Gets or sets the new plain text password. - /// </summary> - public string? NewPw { get; set; } + /// <summary> + /// Gets or sets the new plain text password. + /// </summary> + public string? NewPw { get; set; } - /// <summary> - /// Gets or sets a value indicating whether to reset the password. - /// </summary> - public bool ResetPassword { get; set; } - } + /// <summary> + /// Gets or sets a value indicating whether to reset the password. + /// </summary> + public bool ResetPassword { get; set; } } diff --git a/Jellyfin.Api/Models/UserViewDtos/SpecialViewOptionDto.cs b/Jellyfin.Api/Models/UserViewDtos/SpecialViewOptionDto.cs index 84b6b0958..314b6a324 100644 --- a/Jellyfin.Api/Models/UserViewDtos/SpecialViewOptionDto.cs +++ b/Jellyfin.Api/Models/UserViewDtos/SpecialViewOptionDto.cs @@ -1,18 +1,17 @@ -namespace Jellyfin.Api.Models.UserViewDtos +namespace Jellyfin.Api.Models.UserViewDtos; + +/// <summary> +/// Special view option dto. +/// </summary> +public class SpecialViewOptionDto { /// <summary> - /// Special view option dto. + /// Gets or sets view option name. /// </summary> - public class SpecialViewOptionDto - { - /// <summary> - /// Gets or sets view option name. - /// </summary> - public string? Name { get; set; } + public string? Name { get; set; } - /// <summary> - /// Gets or sets view option id. - /// </summary> - public string? Id { get; set; } - } + /// <summary> + /// Gets or sets view option id. + /// </summary> + public string? Id { get; set; } } |
