mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-02 04:12:53 +01:00
converted movie providers to new system
This commit is contained in:
@@ -4,14 +4,13 @@ using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Providers.BoxSets
|
||||
{
|
||||
/// <summary>
|
||||
/// Class BoxSetXmlProvider.
|
||||
/// </summary>
|
||||
public class BoxSetXmlProvider : BaseXmlProvider, ILocalMetadataProvider<BoxSet>
|
||||
public class BoxSetXmlProvider : BaseXmlProvider<BoxSet>
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
|
||||
@@ -21,42 +20,14 @@ namespace MediaBrowser.Providers.BoxSets
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task<MetadataResult<BoxSet>> GetMetadata(string path, CancellationToken cancellationToken)
|
||||
protected override void Fetch(BoxSet item, string path, CancellationToken cancellationToken)
|
||||
{
|
||||
path = GetXmlFile(path).FullName;
|
||||
|
||||
var result = new MetadataResult<BoxSet>();
|
||||
|
||||
await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
try
|
||||
{
|
||||
var item = new BoxSet();
|
||||
|
||||
new BaseItemXmlParser<BoxSet>(_logger).Fetch(item, path, cancellationToken);
|
||||
result.HasMetadata = true;
|
||||
result.Item = item;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
result.HasMetadata = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
XmlParsingResourcePool.Release();
|
||||
}
|
||||
|
||||
return result;
|
||||
new BaseItemXmlParser<BoxSet>(_logger).Fetch(item, path, cancellationToken);
|
||||
}
|
||||
|
||||
public string Name
|
||||
protected override FileInfo GetXmlFile(ItemInfo info)
|
||||
{
|
||||
get { return "Media Browser Xml"; }
|
||||
}
|
||||
|
||||
protected override FileInfo GetXmlFile(string path)
|
||||
{
|
||||
return new FileInfo(Path.Combine(path, "collection.xml"));
|
||||
return new FileInfo(Path.Combine(info.Path, "collection.xml"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user