mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 09:59:06 -07:00
make nfo project portable
This commit is contained in:
parent
b30c58f825
commit
21be035df0
@ -452,6 +452,7 @@
|
|||||||
<Compile Include="Users\UserAction.cs" />
|
<Compile Include="Users\UserAction.cs" />
|
||||||
<Compile Include="Users\UserActionType.cs" />
|
<Compile Include="Users\UserActionType.cs" />
|
||||||
<Compile Include="Users\UserPolicy.cs" />
|
<Compile Include="Users\UserPolicy.cs" />
|
||||||
|
<Compile Include="Xml\IXmlReaderSettingsFactory.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
9
MediaBrowser.Model/Xml/IXmlReaderSettingsFactory.cs
Normal file
9
MediaBrowser.Model/Xml/IXmlReaderSettingsFactory.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Model.Xml
|
||||||
|
{
|
||||||
|
public interface IXmlReaderSettingsFactory
|
||||||
|
{
|
||||||
|
XmlReaderSettings Create(bool enableValidation);
|
||||||
|
}
|
||||||
|
}
|
@ -363,6 +363,7 @@
|
|||||||
<Compile Include="TV\TVSeriesManager.cs" />
|
<Compile Include="TV\TVSeriesManager.cs" />
|
||||||
<Compile Include="Udp\UdpMessageReceivedEventArgs.cs" />
|
<Compile Include="Udp\UdpMessageReceivedEventArgs.cs" />
|
||||||
<Compile Include="Udp\UdpServer.cs" />
|
<Compile Include="Udp\UdpServer.cs" />
|
||||||
|
<Compile Include="Xml\XmlReaderSettingsFactory.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\MediaBrowser.Common.Implementations\MediaBrowser.Common.Implementations.csproj">
|
<ProjectReference Include="..\MediaBrowser.Common.Implementations\MediaBrowser.Common.Implementations.csproj">
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Xml
|
||||||
|
{
|
||||||
|
public class XmlReaderSettingsFactory : IXmlReaderSettingsFactory
|
||||||
|
{
|
||||||
|
public XmlReaderSettings Create(bool enableValidation)
|
||||||
|
{
|
||||||
|
var settings = new XmlReaderSettings();
|
||||||
|
|
||||||
|
if (!enableValidation)
|
||||||
|
{
|
||||||
|
settings.ValidationType = ValidationType.None;
|
||||||
|
}
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -113,6 +113,8 @@ using MediaBrowser.Model.Net;
|
|||||||
using MediaBrowser.Model.News;
|
using MediaBrowser.Model.News;
|
||||||
using MediaBrowser.Model.Serialization;
|
using MediaBrowser.Model.Serialization;
|
||||||
using MediaBrowser.Model.Social;
|
using MediaBrowser.Model.Social;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
using MediaBrowser.Server.Implementations.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.Server.Startup.Common
|
namespace MediaBrowser.Server.Startup.Common
|
||||||
{
|
{
|
||||||
@ -631,6 +633,8 @@ namespace MediaBrowser.Server.Startup.Common
|
|||||||
|
|
||||||
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
RegisterSingleInstance<IBlurayExaminer>(() => new BdInfoExaminer());
|
||||||
|
|
||||||
|
RegisterSingleInstance<IXmlReaderSettingsFactory>(new XmlReaderSettingsFactory());
|
||||||
|
|
||||||
UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager);
|
UserDataManager = new UserDataManager(LogManager, ServerConfigurationManager);
|
||||||
RegisterSingleInstance(UserDataManager);
|
RegisterSingleInstance(UserDataManager);
|
||||||
|
|
||||||
|
@ -9,10 +9,11 @@
|
|||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>MediaBrowser.XbmcMetadata</RootNamespace>
|
<RootNamespace>MediaBrowser.XbmcMetadata</RootNamespace>
|
||||||
<AssemblyName>MediaBrowser.XbmcMetadata</AssemblyName>
|
<AssemblyName>MediaBrowser.XbmcMetadata</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
|
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||||
<TargetFrameworkProfile />
|
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
|
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@ -35,13 +36,6 @@
|
|||||||
<Reference Include="Patterns.Logging">
|
<Reference Include="Patterns.Logging">
|
||||||
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
|
<HintPath>..\packages\Patterns.Logging.1.0.0.2\lib\portable-net45+sl4+wp71+win8+wpa81\Patterns.Logging.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
|
||||||
<Reference Include="System.Core" />
|
|
||||||
<Reference Include="System.Xml.Linq" />
|
|
||||||
<Reference Include="System.Data.DataSetExtensions" />
|
|
||||||
<Reference Include="Microsoft.CSharp" />
|
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="..\SharedVersion.cs">
|
<Compile Include="..\SharedVersion.cs">
|
||||||
@ -88,7 +82,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
|
@ -15,6 +15,8 @@ using System.Text;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
@ -25,7 +27,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// The logger
|
/// The logger
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected ILogger Logger { get; private set; }
|
protected ILogger Logger { get; private set; }
|
||||||
|
protected IFileSystem FileSystem { get; private set; }
|
||||||
protected IProviderManager ProviderManager { get; private set; }
|
protected IProviderManager ProviderManager { get; private set; }
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
@ -34,13 +38,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="BaseNfoParser{T}" /> class.
|
/// Initializes a new instance of the <see cref="BaseNfoParser{T}" /> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logger">The logger.</param>
|
public BaseNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
/// <param name="config">The configuration.</param>
|
|
||||||
public BaseNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
ProviderManager = providerManager;
|
ProviderManager = providerManager;
|
||||||
|
FileSystem = fileSystem;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -63,15 +67,13 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
throw new ArgumentNullException();
|
throw new ArgumentNullException();
|
||||||
}
|
}
|
||||||
|
|
||||||
var settings = new XmlReaderSettings
|
var settings = XmlReaderSettingsFactory.Create(false);
|
||||||
{
|
|
||||||
CheckCharacters = false,
|
|
||||||
IgnoreProcessingInstructions = true,
|
|
||||||
IgnoreComments = true,
|
|
||||||
ValidationType = ValidationType.None
|
|
||||||
};
|
|
||||||
|
|
||||||
_validProviderIds = _validProviderIds = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
|
settings.CheckCharacters = false;
|
||||||
|
settings.IgnoreProcessingInstructions = true;
|
||||||
|
settings.IgnoreComments = true;
|
||||||
|
|
||||||
|
_validProviderIds = _validProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var idInfos = ProviderManager.GetExternalIdInfos(item.Item);
|
var idInfos = ProviderManager.GetExternalIdInfos(item.Item);
|
||||||
|
|
||||||
@ -108,85 +110,15 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
{
|
{
|
||||||
if (!SupportsUrlAfterClosingXmlTag)
|
if (!SupportsUrlAfterClosingXmlTag)
|
||||||
{
|
{
|
||||||
using (var streamReader = BaseNfoSaver.GetStreamReader(metadataFile))
|
using (var fileStream = FileSystem.OpenRead(metadataFile))
|
||||||
{
|
{
|
||||||
// Use XmlReader for best performance
|
using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
|
||||||
using (var reader = XmlReader.Create(streamReader, settings))
|
|
||||||
{
|
|
||||||
item.ResetPeople();
|
|
||||||
|
|
||||||
reader.MoveToContent();
|
|
||||||
|
|
||||||
// Loop through each element
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
|
||||||
|
|
||||||
if (reader.NodeType == XmlNodeType.Element)
|
|
||||||
{
|
|
||||||
FetchDataFromXmlNode(reader, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var streamReader = BaseNfoSaver.GetStreamReader(metadataFile))
|
|
||||||
{
|
|
||||||
item.ResetPeople();
|
|
||||||
|
|
||||||
// Need to handle a url after the xml data
|
|
||||||
// http://kodi.wiki/view/NFO_files/movies
|
|
||||||
|
|
||||||
var xml = streamReader.ReadToEnd();
|
|
||||||
|
|
||||||
// Find last closing Tag
|
|
||||||
// Need to do this in two steps to account for random > characters after the closing xml
|
|
||||||
var index = xml.LastIndexOf(@"</", StringComparison.Ordinal);
|
|
||||||
|
|
||||||
// If closing tag exists, move to end of Tag
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
index = xml.IndexOf('>', index);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (index != -1)
|
|
||||||
{
|
|
||||||
var endingXml = xml.Substring(index);
|
|
||||||
|
|
||||||
ParseProviderLinks(item.Item, endingXml);
|
|
||||||
|
|
||||||
// If the file is just an imdb url, don't go any further
|
|
||||||
if (index == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
xml = xml.Substring(0, index + 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// If the file is just an Imdb url, handle that
|
|
||||||
|
|
||||||
ParseProviderLinks(item.Item, xml);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (var ms = new MemoryStream())
|
|
||||||
{
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(xml);
|
|
||||||
|
|
||||||
ms.Write(bytes, 0, bytes.Length);
|
|
||||||
ms.Position = 0;
|
|
||||||
|
|
||||||
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// Use XmlReader for best performance
|
// Use XmlReader for best performance
|
||||||
using (var reader = XmlReader.Create(ms, settings))
|
using (var reader = XmlReader.Create(streamReader, settings))
|
||||||
{
|
{
|
||||||
|
item.ResetPeople();
|
||||||
|
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
// Loop through each element
|
// Loop through each element
|
||||||
@ -201,9 +133,85 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (XmlException)
|
}
|
||||||
{
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var fileStream = FileSystem.OpenRead(metadataFile))
|
||||||
|
{
|
||||||
|
using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
|
||||||
|
{
|
||||||
|
item.ResetPeople();
|
||||||
|
|
||||||
|
// Need to handle a url after the xml data
|
||||||
|
// http://kodi.wiki/view/NFO_files/movies
|
||||||
|
|
||||||
|
var xml = streamReader.ReadToEnd();
|
||||||
|
|
||||||
|
// Find last closing Tag
|
||||||
|
// Need to do this in two steps to account for random > characters after the closing xml
|
||||||
|
var index = xml.LastIndexOf(@"</", StringComparison.Ordinal);
|
||||||
|
|
||||||
|
// If closing tag exists, move to end of Tag
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
index = xml.IndexOf('>', index);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (index != -1)
|
||||||
|
{
|
||||||
|
var endingXml = xml.Substring(index);
|
||||||
|
|
||||||
|
ParseProviderLinks(item.Item, endingXml);
|
||||||
|
|
||||||
|
// If the file is just an imdb url, don't go any further
|
||||||
|
if (index == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
xml = xml.Substring(0, index + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If the file is just an Imdb url, handle that
|
||||||
|
|
||||||
|
ParseProviderLinks(item.Item, xml);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var ms = new MemoryStream())
|
||||||
|
{
|
||||||
|
var bytes = Encoding.UTF8.GetBytes(xml);
|
||||||
|
|
||||||
|
ms.Write(bytes, 0, bytes.Length);
|
||||||
|
ms.Position = 0;
|
||||||
|
|
||||||
|
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Use XmlReader for best performance
|
||||||
|
using (var reader = XmlReader.Create(ms, settings))
|
||||||
|
{
|
||||||
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
// Loop through each element
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
|
{
|
||||||
|
FetchDataFromXmlNode(reader, item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (XmlException)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,13 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
public class EpisodeNfoParser : BaseNfoParser<Episode>
|
public class EpisodeNfoParser : BaseNfoParser<Episode>
|
||||||
{
|
{
|
||||||
public EpisodeNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(logger, config, providerManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Fetch(MetadataResult<Episode> item,
|
public void Fetch(MetadataResult<Episode> item,
|
||||||
List<LocalImageInfo> images,
|
List<LocalImageInfo> images,
|
||||||
string metadataFile,
|
string metadataFile,
|
||||||
@ -230,5 +228,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EpisodeNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(logger, config, providerManager, fileSystem, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,16 +5,13 @@ using MediaBrowser.Controller.Providers;
|
|||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
class MovieNfoParser : BaseNfoParser<Video>
|
class MovieNfoParser : BaseNfoParser<Video>
|
||||||
{
|
{
|
||||||
public MovieNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
|
||||||
: base(logger, config, providerManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool SupportsUrlAfterClosingXmlTag
|
protected override bool SupportsUrlAfterClosingXmlTag
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -103,5 +100,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MovieNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(logger, config, providerManager, fileSystem, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,15 +4,13 @@ using MediaBrowser.Controller.Providers;
|
|||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
public class SeasonNfoParser : BaseNfoParser<Season>
|
public class SeasonNfoParser : BaseNfoParser<Season>
|
||||||
{
|
{
|
||||||
public SeasonNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(logger, config, providerManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -45,5 +43,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SeasonNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(logger, config, providerManager, fileSystem, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,15 +6,13 @@ using MediaBrowser.Model.Entities;
|
|||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Parsers
|
namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
public class SeriesNfoParser : BaseNfoParser<Series>
|
public class SeriesNfoParser : BaseNfoParser<Series>
|
||||||
{
|
{
|
||||||
public SeriesNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(logger, config, providerManager)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the data from XML node.
|
/// Fetches the data from XML node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -108,5 +106,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SeriesNfoParser(ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(logger, config, providerManager, fileSystem, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -16,6 +17,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public AlbumNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public AlbumNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
@ -27,7 +29,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
|
|
||||||
protected override void Fetch(MetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<MusicAlbum> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseNfoParser<MusicAlbum>(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
|
new BaseNfoParser<MusicAlbum>(_logger, _config, _providerManager, FileSystem, XmlReaderSettingsFactory).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -16,18 +17,20 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public ArtistNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public ArtistNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<MusicArtist> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<MusicArtist> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new BaseNfoParser<MusicArtist>(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
|
new BaseNfoParser<MusicArtist>(_logger, _config, _providerManager, FileSystem, XmlReaderSettingsFactory).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
@ -41,7 +41,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
{
|
{
|
||||||
result.HasMetadata = false;
|
result.HasMetadata = false;
|
||||||
}
|
}
|
||||||
catch (DirectoryNotFoundException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
result.HasMetadata = false;
|
result.HasMetadata = false;
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -18,13 +19,15 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public BaseVideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public BaseVideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<T> result, string path, CancellationToken cancellationToken)
|
||||||
@ -33,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
{
|
{
|
||||||
Item = result.Item
|
Item = result.Item
|
||||||
};
|
};
|
||||||
new MovieNfoParser(_logger, _config, _providerManager).Fetch(tmpItem, path, cancellationToken);
|
new MovieNfoParser(_logger, _config, _providerManager, FileSystem, XmlReaderSettingsFactory).Fetch(tmpItem, path, cancellationToken);
|
||||||
|
|
||||||
result.Item = (T)tmpItem.Item;
|
result.Item = (T)tmpItem.Item;
|
||||||
result.People = tmpItem.People;
|
result.People = tmpItem.People;
|
||||||
|
@ -9,6 +9,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -17,20 +18,22 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public EpisodeNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public EpisodeNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Episode> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var images = new List<LocalImageInfo>();
|
var images = new List<LocalImageInfo>();
|
||||||
|
|
||||||
new EpisodeNfoParser(_logger, _config, _providerManager).Fetch(result, images, path, cancellationToken);
|
new EpisodeNfoParser(_logger, _config, _providerManager, FileSystem, XmlReaderSettingsFactory).Fetch(result, images, path, cancellationToken);
|
||||||
|
|
||||||
result.Images = images;
|
result.Images = images;
|
||||||
}
|
}
|
||||||
|
@ -6,26 +6,27 @@ using MediaBrowser.Controller.IO;
|
|||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
public class MovieNfoProvider : BaseVideoNfoProvider<Movie>
|
public class MovieNfoProvider : BaseVideoNfoProvider<Movie>
|
||||||
{
|
{
|
||||||
public MovieNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(fileSystem, logger, config, providerManager)
|
public MovieNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, logger, config, providerManager, xmlReaderSettingsFactory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MusicVideoNfoProvider : BaseVideoNfoProvider<MusicVideo>
|
public class MusicVideoNfoProvider : BaseVideoNfoProvider<MusicVideo>
|
||||||
{
|
{
|
||||||
public MusicVideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(fileSystem, logger, config, providerManager)
|
public MusicVideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, logger, config, providerManager, xmlReaderSettingsFactory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VideoNfoProvider : BaseVideoNfoProvider<Video>
|
public class VideoNfoProvider : BaseVideoNfoProvider<Video>
|
||||||
{
|
{
|
||||||
public VideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager) : base(fileSystem, logger, config, providerManager)
|
public VideoNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, logger, config, providerManager, xmlReaderSettingsFactory)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -16,18 +17,20 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public SeasonNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public SeasonNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Season> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeasonNfoParser(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
|
new SeasonNfoParser(_logger, _config, _providerManager, FileSystem, XmlReaderSettingsFactory).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
@ -8,6 +8,7 @@ using System.Threading;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Providers
|
namespace MediaBrowser.XbmcMetadata.Providers
|
||||||
{
|
{
|
||||||
@ -16,18 +17,22 @@ namespace MediaBrowser.XbmcMetadata.Providers
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IConfigurationManager _config;
|
private readonly IConfigurationManager _config;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
|
private readonly IFileSystem _fileSystem;
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
public SeriesNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager)
|
public SeriesNfoProvider(IFileSystem fileSystem, ILogger logger, IConfigurationManager config, IProviderManager providerManager, IFileSystem fileSystem1, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
: base(fileSystem)
|
: base(fileSystem)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_config = config;
|
_config = config;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
|
_fileSystem = fileSystem1;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Fetch(MetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
protected override void Fetch(MetadataResult<Series> result, string path, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
new SeriesNfoParser(_logger, _config, _providerManager).Fetch(result, path, cancellationToken);
|
new SeriesNfoParser(_logger, _config, _providerManager, _fileSystem, XmlReaderSettingsFactory).Fetch(result, path, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
|
||||||
|
@ -12,15 +12,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class AlbumNfoSaver : BaseNfoSaver
|
public class AlbumNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public AlbumNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return Path.Combine(item.Path, "album.nfo");
|
return Path.Combine(item.Path, "album.nfo");
|
||||||
@ -99,5 +96,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AlbumNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,15 +12,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class ArtistNfoSaver : BaseNfoSaver
|
public class ArtistNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public ArtistNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return Path.Combine(item.Path, "artist.nfo");
|
return Path.Combine(item.Path, "artist.nfo");
|
||||||
@ -92,5 +89,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArtistNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,6 +22,7 @@ using MediaBrowser.Common.IO;
|
|||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.Extensions;
|
using MediaBrowser.Model.Extensions;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
@ -107,9 +108,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
protected BaseNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger)
|
protected BaseNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
||||||
{
|
{
|
||||||
Logger = logger;
|
Logger = logger;
|
||||||
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
||||||
UserDataManager = userDataManager;
|
UserDataManager = userDataManager;
|
||||||
UserManager = userManager;
|
UserManager = userManager;
|
||||||
LibraryManager = libraryManager;
|
LibraryManager = libraryManager;
|
||||||
@ -123,6 +125,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
protected IUserManager UserManager { get; private set; }
|
protected IUserManager UserManager { get; private set; }
|
||||||
protected IUserDataManager UserDataManager { get; private set; }
|
protected IUserDataManager UserDataManager { get; private set; }
|
||||||
protected ILogger Logger { get; private set; }
|
protected ILogger Logger { get; private set; }
|
||||||
|
protected IXmlReaderSettingsFactory XmlReaderSettingsFactory { get; private set; }
|
||||||
|
|
||||||
protected ItemUpdateType MinimumUpdateType
|
protected ItemUpdateType MinimumUpdateType
|
||||||
{
|
{
|
||||||
@ -205,16 +208,16 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
{
|
{
|
||||||
FileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
FileSystem.CreateDirectory(Path.GetDirectoryName(path));
|
||||||
|
|
||||||
var file = new FileInfo(path);
|
var file = FileSystem.GetFileInfo(path);
|
||||||
|
|
||||||
var wasHidden = false;
|
var wasHidden = false;
|
||||||
|
|
||||||
// This will fail if the file is hidden
|
// This will fail if the file is hidden
|
||||||
if (file.Exists)
|
if (file.Exists)
|
||||||
{
|
{
|
||||||
if ((file.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
|
if (file.IsHidden)
|
||||||
{
|
{
|
||||||
file.Attributes &= ~FileAttributes.Hidden;
|
FileSystem.SetHidden(path, false);
|
||||||
|
|
||||||
wasHidden = true;
|
wasHidden = true;
|
||||||
}
|
}
|
||||||
@ -227,10 +230,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
if (wasHidden || ConfigurationManager.Configuration.SaveMetadataHidden)
|
if (wasHidden || ConfigurationManager.Configuration.SaveMetadataHidden)
|
||||||
{
|
{
|
||||||
file.Refresh();
|
FileSystem.SetHidden(path, true);
|
||||||
|
|
||||||
// Add back the attribute
|
|
||||||
file.Attributes |= FileAttributes.Hidden;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,13 +271,13 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AddCustomTags(xmlPath, tagsUsed, writer, Logger);
|
AddCustomTags(xmlPath, tagsUsed, writer, Logger, FileSystem);
|
||||||
}
|
}
|
||||||
catch (FileNotFoundException)
|
catch (FileNotFoundException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (DirectoryNotFoundException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -430,7 +430,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataRepo, IFileSystem fileSystem, IServerConfigurationManager config)
|
public static void AddCommonNodes(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataRepo, IFileSystem fileSystem, IServerConfigurationManager config)
|
||||||
{
|
{
|
||||||
var writtenProviderIds = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
|
var writtenProviderIds = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var overview = (item.Overview ?? string.Empty)
|
var overview = (item.Overview ?? string.Empty)
|
||||||
.StripHtml()
|
.StripHtml()
|
||||||
@ -1036,56 +1036,51 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
return string.Equals(person.Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(person.Role, type, StringComparison.OrdinalIgnoreCase);
|
return string.Equals(person.Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(person.Role, type, StringComparison.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddCustomTags(string path, List<string> xmlTagsUsed, XmlWriter writer, ILogger logger)
|
private void AddCustomTags(string path, List<string> xmlTagsUsed, XmlWriter writer, ILogger logger, IFileSystem fileSystem)
|
||||||
{
|
{
|
||||||
var settings = new XmlReaderSettings
|
var settings = XmlReaderSettingsFactory.Create(false);
|
||||||
{
|
|
||||||
CheckCharacters = false,
|
|
||||||
IgnoreProcessingInstructions = true,
|
|
||||||
IgnoreComments = true,
|
|
||||||
ValidationType = ValidationType.None
|
|
||||||
};
|
|
||||||
|
|
||||||
using (var streamReader = GetStreamReader(path))
|
settings.CheckCharacters = false;
|
||||||
|
settings.IgnoreProcessingInstructions = true;
|
||||||
|
settings.IgnoreComments = true;
|
||||||
|
|
||||||
|
using (var fileStream = fileSystem.OpenRead(path))
|
||||||
{
|
{
|
||||||
// Use XmlReader for best performance
|
using (var streamReader = new StreamReader(fileStream, Encoding.UTF8))
|
||||||
using (var reader = XmlReader.Create(streamReader, settings))
|
|
||||||
{
|
{
|
||||||
try
|
// Use XmlReader for best performance
|
||||||
|
using (var reader = XmlReader.Create(streamReader, settings))
|
||||||
{
|
{
|
||||||
reader.MoveToContent();
|
try
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
logger.ErrorException("Error reading existing xml tags from {0}.", ex, path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Loop through each element
|
|
||||||
while (reader.Read())
|
|
||||||
{
|
|
||||||
if (reader.NodeType == XmlNodeType.Element)
|
|
||||||
{
|
{
|
||||||
var name = reader.Name;
|
reader.MoveToContent();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
logger.ErrorException("Error reading existing xml tags from {0}.", ex, path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!CommonTags.ContainsKey(name) && !xmlTagsUsed.Contains(name, StringComparer.OrdinalIgnoreCase))
|
// Loop through each element
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
{
|
{
|
||||||
writer.WriteNode(reader, false);
|
var name = reader.Name;
|
||||||
}
|
|
||||||
else
|
if (!CommonTags.ContainsKey(name) && !xmlTagsUsed.Contains(name, StringComparer.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
reader.Skip();
|
writer.WriteNode(reader, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reader.Skip();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static StreamReader GetStreamReader(string path)
|
|
||||||
{
|
|
||||||
return new StreamReader(path, Encoding.UTF8);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class EpisodeNfoSaver : BaseNfoSaver
|
public class EpisodeNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public EpisodeNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return Path.ChangeExtension(item.Path, ".nfo");
|
return Path.ChangeExtension(item.Path, ".nfo");
|
||||||
@ -131,5 +128,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EpisodeNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,15 +13,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class MovieNfoSaver : BaseNfoSaver
|
public class MovieNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public MovieNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return GetMovieSavePaths(new ItemInfo(item), FileSystem).FirstOrDefault();
|
return GetMovieSavePaths(new ItemInfo(item), FileSystem).FirstOrDefault();
|
||||||
@ -128,5 +125,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MovieNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,15 +10,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class SeasonNfoSaver : BaseNfoSaver
|
public class SeasonNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public SeasonNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return Path.Combine(item.Path, "season.nfo");
|
return Path.Combine(item.Path, "season.nfo");
|
||||||
@ -62,5 +59,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SeasonNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,15 +11,12 @@ using System.Xml;
|
|||||||
using MediaBrowser.Common.IO;
|
using MediaBrowser.Common.IO;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Model.IO;
|
using MediaBrowser.Model.IO;
|
||||||
|
using MediaBrowser.Model.Xml;
|
||||||
|
|
||||||
namespace MediaBrowser.XbmcMetadata.Savers
|
namespace MediaBrowser.XbmcMetadata.Savers
|
||||||
{
|
{
|
||||||
public class SeriesNfoSaver : BaseNfoSaver
|
public class SeriesNfoSaver : BaseNfoSaver
|
||||||
{
|
{
|
||||||
public SeriesNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetLocalSavePath(IHasMetadata item)
|
protected override string GetLocalSavePath(IHasMetadata item)
|
||||||
{
|
{
|
||||||
return Path.Combine(item.Path, "tvshow.nfo");
|
return Path.Combine(item.Path, "tvshow.nfo");
|
||||||
@ -111,5 +108,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SeriesNfoSaver(IFileSystem fileSystem, IServerConfigurationManager configurationManager, ILibraryManager libraryManager, IUserManager userManager, IUserDataManager userDataManager, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory) : base(fileSystem, configurationManager, libraryManager, userManager, userDataManager, logger, xmlReaderSettingsFactory)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
7
MediaBrowser.XbmcMetadata/project.json
Normal file
7
MediaBrowser.XbmcMetadata/project.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"supports": {},
|
||||||
|
"dependencies": {},
|
||||||
|
"frameworks": {
|
||||||
|
".NETPortable,Version=v4.5,Profile=Profile7": {}
|
||||||
|
}
|
||||||
|
}
|
12
MediaBrowser.XbmcMetadata/project.lock.json
Normal file
12
MediaBrowser.XbmcMetadata/project.lock.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"locked": false,
|
||||||
|
"version": 1,
|
||||||
|
"targets": {
|
||||||
|
".NETPortable,Version=v4.5,Profile=Profile7": {}
|
||||||
|
},
|
||||||
|
"libraries": {},
|
||||||
|
"projectFileDependencyGroups": {
|
||||||
|
"": [],
|
||||||
|
".NETPortable,Version=v4.5,Profile=Profile7": []
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user