From c84edaa92fc4c00a951167c9b4b716ffed575add Mon Sep 17 00:00:00 2001 From: Tim Eisele Date: Fri, 8 Nov 2024 11:07:31 +0100 Subject: [PATCH] Apply review suggestions --- src/Jellyfin.Plugin.Dlna.Model/DlnaDeviceProfile.cs | 6 ++++-- src/Jellyfin.Plugin.Dlna.Model/IDeviceDiscovery.cs | 1 - src/Jellyfin.Plugin.Dlna/Didl/DidlBuilder.cs | 4 ++-- src/Jellyfin.Plugin.Dlna/DlnaManager.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Jellyfin.Plugin.Dlna.Model/DlnaDeviceProfile.cs b/src/Jellyfin.Plugin.Dlna.Model/DlnaDeviceProfile.cs index 2b4ba10..13c3caa 100644 --- a/src/Jellyfin.Plugin.Dlna.Model/DlnaDeviceProfile.cs +++ b/src/Jellyfin.Plugin.Dlna.Model/DlnaDeviceProfile.cs @@ -1,3 +1,5 @@ +#pragma warning disable CA1819 // Properties should not return arrays + using System; using System.Collections.Generic; using System.ComponentModel; @@ -158,12 +160,12 @@ public class DlnaDeviceProfile : DeviceProfile /// /// Gets or sets the XmlRootAttributes. /// - public IReadOnlyList XmlRootAttributes { get; set; } = []; + public XmlAttribute[] XmlRootAttributes { get; set; } = []; /// /// Gets or sets the ResponseProfiles. /// - public IReadOnlyList ResponseProfiles { get; set; } = []; + public ResponseProfile[] ResponseProfiles { get; set; } = []; /// /// The supported media types. diff --git a/src/Jellyfin.Plugin.Dlna.Model/IDeviceDiscovery.cs b/src/Jellyfin.Plugin.Dlna.Model/IDeviceDiscovery.cs index cbc59f4..0d5a7db 100644 --- a/src/Jellyfin.Plugin.Dlna.Model/IDeviceDiscovery.cs +++ b/src/Jellyfin.Plugin.Dlna.Model/IDeviceDiscovery.cs @@ -6,7 +6,6 @@ namespace Jellyfin.Plugin.Dlna.Model; /// /// Defines the interface. /// - public interface IDeviceDiscovery { /// diff --git a/src/Jellyfin.Plugin.Dlna/Didl/DidlBuilder.cs b/src/Jellyfin.Plugin.Dlna/Didl/DidlBuilder.cs index 1ef685d..0b2ee6d 100644 --- a/src/Jellyfin.Plugin.Dlna/Didl/DidlBuilder.cs +++ b/src/Jellyfin.Plugin.Dlna/Didl/DidlBuilder.cs @@ -261,8 +261,8 @@ private void AddVideoResource(XmlWriter writer, BaseItem video, string deviceId, var contentFeatureList = ContentFeatureBuilder.BuildVideoHeader( _profile, streamInfo.Container, - streamInfo.TargetVideoCodec[0], - streamInfo.TargetAudioCodec[0], + streamInfo.TargetVideoCodec.FirstOrDefault(), + streamInfo.TargetAudioCodec.FirstOrDefault(), targetWidth, targetHeight, streamInfo.TargetVideoBitDepth, diff --git a/src/Jellyfin.Plugin.Dlna/DlnaManager.cs b/src/Jellyfin.Plugin.Dlna/DlnaManager.cs index ed97036..eddc922 100644 --- a/src/Jellyfin.Plugin.Dlna/DlnaManager.cs +++ b/src/Jellyfin.Plugin.Dlna/DlnaManager.cs @@ -409,7 +409,7 @@ public void UpdateProfile(string profileId, DlnaDeviceProfile profile) if (profile.Id.IsNullOrEmpty()) { - throw new ArgumentException("Profile id cannot be empty. ProfileId: {Id}", nameof(profile)); + throw new ArgumentException($"Profile id cannot be empty. ProfileId: {profile.Id}", nameof(profile)); } ArgumentException.ThrowIfNullOrEmpty(profile.Name);