update didl xml

This commit is contained in:
Luke Pulverenti 2016-11-06 12:30:44 -05:00
parent 6aa106f1b7
commit 1539836ca1
11 changed files with 68 additions and 51 deletions

View File

@ -232,10 +232,7 @@ namespace Emby.Dlna.ContentDirectory
writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP); writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP);
//didl.SetAttribute("xmlns:sec", NS_SEC); //didl.SetAttribute("xmlns:sec", NS_SEC);
foreach (var att in _profile.XmlRootAttributes) DidlBuilder.WriteXmlRootAttributes(_profile, writer);
{
writer.WriteAttributeString(att.Name, att.Value);
}
var serverItem = GetItemFromObjectId(id, user); var serverItem = GetItemFromObjectId(id, user);
var item = serverItem.Item; var item = serverItem.Item;
@ -282,7 +279,7 @@ namespace Emby.Dlna.ContentDirectory
} }
} }
} }
writer.WriteEndElement(); writer.WriteFullEndElement();
//writer.WriteEndDocument(); //writer.WriteEndDocument();
} }
@ -345,10 +342,7 @@ namespace Emby.Dlna.ContentDirectory
writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP); writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP);
//didl.SetAttribute("xmlns:sec", NS_SEC); //didl.SetAttribute("xmlns:sec", NS_SEC);
foreach (var att in _profile.XmlRootAttributes) DidlBuilder.WriteXmlRootAttributes(_profile, writer);
{
writer.WriteAttributeString(att.Name, att.Value);
}
var serverItem = GetItemFromObjectId(sparams["ContainerID"], user); var serverItem = GetItemFromObjectId(sparams["ContainerID"], user);
@ -375,7 +369,7 @@ namespace Emby.Dlna.ContentDirectory
} }
} }
writer.WriteEndElement(); writer.WriteFullEndElement();
//writer.WriteEndDocument(); //writer.WriteEndDocument();
} }

View File

