|
|
|
@ -16,9 +16,10 @@ using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
|
|
|
|
|
using MediaBrowser.Controller.Extensions;
|
|
|
|
|
using MediaBrowser.Model.Extensions;
|
|
|
|
|
using MediaBrowser.Model.IO;
|
|
|
|
|
using MediaBrowser.Model.Xml;
|
|
|
|
@ -353,7 +354,8 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(stream.Language))
|
|
|
|
|
{
|
|
|
|
|
writer.WriteElementString("language", stream.Language);
|
|
|
|
|
// https://emby.media/community/index.php?/topic/49071-nfo-not-generated-on-actualize-or-rescan-or-identify
|
|
|
|
|
writer.WriteElementString("language", RemoveInvalidXMLChars(stream.Language));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var scanType = stream.IsInterlaced ? "interlaced" : "progressive";
|
|
|
|
@ -422,6 +424,19 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|
|
|
|
writer.WriteEndElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// filters control characters but allows only properly-formed surrogate sequences
|
|
|
|
|
private static Regex _invalidXMLChars = new Regex(
|
|
|
|
|
@"(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F\uFEFF\uFFFE\uFFFF]");
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// removes any unusual unicode characters that can't be encoded into XML
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static string RemoveInvalidXMLChars(string text)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(text)) return string.Empty;
|
|
|
|
|
return _invalidXMLChars.Replace(text, string.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public const string DateAddedFormat = "yyyy-MM-dd HH:mm:ss";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|