diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-02-01 16:32:01 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-02-01 16:32:01 -0500 |
| commit | b2c703949c057e75d0e5c20e75b96083d3aebe55 (patch) | |
| tree | 7b260bbb1acb9c85e5b4f19432e2453327a88629 | |
| parent | 49df4a31b18ad0f9f62d36c645b3592c7600f90c (diff) | |
xbox 360 dlna fixes
| -rw-r--r-- | MediaBrowser.Dlna/DlnaManager.cs | 7 | ||||
| -rw-r--r-- | MediaBrowser.Dlna/Profiles/Xbox360Profile.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml | 4 | ||||
| -rw-r--r-- | MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs | 23 |
4 files changed, 36 insertions, 8 deletions
diff --git a/MediaBrowser.Dlna/DlnaManager.cs b/MediaBrowser.Dlna/DlnaManager.cs index 872c07939..f0f295c83 100644 --- a/MediaBrowser.Dlna/DlnaManager.cs +++ b/MediaBrowser.Dlna/DlnaManager.cs @@ -1,6 +1,7 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.IO; +using MediaBrowser.Controller; using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Plugins; @@ -27,18 +28,20 @@ namespace MediaBrowser.Dlna private readonly IFileSystem _fileSystem; private readonly ILogger _logger; private readonly IJsonSerializer _jsonSerializer; + private readonly IServerApplicationHost _appHost; public DlnaManager(IXmlSerializer xmlSerializer, IFileSystem fileSystem, IApplicationPaths appPaths, ILogger logger, - IJsonSerializer jsonSerializer) + IJsonSerializer jsonSerializer, IServerApplicationHost appHost) { _xmlSerializer = xmlSerializer; _fileSystem = fileSystem; _appPaths = appPaths; _logger = logger; _jsonSerializer = jsonSerializer; + _appHost = appHost; } public IEnumerable<DeviceProfile> GetProfiles() @@ -480,7 +483,7 @@ namespace MediaBrowser.Dlna var profile = GetProfile(headers) ?? GetDefaultProfile(); - return new DescriptionXmlBuilder(profile, serverUuId, serverAddress).GetXml(); + return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName).GetXml(); } public ImageStream GetIcon(string filename) diff --git a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs index 7b04ae6d7..87a68df72 100644 --- a/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs +++ b/MediaBrowser.Dlna/Profiles/Xbox360Profile.cs @@ -4,6 +4,9 @@ using MediaBrowser.Model.Dlna.Profiles; namespace MediaBrowser.Dlna.Profiles { + /// <summary> + /// Good info on xbox 360 requirements: https://code.google.com/p/jems/wiki/XBox360Notes + /// </summary> [XmlRoot("Profile")] public class Xbox360Profile : DefaultProfile { @@ -11,8 +14,13 @@ namespace MediaBrowser.Dlna.Profiles { Name = "Xbox 360"; - ModelName = "Windows Media Player Sharing"; + // Required according to above + ModelName = "Windows Media Connect"; + ModelNumber = "12.0"; + + FriendlyName = "Media Browser on ${ServerName} : 1 : Windows Media Connect"; + ModelUrl = "http://www.microsoft.com/"; Manufacturer = "Microsoft Corporation"; ManufacturerUrl = "http://www.microsoft.com/"; diff --git a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml index 17100466f..588623708 100644 --- a/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml +++ b/MediaBrowser.Dlna/Profiles/Xml/Xbox 360.xml @@ -8,10 +8,10 @@ <HttpHeaderInfo name="User-Agent" value="Xenon" match="Substring" /> </Headers> </Identification> - <FriendlyName>Media Browser</FriendlyName> + <FriendlyName>Media Browser on ${ServerName} : 1 : Windows Media Connect</FriendlyName> <Manufacturer>Microsoft Corporation</Manufacturer> <ManufacturerUrl>http://www.microsoft.com/</ManufacturerUrl> - <ModelName>Windows Media Player Sharing</ModelName> + <ModelName>Windows Media Connect</ModelName> <ModelDescription>Media Browser</ModelDescription> <ModelNumber>12.0</ModelNumber> <ModelUrl>http://www.microsoft.com/</ModelUrl> diff --git a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs index ae544cb6c..824032689 100644 --- a/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs +++ b/MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs @@ -1,8 +1,10 @@ using MediaBrowser.Dlna.Common; using MediaBrowser.Model.Dlna; +using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; using System.Globalization; +using System.Linq; using System.Security; using System.Text; @@ -15,8 +17,9 @@ namespace MediaBrowser.Dlna.Server private readonly CultureInfo _usCulture = new CultureInfo("en-US"); private readonly string _serverUdn; private readonly string _serverAddress; + private readonly string _serverName; - public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress) + public DescriptionXmlBuilder(DeviceProfile profile, string serverUdn, string serverAddress, string serverName) { if (string.IsNullOrWhiteSpace(serverUdn)) { @@ -31,6 +34,7 @@ namespace MediaBrowser.Dlna.Server _profile = profile; _serverUdn = serverUdn; _serverAddress = serverAddress; + _serverName = serverName; } private bool EnableAbsoluteUrls @@ -81,7 +85,7 @@ namespace MediaBrowser.Dlna.Server builder.Append("<dlna:X_DLNADOC xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\">M-DMS-1.50</dlna:X_DLNADOC>"); builder.Append("<dlna:X_DLNADOC xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\">" + SecurityElement.Escape(_profile.XDlnaDoc ?? string.Empty) + "</dlna:X_DLNADOC>"); - builder.Append("<friendlyName>" + SecurityElement.Escape(_profile.FriendlyName ?? string.Empty) + "</friendlyName>"); + builder.Append("<friendlyName>" + SecurityElement.Escape(GetFriendlyName()) + "</friendlyName>"); builder.Append("<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>"); builder.Append("<manufacturer>" + SecurityElement.Escape(_profile.Manufacturer ?? string.Empty) + "</manufacturer>"); builder.Append("<manufacturerURL>" + SecurityElement.Escape(_profile.ManufacturerUrl ?? string.Empty) + "</manufacturerURL>"); @@ -95,7 +99,7 @@ namespace MediaBrowser.Dlna.Server if (!EnableAbsoluteUrls) { - builder.Append("<URLBase>" + SecurityElement.Escape(_serverAddress) + "</URLBase>"); + //builder.Append("<URLBase>" + SecurityElement.Escape(_serverAddress) + "</URLBase>"); } if (!string.IsNullOrWhiteSpace(_profile.SonyAggregationFlags)) @@ -104,6 +108,19 @@ namespace MediaBrowser.Dlna.Server } } + private string GetFriendlyName() + { + var name = _profile.FriendlyName ?? string.Empty; + + var characters = _serverName.Where(c => (char.IsLetterOrDigit(c) || c == '-')).ToArray(); + + var serverName = new string(characters); + + name = name.Replace("${ServerName}", serverName, StringComparison.OrdinalIgnoreCase); + + return name; + } + private void AppendIconList(StringBuilder builder) { builder.Append("<iconList>"); |