@ -84,28 +84,39 @@ namespace Emby.Dlna.Didl
writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP); writer.WriteAttributeString("xmlns", "upnp", null, NS_UPNP);
//didl.SetAttribute("xmlns:sec", NS_SEC); //didl.SetAttribute("xmlns:sec", NS_SEC);
foreach (var att in _profile.XmlRootAttributes) WriteXmlRootAttributes(_profile, writer);
{
writer.WriteAttributeString(att.Name, att.Value);
}
WriteItemElement(options, writer, item, context, null, deviceId, filter, streamInfo); WriteItemElement(options, writer, item, context, null, deviceId, filter, streamInfo);
writer.WriteEndElement(); writer.WriteFullEndElement();
//writer.WriteEndDocument(); //writer.WriteEndDocument();
} }
return builder.ToString(); return builder.ToString();
} }
public static void WriteXmlRootAttributes(DeviceProfile profile, XmlWriter writer)
{
foreach (var att in profile.XmlRootAttributes)
{
var parts = att.Name.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
if (parts.Length == 2)
{
writer.WriteAttributeString(parts[0], parts[1], null, att.Value);
}
else
{
writer.WriteAttributeString(att.Name, att.Value);
}
}
}
public void WriteItemElement(DlnaOptions options, XmlWriter writer, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null) public void WriteItemElement(DlnaOptions options, XmlWriter writer, BaseItem item, BaseItem context, StubType? contextStubType, string deviceId, Filter filter, StreamInfo streamInfo = null)
{ {
var clientId = GetClientId(item, null); var clientId = GetClientId(item, null);
writer.WriteStartElement(string.Empty, "item", NS_DIDL); writer.WriteStartElement(string.Empty, "item", NS_DIDL);
AddGeneralProperties(item, null, context, writer, filter);
writer.WriteAttributeString("restricted", "1"); writer.WriteAttributeString("restricted", "1");
writer.WriteAttributeString("id", clientId); writer.WriteAttributeString("id", clientId);
@ -122,6 +133,8 @@ namespace Emby.Dlna.Didl
} }
} }
AddGeneralProperties(item, null, context, writer, filter);
//AddBookmarkInfo(item, user, element); //AddBookmarkInfo(item, user, element);
// refID? // refID?
@ -142,7 +155,7 @@ namespace Emby.Dlna.Didl
} }
AddCover(item, context, null, writer); AddCover(item, context, null, writer);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
private ILogger GetStreamBuilderLogger(DlnaOptions options) private ILogger GetStreamBuilderLogger(DlnaOptions options)
@ -236,7 +249,7 @@ namespace Emby.Dlna.Didl
writer.WriteAttributeString("sec", "type", null, info.Format.ToLower()); writer.WriteAttributeString("sec", "type", null, info.Format.ToLower());
writer.WriteString(info.Url); writer.WriteString(info.Url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
else if (string.Equals(subtitleMode, "smi", StringComparison.OrdinalIgnoreCase)) else if (string.Equals(subtitleMode, "smi", StringComparison.OrdinalIgnoreCase))
{ {
@ -245,7 +258,7 @@ namespace Emby.Dlna.Didl
writer.WriteAttributeString("protocolInfo", "http-get:*:smi/caption:*"); writer.WriteAttributeString("protocolInfo", "http-get:*:smi/caption:*");
writer.WriteString(info.Url); writer.WriteString(info.Url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
else else
{ {
@ -254,7 +267,7 @@ namespace Emby.Dlna.Didl
writer.WriteAttributeString("protocolInfo", protocolInfo); writer.WriteAttributeString("protocolInfo", protocolInfo);
writer.WriteString(info.Url); writer.WriteString(info.Url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
return true; return true;
@ -349,7 +362,7 @@ namespace Emby.Dlna.Didl
writer.WriteString(url); writer.WriteString(url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
private string GetDisplayName(BaseItem item, StubType? itemStubType, BaseItem context) private string GetDisplayName(BaseItem item, StubType? itemStubType, BaseItem context)
@ -479,7 +492,7 @@ namespace Emby.Dlna.Didl
writer.WriteString(url); writer.WriteString(url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
public static bool IsIdRoot(string id) public static bool IsIdRoot(string id)
@ -501,8 +514,6 @@ namespace Emby.Dlna.Didl
{ {
writer.WriteStartElement(string.Empty, "container", NS_DIDL); writer.WriteStartElement(string.Empty, "container", NS_DIDL);
AddGeneralProperties(folder, stubType, context, writer, filter);
writer.WriteAttributeString("restricted", "0"); writer.WriteAttributeString("restricted", "0");
writer.WriteAttributeString("searchable", "1"); writer.WriteAttributeString("searchable", "1");
writer.WriteAttributeString("childCount", childCount.ToString(_usCulture)); writer.WriteAttributeString("childCount", childCount.ToString(_usCulture));
@ -536,9 +547,11 @@ namespace Emby.Dlna.Didl
} }
} }
AddGeneralProperties(folder, stubType, context, writer, filter);
AddCover(folder, context, stubType, writer); AddCover(folder, context, stubType, writer);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
//private void AddBookmarkInfo(BaseItem item, User user, XmlElement element) //private void AddBookmarkInfo(BaseItem item, User user, XmlElement element)
@ -698,7 +711,7 @@ namespace Emby.Dlna.Didl
writer.WriteString("object.item"); writer.WriteString("object.item");
} }
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
private void AddPeople(BaseItem item, XmlWriter writer) private void AddPeople(BaseItem item, XmlWriter writer)
@ -811,7 +824,7 @@ namespace Emby.Dlna.Didl
writer.WriteString(name); writer.WriteString(name);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
catch (XmlException) catch (XmlException)
{ {
@ -897,7 +910,7 @@ namespace Emby.Dlna.Didl
writer.WriteStartElement("upnp", "albumArtURI", NS_UPNP); writer.WriteStartElement("upnp", "albumArtURI", NS_UPNP);
writer.WriteAttributeString("dlna", "profileID", NS_DLNA, _profile.AlbumArtPn); writer.WriteAttributeString("dlna", "profileID", NS_DLNA, _profile.AlbumArtPn);
writer.WriteString(albumartUrlInfo.Url); writer.WriteString(albumartUrlInfo.Url);
writer.WriteEndElement(); writer.WriteFullEndElement();
// TOOD: Remove these default values // TOOD: Remove these default values
var iconUrlInfo = GetImageUrl(imageInfo, _profile.MaxIconWidth ?? 48, _profile.MaxIconHeight ?? 48, playbackPercentage, unplayedCount, "jpg"); var iconUrlInfo = GetImageUrl(imageInfo, _profile.MaxIconWidth ?? 48, _profile.MaxIconHeight ?? 48, playbackPercentage, unplayedCount, "jpg");
@ -932,7 +945,7 @@ namespace Emby.Dlna.Didl
writer.WriteStartElement("upnp", "albumArtURI", NS_UPNP); writer.WriteStartElement("upnp", "albumArtURI", NS_UPNP);
writer.WriteAttributeString("dlna", "profileID", NS_DLNA, _profile.AlbumArtPn); writer.WriteAttributeString("dlna", "profileID", NS_DLNA, _profile.AlbumArtPn);
writer.WriteString(_serverAddress + "/Dlna/icons/people480.jpg"); writer.WriteString(_serverAddress + "/Dlna/icons/people480.jpg");
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteElementString("upnp", "icon", NS_UPNP, _serverAddress + "/Dlna/icons/people48.jpg"); writer.WriteElementString("upnp", "icon", NS_UPNP, _serverAddress + "/Dlna/icons/people48.jpg");
} }
@ -976,7 +989,7 @@ namespace Emby.Dlna.Didl
writer.WriteString(albumartUrlInfo.Url); writer.WriteString(albumartUrlInfo.Url);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
private ImageDownloadInfo GetImageInfo(BaseItem item) private ImageDownloadInfo GetImageInfo(BaseItem item)

View File

@ -99,12 +99,12 @@ namespace Emby.Dlna.Service
{ {
writer.WriteStartElement(i.Key); writer.WriteStartElement(i.Key);
writer.WriteString(i.Value); writer.WriteString(i.Value);
writer.WriteEndElement(); writer.WriteFullEndElement();
} }
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndDocument(); writer.WriteEndDocument();
} }

View File

@ -36,12 +36,12 @@ namespace Emby.Dlna.Service
writer.WriteStartElement("detail"); writer.WriteStartElement("detail");
writer.WriteRaw("<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\"><errorCode>401</errorCode><errorDescription>Invalid Action</errorDescription></UPnPError>"); writer.WriteRaw("<UPnPError xmlns=\"urn:schemas-upnp-org:control-1-0\"><errorCode>401</errorCode><errorDescription>Invalid Action</errorDescription></UPnPError>");
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndElement(); writer.WriteFullEndElement();
writer.WriteEndDocument(); writer.WriteEndDocument();
} }

View File

@ -33,7 +33,7 @@ namespace Emby.Server.Implementations.LiveTv
Protocol = mediaSource.Protocol, Protocol = mediaSource.Protocol,
MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video, MediaType = isAudio ? DlnaProfileType.Audio : DlnaProfileType.Video,
ExtractChapters = false, ExtractChapters = false,
AnalyzeDurationSections = 3 AnalyzeDurationSections = 2
}, cancellationToken).ConfigureAwait(false); }, cancellationToken).ConfigureAwait(false);

