fixes #365 - Overwriting 3rd-party XML values
This commit is contained in:
parent
08eec872a5
commit
12c6bc27f2
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -80,7 +80,13 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new[]
|
||||
{
|
||||
"FirstAired",
|
||||
"SeasonNumber",
|
||||
"EpisodeNumber",
|
||||
"EpisodeName"
|
||||
});
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
EpisodeProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
MovieProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -92,7 +92,15 @@ namespace MediaBrowser.Providers.Savers
|
|||
|
||||
var xmlFilePath = GetSavePath(item);
|
||||
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
||||
XmlSaverHelpers.Save(builder, xmlFilePath, new[]
|
||||
{
|
||||
"id",
|
||||
"SeriesName",
|
||||
"Status",
|
||||
"Network",
|
||||
"Airs_Time",
|
||||
"Airs_DayOfWeek"
|
||||
});
|
||||
|
||||
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||
SeriesProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
|
@ -25,8 +27,55 @@ namespace MediaBrowser.Providers.Savers
|
|||
/// </summary>
|
||||
/// <param name="xml">The XML.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
public static void Save(StringBuilder xml, string path)
|
||||
/// <param name="xmlTagsUsed">The XML tags used.</param>
|
||||
public static void Save(StringBuilder xml, string path, IEnumerable<string> xmlTagsUsed)
|
||||
{
|
||||
if (File.Exists(path))
|
||||
{
|
||||
var tags = xmlTagsUsed.ToList();
|
||||
|
||||
tags.AddRange(new[]
|
||||
{
|
||||
"MediaInfo",
|
||||
"ContentRating",
|
||||
"MPAARating",
|
||||
"certification",
|
||||
"Persons",
|
||||
"Type",
|
||||
"Overview",
|
||||
"CustomRating",
|
||||
"LocalTitle",
|
||||
"SortTitle",
|
||||
"PremiereDate",
|
||||
"Budget",
|
||||
"Revenue",
|
||||
"Rating",
|
||||
"ProductionYear",
|
||||
"Website",
|
||||
"AspectRatio",
|
||||
"Language",
|
||||
"RunningTime",
|
||||
"Runtime",
|
||||
"TagLine",
|
||||
"TagLines",
|
||||
"IMDB_ID",
|
||||
"IMDB",
|
||||
"IMDbId",
|
||||
"TMDbId",
|
||||
"TVcomId",
|
||||
"RottenTomatoesId",
|
||||
"MusicbrainzId",
|
||||
"CollectionNumber",
|
||||
"Genres",
|
||||
"Studios",
|
||||
"Tags",
|
||||
"Added"
|
||||
});
|
||||
|
||||
var position = xml.ToString().LastIndexOf("</", StringComparison.OrdinalIgnoreCase);
|
||||
xml.Insert(position, GetCustomTags(path, tags));
|
||||
}
|
||||
|
||||
var xmlDocument = new XmlDocument();
|
||||
xmlDocument.LoadXml(xml.ToString());
|
||||
|
||||
|
@ -46,6 +95,25 @@ namespace MediaBrowser.Providers.Savers
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the custom tags.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="xmlTagsUsed">The XML tags used.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
private static string GetCustomTags(string path, ICollection<string> xmlTagsUsed)
|
||||
{
|
||||
var doc = new XmlDocument();
|
||||
doc.Load(path);
|
||||
|
||||
var nodes = doc.DocumentElement.ChildNodes.Cast<XmlNode>()
|
||||
.Where(i => !xmlTagsUsed.Contains(i.Name))
|
||||
.Select(i => i.OuterXml)
|
||||
.ToArray();
|
||||
|
||||
return string.Join(Environment.NewLine, nodes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the common nodes.
|
||||
/// </summary>
|
||||
|
@ -105,7 +173,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
{
|
||||
builder.Append("<PremiereDate>" + SecurityElement.Escape(item.PremiereDate.Value.ToString("yyyy-MM-dd")) + "</PremiereDate>");
|
||||
}
|
||||
|
||||
|
||||
if (item.Budget.HasValue)
|
||||
{
|
||||
builder.Append("<Budget>" + SecurityElement.Escape(item.Budget.Value.ToString(UsCulture)) + "</Budget>");
|
||||
|
@ -125,7 +193,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
{
|
||||
builder.Append("<ProductionYear>" + SecurityElement.Escape(item.ProductionYear.Value.ToString(UsCulture)) + "</ProductionYear>");
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(item.HomePageUrl))
|
||||
{
|
||||
builder.Append("<Website>" + SecurityElement.Escape(item.HomePageUrl) + "</Website>");
|
||||
|
@ -148,7 +216,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
builder.Append("<RunningTime>" + Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture) + "</RunningTime>");
|
||||
builder.Append("<Runtime>" + Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture) + "</Runtime>");
|
||||
}
|
||||
|
||||
|
||||
if (item.Taglines.Count > 0)
|
||||
{
|
||||
builder.Append("<TagLine>" + SecurityElement.Escape(item.Taglines[0]) + "</TagLine>");
|
||||
|
@ -199,7 +267,7 @@ namespace MediaBrowser.Providers.Savers
|
|||
{
|
||||
builder.Append("<MusicbrainzId>" + SecurityElement.Escape(mbz) + "</MusicbrainzId>");
|
||||
}
|
||||
|
||||
|
||||
var tmdbCollection = item.GetProviderId(MetadataProviders.TmdbCollection);
|
||||
|
||||
if (!string.IsNullOrEmpty(tmdbCollection))
|
||||
|
|
|
@ -126,23 +126,8 @@
|
|||
<Reference Include="MahApps.Metro">
|
||||
<HintPath>..\packages\MahApps.Metro.0.11.0.17-ALPHA\lib\net45\MahApps.Metro.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MediaBrowser.Common, Version=3.0.4912.27515, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MediaBrowser.Common.3.0.123\lib\net45\MediaBrowser.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MediaBrowser.IsoMounter, Version=1.0.4917.10402, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.53\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MediaBrowser.Model, Version=3.0.4912.27515, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MediaBrowser.Common.3.0.123\lib\net45\MediaBrowser.Model.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net45\Microsoft.Threading.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Threading.Tasks.Extensions">
|
||||
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net45\Microsoft.Threading.Tasks.Extensions.dll</HintPath>
|
||||
<Reference Include="MediaBrowser.IsoMounter">
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MoreLinq, Version=1.0.15631.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
@ -152,9 +137,8 @@
|
|||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\NLog.2.0.1.2\lib\net45\NLog.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="pfmclrapi, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.53\lib\net45\pfmclrapi.dll</HintPath>
|
||||
<Reference Include="pfmclrapi">
|
||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\pfmclrapi.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ServiceStack, Version=3.9.54.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
|
@ -298,10 +282,18 @@
|
|||
<Project>{c4d2573a-3fd3-441f-81af-174ac4cd4e1d}</Project>
|
||||
<Name>MediaBrowser.Common.Implementations</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Common\MediaBrowser.Common.csproj">
|
||||
<Project>{9142eefa-7570-41e1-bfcc-468bb571af2f}</Project>
|
||||
<Name>MediaBrowser.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
|
||||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||
<Name>MediaBrowser.Controller</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Model\MediaBrowser.Model.csproj">
|
||||
<Project>{7eeeb4bb-f3e8-48fc-b4c5-70f0fff8329b}</Project>
|
||||
<Name>MediaBrowser.Model</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\MediaBrowser.Providers\MediaBrowser.Providers.csproj">
|
||||
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
|
||||
<Name>MediaBrowser.Providers</Name>
|
||||
|
@ -430,5 +422,4 @@ del "$(SolutionDir)..\Deploy\MBServer.zip"
|
|||
</GetAssemblyIdentity>
|
||||
<Exec Command="copy "$(SolutionDir)..\Deploy\MBServer.zip" "$(SolutionDir)..\Deploy\MBServer_%(CurrentAssembly.Version).zip" /y" Condition="'$(ConfigurationName)' == 'Release'" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" />
|
||||
</Project>
|
|
@ -3,11 +3,7 @@
|
|||
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
|
||||
<package id="Hardcodet.Wpf.TaskbarNotification" version="1.0.4.0" targetFramework="net45" />
|
||||
<package id="MahApps.Metro" version="0.11.0.17-ALPHA" targetFramework="net45" />
|
||||
<package id="MediaBrowser.Common" version="3.0.123" targetFramework="net45" />
|
||||
<package id="MediaBrowser.IsoMounting" version="3.0.53" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl" version="1.0.19" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net45" />
|
||||
<package id="Microsoft.Bcl.Build" version="1.0.7" targetFramework="net45" />
|
||||
<package id="MediaBrowser.IsoMounting" version="3.0.55" targetFramework="net45" />
|
||||
<package id="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
||||
<package id="NLog" version="2.0.1.2" targetFramework="net45" />
|
||||
<package id="ServiceStack" version="3.9.54" targetFramework="net45" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user