make dlna protocol optional

This commit is contained in:
Luke Pulverenti 2015-05-11 22:32:37 -04:00
parent 46c7db39ca
commit 9307d515e6

View File

@ -54,11 +54,14 @@ namespace MediaBrowser.Dlna.Server
var attributes = _profile.XmlRootAttributes.ToList();
attributes.Insert(0, new XmlAttribute
if (_profile.EnableDlnaProtocol)
{
Name = "xmlns:dlna",
Value = "urn:schemas-dlna-org:device-1-0"
});
attributes.Insert(0, new XmlAttribute
{
Name = "xmlns:dlna",
Value = "urn:schemas-dlna-org:device-1-0"
});
}
attributes.Insert(0, new XmlAttribute
{
Name = "xmlns",
@ -89,27 +92,32 @@ namespace MediaBrowser.Dlna.Server
builder.Append("<device>");
AppendDeviceProperties(builder);
AppendIconList(builder);
if (_profile.EnableDlnaProtocol)
{
AppendIconList(builder);
}
AppendServiceList(builder);
builder.Append("</device>");
}
private void AppendDeviceProperties(StringBuilder builder)
{
builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverUdn) + "</UDN>");
builder.Append("<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>");
builder.Append("<dlna:X_DLNACAP>" + SecurityElement.Escape(_profile.XDlnaCap ?? string.Empty) + "</dlna:X_DLNACAP>");
if (_profile.EnableDlnaProtocol)
{
builder.Append("<dlna:X_DLNACAP>" + SecurityElement.Escape(_profile.XDlnaCap ?? string.Empty) + "</dlna:X_DLNACAP>");
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("<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(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>");
builder.Append("<modelName>" + SecurityElement.Escape(_profile.ModelName ?? string.Empty) + "</modelName>");
builder.Append("<modelDescription>" + SecurityElement.Escape(_profile.ModelDescription ?? string.Empty) + "</modelDescription>");
builder.Append("<modelName>" + SecurityElement.Escape(_profile.ModelName ?? string.Empty) + "</modelName>");
builder.Append("<modelNumber>" + SecurityElement.Escape(_profile.ModelNumber ?? string.Empty) + "</modelNumber>");
builder.Append("<modelURL>" + SecurityElement.Escape(_profile.ModelUrl ?? string.Empty) + "</modelURL>");
@ -123,6 +131,7 @@ namespace MediaBrowser.Dlna.Server
builder.Append("<serialNumber>" + SecurityElement.Escape(_profile.SerialNumber) + "</serialNumber>");
}
builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverUdn) + "</UDN>");
builder.Append("<presentationURL>" + SecurityElement.Escape(_serverAddress) + "</presentationURL>");
if (!EnableAbsoluteUrls)