View File

@ -40,10 +40,6 @@ namespace MediaBrowser.Controller.Sync
/// <returns>Task&lt;Stream&gt;.</returns> /// <returns>Task&lt;Stream&gt;.</returns>
Task<Stream> GetFile(string id, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken); Task<Stream> GetFile(string id, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken);
/// <summary>
/// Gets the files.
/// </summary>
Task<QueryResult<FileSystemMetadata>> GetFiles(string id, SyncTarget target, CancellationToken cancellationToken);
Task<QueryResult<FileSystemMetadata>> GetFiles(string[] pathParts, SyncTarget target, CancellationToken cancellationToken); Task<QueryResult<FileSystemMetadata>> GetFiles(string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
Task<QueryResult<FileSystemMetadata>> GetFiles(SyncTarget target, CancellationToken cancellationToken); Task<QueryResult<FileSystemMetadata>> GetFiles(SyncTarget target, CancellationToken cancellationToken);
} }

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using MediaBrowser.Model.Diagnostics; using MediaBrowser.Model.Diagnostics;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
@ -40,9 +41,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
{ {
} }
output = output ?? string.Empty;
if (logOutput) if (logOutput)
{ {
_logger.Info("ffmpeg info: {0}", output ?? string.Empty); _logger.Info("ffmpeg info: {0}", output);
} }
if (string.IsNullOrWhiteSpace(output)) if (string.IsNullOrWhiteSpace(output))
@ -55,6 +58,17 @@ namespace MediaBrowser.MediaEncoding.Encoder
return false; return false;
} }
output = " " + output + " ";
for (var i = 2013; i <= 2015; i++)
{
var yearString = i.ToString(CultureInfo.InvariantCulture);
if (output.IndexOf(" " + yearString + " ", StringComparison.OrdinalIgnoreCase) != -1)
{
return false;
}
}
return true; return true;
} }

