mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
fixes #365 - Overwriting 3rd-party XML values
This commit is contained in:
parent
08eec872a5
commit
12c6bc27f2
10 changed files with 107 additions and 38 deletions
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -80,7 +80,13 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
EpisodeProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
EpisodeProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
var xmlFilePath = GetSavePath(item);
|
||||||
|
|
||||||
XmlSaverHelpers.Save(builder, xmlFilePath);
|
XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
MovieProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
MovieProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
PersonProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -92,7 +92,15 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
var xmlFilePath = GetSavePath(item);
|
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
|
// Set last refreshed so that the provider doesn't trigger after the file save
|
||||||
SeriesProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
SeriesProviderFromXml.Current.SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
|
@ -2,8 +2,10 @@
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
@ -25,8 +27,55 @@ namespace MediaBrowser.Providers.Savers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="xml">The XML.</param>
|
/// <param name="xml">The XML.</param>
|
||||||
/// <param name="path">The path.</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();
|
var xmlDocument = new XmlDocument();
|
||||||
xmlDocument.LoadXml(xml.ToString());
|
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>
|
/// <summary>
|
||||||
/// Adds the common nodes.
|
/// Adds the common nodes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -126,23 +126,8 @@
|
||||||
<Reference Include="MahApps.Metro">
|
<Reference Include="MahApps.Metro">
|
||||||
<HintPath>..\packages\MahApps.Metro.0.11.0.17-ALPHA\lib\net45\MahApps.Metro.dll</HintPath>
|
<HintPath>..\packages\MahApps.Metro.0.11.0.17-ALPHA\lib\net45\MahApps.Metro.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="MediaBrowser.Common, Version=3.0.4912.27515, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="MediaBrowser.IsoMounter">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\MediaBrowser.IsoMounter.dll</HintPath>
|
||||||
<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>
|
</Reference>
|
||||||
<Reference Include="MoreLinq, Version=1.0.15631.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
<Reference Include="MoreLinq, Version=1.0.15631.0, Culture=neutral, PublicKeyToken=384d532d7e88985d, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
@ -152,9 +137,8 @@
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\NLog.2.0.1.2\lib\net45\NLog.dll</HintPath>
|
<HintPath>..\packages\NLog.2.0.1.2\lib\net45\NLog.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="pfmclrapi, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
<Reference Include="pfmclrapi">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.55\lib\net45\pfmclrapi.dll</HintPath>
|
||||||
<HintPath>..\packages\MediaBrowser.IsoMounting.3.0.53\lib\net45\pfmclrapi.dll</HintPath>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="ServiceStack, Version=3.9.54.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="ServiceStack, Version=3.9.54.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
@ -298,10 +282,18 @@
|
||||||
<Project>{c4d2573a-3fd3-441f-81af-174ac4cd4e1d}</Project>
|
<Project>{c4d2573a-3fd3-441f-81af-174ac4cd4e1d}</Project>
|
||||||
<Name>MediaBrowser.Common.Implementations</Name>
|
<Name>MediaBrowser.Common.Implementations</Name>
|
||||||
</ProjectReference>
|
</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">
|
<ProjectReference Include="..\MediaBrowser.Controller\MediaBrowser.Controller.csproj">
|
||||||
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
<Project>{17e1f4e6-8abd-4fe5-9ecf-43d4b6087ba2}</Project>
|
||||||
<Name>MediaBrowser.Controller</Name>
|
<Name>MediaBrowser.Controller</Name>
|
||||||
</ProjectReference>
|
</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">
|
<ProjectReference Include="..\MediaBrowser.Providers\MediaBrowser.Providers.csproj">
|
||||||
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
|
<Project>{442b5058-dcaf-4263-bb6a-f21e31120a1b}</Project>
|
||||||
<Name>MediaBrowser.Providers</Name>
|
<Name>MediaBrowser.Providers</Name>
|
||||||
|
@ -430,5 +422,4 @@ del "$(SolutionDir)..\Deploy\MBServer.zip"
|
||||||
</GetAssemblyIdentity>
|
</GetAssemblyIdentity>
|
||||||
<Exec Command="copy "$(SolutionDir)..\Deploy\MBServer.zip" "$(SolutionDir)..\Deploy\MBServer_%(CurrentAssembly.Version).zip" /y" Condition="'$(ConfigurationName)' == 'Release'" />
|
<Exec Command="copy "$(SolutionDir)..\Deploy\MBServer.zip" "$(SolutionDir)..\Deploy\MBServer_%(CurrentAssembly.Version).zip" /y" Condition="'$(ConfigurationName)' == 'Release'" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.7\tools\Microsoft.Bcl.Build.targets" />
|
|
||||||
</Project>
|
</Project>
|
|
@ -3,11 +3,7 @@
|
||||||
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
|
<package id="DotNetZip" version="1.9.1.8" targetFramework="net45" />
|
||||||
<package id="Hardcodet.Wpf.TaskbarNotification" version="1.0.4.0" 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="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.55" 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="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
<package id="morelinq" version="1.0.15631-beta" targetFramework="net45" />
|
||||||
<package id="NLog" version="2.0.1.2" targetFramework="net45" />
|
<package id="NLog" version="2.0.1.2" targetFramework="net45" />
|
||||||
<package id="ServiceStack" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack" version="3.9.54" targetFramework="net45" />
|
||||||
|
|
Loading…
Reference in a new issue