From a9ccccc5351936fb0bebcc7a3959d91e1e9a5bab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 8 May 2015 12:28:06 -0400 Subject: [PATCH] make more dlna attributes configurable --- MediaBrowser.Dlna/DlnaManager.cs | 2 +- MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs | 2 +- MediaBrowser.Dlna/Profiles/DefaultProfile.cs | 18 ++++++++++ .../Profiles/PanasonicVieraProfile.cs | 9 +---- .../Profiles/SamsungSmartTvProfile.cs | 9 +---- .../Profiles/SonyBlurayPlayer2013Profile.cs | 9 +---- .../Profiles/SonyBlurayPlayerProfile.cs | 9 +---- .../Profiles/SonyBravia2010Profile.cs | 9 +---- .../Profiles/SonyBravia2011Profile.cs | 9 +---- .../Profiles/SonyBravia2012Profile.cs | 9 +---- .../Profiles/SonyBravia2013Profile.cs | 9 +---- MediaBrowser.Dlna/Profiles/Xbox360Profile.cs | 10 ++++-- MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/Default.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml | 5 ++- .../Profiles/Xml/DirecTV HD-DVR.xml | 5 ++- .../Profiles/Xml/Dish Hopper-Joey.xml | 5 ++- .../Profiles/Xml/LG Smart TV.xml | 5 ++- .../Profiles/Xml/Linksys DMA2100.xml | 5 ++- .../Profiles/Xml/MediaMonkey.xml | 5 ++- .../Profiles/Xml/Panasonic Viera.xml | 2 ++ .../Profiles/Xml/Popcorn Hour.xml | 5 ++- .../Profiles/Xml/Samsung Smart TV.xml | 2 ++ .../Profiles/Xml/Sony Blu-ray Player 2013.xml | 2 ++ .../Profiles/Xml/Sony Blu-ray Player.xml | 2 ++ .../Profiles/Xml/Sony Bravia (2010).xml | 2 ++ .../Profiles/Xml/Sony Bravia (2011).xml | 2 ++ .../Profiles/Xml/Sony Bravia (2012).xml | 2 ++ .../Profiles/Xml/Sony Bravia (2013).xml | 2 ++ .../Profiles/Xml/Sony PlayStation 3.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/Vlc.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml | 11 ++++--- MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml | 5 ++- MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml | 5 ++- .../Server/DescriptionXmlBuilder.cs | 33 +++++++++++++++---- .../Manager/ProviderUtils.cs | 9 +++++ 37 files changed, 148 insertions(+), 95 deletions(-) diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 62756e4c43..2d2525919e 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -482,7 +482,7 @@ namespace MediaBrowser.Dlna var profile = GetProfile(headers) ?? GetDefaultProfile(); - return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName).GetXml(); + return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName, serverUuId.GetMD5().ToString("N")).GetXml(); } public ImageStream GetIcon(string filename) diff --git a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs index 39d3a8d075..ab6674afcc 100644 --- a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs +++ b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Dlna.PlayTo public class SsdpHttpClient { private const string USERAGENT = "Microsoft-Windows/6.2 UPnP/1.0 Microsoft-DLNA DLNADOC/1.50"; - private const string FriendlyName = "MediaBrowser"; + private const string FriendlyName = "Emby"; private readonly IHttpClient _httpClient; private readonly IServerConfigurationManager _config; diff --git a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs index a243fd0118..59e1dc5400 100644 --- a/MediaBrowser.Dlna/Profiles/DefaultProfile.cs +++ b/MediaBrowser.Dlna/Profiles/DefaultProfile.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Dlna; +using System.Linq; using System.Xml.Serialization; namespace MediaBrowser.Dlna.Profiles @@ -75,6 +76,23 @@ namespace MediaBrowser.Dlna.Profiles Type = DlnaProfileType.Video } }; + + AddXmlRootAttribute("xmlns", "urn:schemas-upnp-org:device-1-0"); + AddXmlRootAttribute("xmlns:dlna", "urn:schemas-dlna-org:device-1-0"); + } + + public void AddXmlRootAttribute(string name, string value) + { + var atts = XmlRootAttributes ?? new XmlAttribute[] { }; + var list = atts.ToList(); + + list.Add(new XmlAttribute + { + Name = name, + Value = value + }); + + XmlRootAttributes = list.ToArray(); } } } diff --git a/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs index 9e51c2895c..473640c15a 100644 --- a/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs +++ b/MediaBrowser.Dlna/Profiles/PanasonicVieraProfile.cs @@ -26,14 +26,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:pv", - Value = "http://www.pv.com/pvns/" - } - }; + AddXmlRootAttribute("xmlns:pv", "http://www.pv.com/pvns/"); TimelineOffsetSeconds = 10; diff --git a/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs b/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs index 396dd64892..d2aa005c39 100644 --- a/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs +++ b/MediaBrowser.Dlna/Profiles/SamsungSmartTvProfile.cs @@ -27,14 +27,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:sec", - Value = "http://www.sec.co.kr/" - } - }; + AddXmlRootAttribute("xmlns:sec", "http://www.sec.co.kr/"); TranscodingProfiles = new[] { diff --git a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs index baaccba5a7..dbade81705 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayer2013Profile.cs @@ -17,14 +17,7 @@ namespace MediaBrowser.Dlna.Profiles ModelNumber = "BDP-2013" }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); ModelName = "Windows Media Player Sharing"; ModelNumber = "3.0"; diff --git a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs index d2e6d7c15f..f6cc036377 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBlurayPlayerProfile.cs @@ -33,14 +33,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); ModelName = "Windows Media Player Sharing"; ModelNumber = "3.0"; diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs index 3bd425cb38..3a1086d3c7 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2010Profile.cs @@ -26,14 +26,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); AlbumArtPn = "JPEG_TN"; diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs index de4f1d2b65..34b2dc3257 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2011Profile.cs @@ -26,14 +26,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); AlbumArtPn = "JPEG_TN"; diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs index 5a5fb9e942..c56663d432 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2012Profile.cs @@ -26,14 +26,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); AlbumArtPn = "JPEG_TN"; diff --git a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs index 74a07f3892..d19ca1a917 100644 --- a/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs +++ b/MediaBrowser.Dlna/Profiles/SonyBravia2013Profile.cs @@ -26,14 +26,7 @@ namespace MediaBrowser.Dlna.Profiles } }; - XmlRootAttributes = new[] - { - new XmlAttribute - { - Name = "xmlns:av", - Value = "urn:schemas-sony-com:av" - } - }; + AddXmlRootAttribute("xmlns:av", "urn:schemas-sony-com:av"); AlbumArtPn = "JPEG_TN"; diff --git a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs index 62c06f8f57..f230b38ae4 100644 --- a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs +++ b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs @@ -18,12 +18,13 @@ namespace MediaBrowser.Dlna.Profiles ModelNumber = "12.0"; - FriendlyName = "${HostName} : 1"; + FriendlyName = "${HostName}: Emby:"; - ModelUrl = "http://www.microsoft.com/"; + ModelUrl = "http://go.microsoft.com/fwlink/?LinkId=105926"; Manufacturer = "Microsoft Corporation"; - ManufacturerUrl = "http://www.microsoft.com/"; + ManufacturerUrl = "http://www.microsoft.com"; XDlnaDoc = "DMS-1.50"; + ModelDescription = null; TimelineOffsetSeconds = 40; RequiresPlainFolders = true; @@ -311,6 +312,9 @@ namespace MediaBrowser.Dlna.Profiles } } }; + + XmlRootAttributes = new XmlAttribute[] { }; + AddXmlRootAttribute("xmlns", "urn:schemas-upnp-org:device-1-0"); } } } diff --git a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml index d65b55f2e1..4aacc8a484 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/BubbleUPnp.xml @@ -32,7 +32,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Default.xml b/MediaBrowser.Dlna/Profiles/Xml/Default.xml index 1c611d47a4..4755d60bd3 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Default.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Default.xml @@ -26,7 +26,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml index 4f8a0eac5e..6bf90c8ff5 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Denon AVR.xml @@ -31,7 +31,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml index 4595b57e00..cecdfdbe42 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/DirecTV HD-DVR.xml @@ -32,7 +32,10 @@ true true false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml index 50bc43f7c9..59f374b2e5 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Dish Hopper-Joey.xml @@ -33,7 +33,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml index 919fa5a40a..340a295e78 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/LG Smart TV.xml @@ -32,7 +32,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml index 1dc942873c..057a052e15 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Linksys DMA2100.xml @@ -30,7 +30,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml index 4896402a07..8054f3b619 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/MediaMonkey.xml @@ -32,7 +32,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml index a2203e4cec..e0517aa8ad 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Panasonic Viera.xml @@ -34,6 +34,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml index b02f379865..d2f03333ae 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Popcorn Hour.xml @@ -26,7 +26,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml index 91c2325cf6..70f3b0f8de 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Samsung Smart TV.xml @@ -33,6 +33,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml index f5ec1a31eb..b8a75ec94a 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player 2013.xml @@ -33,6 +33,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml index 6a732f8694..cf80c01924 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Blu-ray Player.xml @@ -35,6 +35,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml index 7afc8183d2..eabdb303f1 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2010).xml @@ -35,6 +35,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml index 7400600e22..e6669f8e8d 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2011).xml @@ -35,6 +35,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml index b8e3d6d309..7aa877cd4f 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2012).xml @@ -35,6 +35,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml index 5733d9d0b1..7611f26b00 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony Bravia (2013).xml @@ -35,6 +35,8 @@ false false + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml index 4b21dc195f..89e282cd06 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Sony PlayStation 3.xml @@ -34,7 +34,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml index fd4b77f558..bc24f268cf 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Vlc.xml @@ -32,7 +32,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml index a2ab33b4e5..6cb9331514 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/WDTV Live.xml @@ -33,7 +33,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml index 69d091e47e..4ada245128 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml @@ -8,13 +8,12 @@ - ${HostName} : 1 + ${HostName}: Emby: Microsoft Corporation - http://www.microsoft.com/ + http://www.microsoft.com Windows Media Player Sharing - Emby 12.0 - http://www.microsoft.com/ + http://go.microsoft.com/fwlink/?LinkId=105926 false false Audio,Photo,Video @@ -33,7 +32,9 @@ true true true - + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml index e1faea150f..0732923636 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox One.xml @@ -33,7 +33,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml index c2095cf833..f989453609 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/foobar2000.xml @@ -32,7 +32,10 @@ false false false - + + + + diff --git a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs index e302fe902f..5780aa10bb 100644 --- a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs +++ b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs @@ -18,8 +18,9 @@ namespace MediaBrowser.Dlna.Server private readonly string _serverUdn; private readonly string _serverAddress; private readonly string _serverName; + private readonly string _serverId; - public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName) + public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName, string serverId) { if (string.IsNullOrWhiteSpace(serverUdn)) { @@ -35,6 +36,7 @@ namespace MediaBrowser.Dlna.Server _serverUdn = serverUdn; _serverAddress = serverAddress; _serverName = serverName; + _serverId = serverId; } private bool EnableAbsoluteUrls @@ -48,7 +50,7 @@ namespace MediaBrowser.Dlna.Server builder.Append(""); - builder.Append(""); AppendDeviceProperties(builder); - AppendIconList(builder); + //AppendIconList(builder); AppendServiceList(builder); builder.Append(""); } @@ -80,20 +82,37 @@ namespace MediaBrowser.Dlna.Server private void AppendDeviceProperties(StringBuilder builder) { builder.Append("uuid:" + SecurityElement.Escape(_serverUdn) + ""); - builder.Append("" + SecurityElement.Escape(_profile.XDlnaCap ?? string.Empty) + ""); + + if (!string.IsNullOrWhiteSpace(_profile.XDlnaCap)) + { + builder.Append("" + SecurityElement.Escape(_profile.XDlnaCap ?? string.Empty) + ""); + } builder.Append("M-DMS-1.50"); builder.Append("" + SecurityElement.Escape(_profile.XDlnaDoc ?? string.Empty) + ""); - + builder.Append("" + SecurityElement.Escape(GetFriendlyName()) + ""); builder.Append("urn:schemas-upnp-org:device:MediaServer:1"); builder.Append("" + SecurityElement.Escape(_profile.Manufacturer ?? string.Empty) + ""); builder.Append("" + SecurityElement.Escape(_profile.ManufacturerUrl ?? string.Empty) + ""); builder.Append("" + SecurityElement.Escape(_profile.ModelName ?? string.Empty) + ""); - builder.Append("" + SecurityElement.Escape(_profile.ModelDescription ?? string.Empty) + ""); + + if (!string.IsNullOrWhiteSpace(_profile.ModelDescription)) + { + builder.Append("" + SecurityElement.Escape(_profile.ModelDescription ?? string.Empty) + ""); + } + builder.Append("" + SecurityElement.Escape(_profile.ModelNumber ?? string.Empty) + ""); builder.Append("" + SecurityElement.Escape(_profile.ModelUrl ?? string.Empty) + ""); - builder.Append("" + SecurityElement.Escape(_profile.SerialNumber ?? string.Empty) + ""); + + if (string.IsNullOrWhiteSpace(_profile.SerialNumber)) + { + builder.Append("" + SecurityElement.Escape(_serverId) + ""); + } + else + { + builder.Append("" + SecurityElement.Escape(_profile.SerialNumber) + ""); + } builder.Append("" + SecurityElement.Escape(_serverAddress) + ""); diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index aa92cc2802..1c526b4db9 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -14,6 +14,15 @@ namespace MediaBrowser.Providers.Manager bool replaceData, bool mergeMetadataSettings) { + if (source == null) + { + throw new ArgumentNullException("source"); + } + if (target == null) + { + throw new ArgumentNullException("target"); + } + if (!lockedFields.Contains(MetadataFields.Name)) { if (replaceData || string.IsNullOrEmpty(target.Name))