View File

@ -76,8 +76,8 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath> <HintPath>..\ThirdParty\SharpCompress\SharpCompress.dll</HintPath>
</Reference> </Reference>
<Reference Include="SocketHttpListener, Version=1.0.6109.26162, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SocketHttpListener, Version=1.0.6153.41639, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SocketHttpListener.1.0.0.40\lib\net45\SocketHttpListener.dll</HintPath> <HintPath>..\packages\SocketHttpListener.1.0.0.43\lib\net45\SocketHttpListener.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />

View File

@ -5,6 +5,6 @@
<package id="MediaBrowser.Naming" version="1.0.0.59" targetFramework="net46" /> <package id="MediaBrowser.Naming" version="1.0.0.59" targetFramework="net46" />
<package id="Microsoft.IO.RecyclableMemoryStream" version="1.1.0.0" targetFramework="net46" /> <package id="Microsoft.IO.RecyclableMemoryStream" version="1.1.0.0" targetFramework="net46" />
<package id="Patterns.Logging" version="1.0.0.6" targetFramework="net46" /> <package id="Patterns.Logging" version="1.0.0.6" targetFramework="net46" />
<package id="SocketHttpListener" version="1.0.0.40" targetFramework="net45" /> <package id="SocketHttpListener" version="1.0.0.43" targetFramework="net46" />
<package id="UniversalDetector" version="1.0.1" targetFramework="net46" /> <package id="UniversalDetector" version="1.0.1" targetFramework="net46" />
</packages> </packages>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Common</id> <id>MediaBrowser.Common</id>
<version>3.0.683</version> <version>3.0.684</version>
<title>Emby.Common</title> <title>Emby.Common</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>

View File

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata> <metadata>
<id>MediaBrowser.Server.Core</id> <id>MediaBrowser.Server.Core</id>
<version>3.0.683</version> <version>3.0.684</version>
<title>Emby.Server.Core</title> <title>Emby.Server.Core</title>
<authors>Emby Team</authors> <authors>Emby Team</authors>
<owners>ebr,Luke,scottisafool</owners> <owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Emby Server.</description> <description>Contains core components required to build plugins for Emby Server.</description>
<copyright>Copyright © Emby 2013</copyright> <copyright>Copyright © Emby 2013</copyright>
<dependencies> <dependencies>
<dependency id="MediaBrowser.Common" version="3.0.683" /> <dependency id="MediaBrowser.Common" version="3.0.684" />
</dependencies> </dependencies>
</metadata> </metadata>
<files> <files>