|
|
@ -18,8 +18,9 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
private readonly string _serverUdn;
|
|
|
|
private readonly string _serverUdn;
|
|
|
|
private readonly string _serverAddress;
|
|
|
|
private readonly string _serverAddress;
|
|
|
|
private readonly string _serverName;
|
|
|
|
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))
|
|
|
|
if (string.IsNullOrWhiteSpace(serverUdn))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -35,6 +36,7 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
_serverUdn = serverUdn;
|
|
|
|
_serverUdn = serverUdn;
|
|
|
|
_serverAddress = serverAddress;
|
|
|
|
_serverAddress = serverAddress;
|
|
|
|
_serverName = serverName;
|
|
|
|
_serverName = serverName;
|
|
|
|
|
|
|
|
_serverId = serverId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private bool EnableAbsoluteUrls
|
|
|
|
private bool EnableAbsoluteUrls
|
|
|
@ -48,7 +50,7 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
|
|
|
|
|
|
|
|
builder.Append("<?xml version=\"1.0\"?>");
|
|
|
|
builder.Append("<?xml version=\"1.0\"?>");
|
|
|
|
|
|
|
|
|
|
|
|
builder.Append("<root xmlns=\"urn:schemas-upnp-org:device-1-0\" xmlns:dlna=\"urn:schemas-dlna-org:device-1-0\"");
|
|
|
|
builder.Append("<root");
|
|
|
|
foreach (var att in _profile.XmlRootAttributes)
|
|
|
|
foreach (var att in _profile.XmlRootAttributes)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
builder.AppendFormat(" {0}=\"{1}\"", att.Name, att.Value);
|
|
|
|
builder.AppendFormat(" {0}=\"{1}\"", att.Name, att.Value);
|
|
|
@ -72,7 +74,7 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
builder.Append("<device>");
|
|
|
|
builder.Append("<device>");
|
|
|
|
AppendDeviceProperties(builder);
|
|
|
|
AppendDeviceProperties(builder);
|
|
|
|
|
|
|
|
|
|
|
|
AppendIconList(builder);
|
|
|
|
//AppendIconList(builder);
|
|
|
|
AppendServiceList(builder);
|
|
|
|
AppendServiceList(builder);
|
|
|
|
builder.Append("</device>");
|
|
|
|
builder.Append("</device>");
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -80,7 +82,11 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
private void AppendDeviceProperties(StringBuilder builder)
|
|
|
|
private void AppendDeviceProperties(StringBuilder builder)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverUdn) + "</UDN>");
|
|
|
|
builder.Append("<UDN>uuid:" + SecurityElement.Escape(_serverUdn) + "</UDN>");
|
|
|
|
builder.Append("<dlna:X_DLNACAP>" + SecurityElement.Escape(_profile.XDlnaCap ?? string.Empty) + "</dlna:X_DLNACAP>");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_profile.XDlnaCap))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
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\">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\">" + SecurityElement.Escape(_profile.XDlnaDoc ?? string.Empty) + "</dlna:X_DLNADOC>");
|
|
|
@ -90,10 +96,23 @@ namespace MediaBrowser.Dlna.Server
|
|
|
|
builder.Append("<manufacturer>" + SecurityElement.Escape(_profile.Manufacturer ?? string.Empty) + "</manufacturer>");
|
|
|
|
builder.Append("<manufacturer>" + SecurityElement.Escape(_profile.Manufacturer ?? string.Empty) + "</manufacturer>");
|
|
|
|
builder.Append("<manufacturerURL>" + SecurityElement.Escape(_profile.ManufacturerUrl ?? string.Empty) + "</manufacturerURL>");
|
|
|
|
builder.Append("<manufacturerURL>" + SecurityElement.Escape(_profile.ManufacturerUrl ?? string.Empty) + "</manufacturerURL>");
|
|
|
|
builder.Append("<modelName>" + SecurityElement.Escape(_profile.ModelName ?? string.Empty) + "</modelName>");
|
|
|
|
builder.Append("<modelName>" + SecurityElement.Escape(_profile.ModelName ?? string.Empty) + "</modelName>");
|
|
|
|
builder.Append("<modelDescription>" + SecurityElement.Escape(_profile.ModelDescription ?? string.Empty) + "</modelDescription>");
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_profile.ModelDescription))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
builder.Append("<modelDescription>" + SecurityElement.Escape(_profile.ModelDescription ?? string.Empty) + "</modelDescription>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
builder.Append("<modelNumber>" + SecurityElement.Escape(_profile.ModelNumber ?? string.Empty) + "</modelNumber>");
|
|
|
|
builder.Append("<modelNumber>" + SecurityElement.Escape(_profile.ModelNumber ?? string.Empty) + "</modelNumber>");
|
|
|
|
builder.Append("<modelURL>" + SecurityElement.Escape(_profile.ModelUrl ?? string.Empty) + "</modelURL>");
|
|
|
|
builder.Append("<modelURL>" + SecurityElement.Escape(_profile.ModelUrl ?? string.Empty) + "</modelURL>");
|
|
|
|
builder.Append("<serialNumber>" + SecurityElement.Escape(_profile.SerialNumber ?? string.Empty) + "</serialNumber>");
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(_profile.SerialNumber))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
builder.Append("<serialNumber>" + SecurityElement.Escape(_serverId) + "</serialNumber>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
builder.Append("<serialNumber>" + SecurityElement.Escape(_profile.SerialNumber) + "</serialNumber>");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
builder.Append("<presentationURL>" + SecurityElement.Escape(_serverAddress) + "</presentationURL>");
|
|
|
|
builder.Append("<presentationURL>" + SecurityElement.Escape(_serverAddress) + "</presentationURL>");
|
|
|
|
|
|
|
|
|
|
|
|