Skip to content

Commit

Permalink
fix xbox one, ps4 not seeing dlna server
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Feb 16, 2016
1 parent f621119 commit e2ac150
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 24 deletions.
4 changes: 3 additions & 1 deletion MediaBrowser.Dlna/DlnaManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ public string GetServerDescriptionXml(IDictionary<string, string> headers, strin
var profile = GetProfile(headers) ??
GetDefaultProfile();

return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName, serverUuId.GetMD5().ToString("N")).GetXml();
var serverId = _appHost.SystemId;

return new DescriptionXmlBuilder(profile, serverUuId, serverAddress, _appHost.FriendlyName, serverId).GetXml();
}

public ImageStream GetIcon(string filename)
Expand Down
12 changes: 6 additions & 6 deletions MediaBrowser.Dlna/Main/DlnaEntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ private void RegisterServerEndpoints()
//}

var addressString = address.ToString();
var guid = addressString.GetMD5();
var udn = addressString.GetMD5().ToString("N");

var descriptorURI = "/dlna/" + guid.ToString("N") + "/description.xml";
var descriptorURI = "/dlna/" + udn + "/description.xml";

var uri = new Uri(_appHost.GetLocalApiUrl(addressString) + descriptorURI);

Expand All @@ -170,12 +170,12 @@ private void RegisterServerEndpoints()
"urn:schemas-upnp-org:service:ContentDirectory:1",
"urn:schemas-upnp-org:service:ConnectionManager:1",
"urn:microsoft.com:service:X_MS_MediaReceiverRegistrar:1",
"uuid:" + guid.ToString("N")
"uuid:" + udn
};

_ssdpHandler.RegisterNotification(guid, uri, address, services);
_ssdpHandler.RegisterNotification(udn, uri, address, services);

_registeredServerIds.Add(guid.ToString("N"));
_registeredServerIds.Add(udn);
}
}

Expand Down Expand Up @@ -240,7 +240,7 @@ public void DisposeDlnaServer()
{
try
{
_ssdpHandler.UnregisterNotification(new Guid(id));
_ssdpHandler.UnregisterNotification(id);
}
catch (Exception ex)
{
Expand Down
2 changes: 1 addition & 1 deletion MediaBrowser.Dlna/Server/DescriptionXmlBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void AppendDeviceProperties(StringBuilder builder)
builder.Append("<serialNumber>" + SecurityElement.Escape(_profile.SerialNumber) + "</serialNumber>");
}

builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverId) + "</UDN>");
builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverUdn) + "</UDN>");
builder.Append("<presentationURL>" + SecurityElement.Escape(_serverAddress) + "</presentationURL>");

if (!EnableAbsoluteUrls)
Expand Down
6 changes: 3 additions & 3 deletions MediaBrowser.Dlna/Server/UpnpDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ public sealed class UpnpDevice
public readonly Uri Descriptor;
public readonly string Type;
public readonly string USN;
public readonly Guid Uuid;
public readonly string Uuid;
public readonly IPAddress Address;

public UpnpDevice(Guid aUuid, string aType, Uri aDescriptor, IPAddress address)
public UpnpDevice(string aUuid, string aType, Uri aDescriptor, IPAddress address)
{
Uuid = aUuid;
Type = aType;
Expand All @@ -25,7 +25,7 @@ public UpnpDevice(Guid aUuid, string aType, Uri aDescriptor, IPAddress address)
}
else
{
USN = String.Format("uuid:{0}::{1}", Uuid.ToString("N"), Type);
USN = String.Format("uuid:{0}::{1}", Uuid, Type);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions MediaBrowser.Dlna/Ssdp/SsdpHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class SsdpHandler : IDisposable, ISsdpHandler
private Timer _notificationTimer;

private bool _isDisposed;
private readonly ConcurrentDictionary<Guid, List<UpnpDevice>> _devices = new ConcurrentDictionary<Guid, List<UpnpDevice>>();
private readonly ConcurrentDictionary<string, List<UpnpDevice>> _devices = new ConcurrentDictionary<string, List<UpnpDevice>>();

private readonly IApplicationHost _appHost;

Expand Down Expand Up @@ -451,7 +451,7 @@ private void NotifyDevice(UpnpDevice dev, string type, bool logMessage)
SendDatagram(msg, _ssdpEndp, new IPEndPoint(dev.Address, 0), true);
}

public void RegisterNotification(Guid uuid, Uri descriptionUri, IPAddress address, IEnumerable<string> services)
public void RegisterNotification(string uuid, Uri descriptionUri, IPAddress address, IEnumerable<string> services)
{
var list = _devices.GetOrAdd(uuid, new List<UpnpDevice>());

Expand All @@ -461,7 +461,7 @@ public void RegisterNotification(Guid uuid, Uri descriptionUri, IPAddress addres
_logger.Debug("Registered mount {0} at {1}", uuid, descriptionUri);
}

public void UnregisterNotification(Guid uuid)
public void UnregisterNotification(string uuid)
{
List<UpnpDevice> dl;
if (_devices.TryRemove(uuid, out dl))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void FilterResponse(IRequest req, IResponse res, object dto)
if (!hasOptions.Options.ContainsKey("Server"))
{
hasOptions.Options["Server"] = "Mono-HTTPAPI/1.1, UPnP/1.0 DLNADOC/1.50";
//hasOptions.Options["Server"] = "Mono-HTTPAPI/1.1";
}

// Content length has to be explicitly set on on HttpListenerResponse or it won't be happy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
},
"devDependencies": {},
"ignore": [],
"version": "1.0.82",
"_release": "1.0.82",
"version": "1.0.83",
"_release": "1.0.83",
"_resolution": {
"type": "version",
"tag": "1.0.82",
"commit": "87ca65dd008946b330945c0c1adcaf3b6337c1d2"
"tag": "1.0.83",
"commit": "2d07f1da3ed23cf12b40ed2639e42dd737eb83fd"
},
"_source": "git://github.com/MediaBrowser/emby-webcomponents.git",
"_target": "~1.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
.docspinner {
margin-top: -5vh;
margin-left: -5vh;
width: 10vh;
height: 10vh;
margin-top: -4vh;
margin-left: -4vh;
width: 8vh;
height: 8vh;
position: fixed;
top: 50%;
left: 50%;
z-index: 9999999;
}

.docspinner.tv {
margin-top: -5vh;
margin-left: -5vh;
width: 10vh;
height: 10vh;
}

.loadingHide {
display: none !important;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define(['paper-spinner', 'css!./loading'], function () {
define(['layoutManager', 'paper-spinner', 'css!./loading'], function (layoutManager) {

return {
show: function () {
Expand All @@ -9,6 +9,10 @@ define(['paper-spinner', 'css!./loading'], function () {
elem = document.createElement("paper-spinner");
elem.classList.add('docspinner');

if (layoutManager.tv) {
elem.classList.add('tv');
}

document.body.appendChild(elem);
}

Expand Down

0 comments on commit e2ac150

Please sign in to comment.