removed excess provider subclass layer

This commit is contained in:
Luke Pulverenti 2013-08-15 10:27:14 -04:00
parent ca75dd9193
commit 339c514ff4
3 changed files with 56 additions and 84 deletions

View File

@ -54,7 +54,6 @@
<Compile Include="ImageFromMediaLocationProvider.cs" />
<Compile Include="ImagesByNameProvider.cs" />
<Compile Include="MediaInfo\AudioImageProvider.cs" />
<Compile Include="MediaInfo\BaseFFMpegProvider.cs" />
<Compile Include="MediaInfo\BaseFFProbeProvider.cs" />
<Compile Include="MediaInfo\FFProbeAudioInfoProvider.cs" />
<Compile Include="MediaInfo\FFProbeVideoInfoProvider.cs" />

View File

@ -1,78 +0,0 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.Logging;
using System;
using System.Threading.Tasks;
namespace MediaBrowser.Providers.MediaInfo
{
/// <summary>
/// Class BaseFFMpegProvider
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class BaseFFMpegProvider<T> : BaseMetadataProvider
where T : BaseItem
{
protected readonly IMediaEncoder MediaEncoder;
protected BaseFFMpegProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IMediaEncoder mediaEncoder) : base(logManager, configurationManager)
{
MediaEncoder = mediaEncoder;
}
/// <summary>
/// Supportses the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public override bool Supports(BaseItem item)
{
return item.LocationType == LocationType.FileSystem && item is T;
}
/// <summary>
/// Override this to return the date that should be compared to the last refresh date
/// to determine if this provider should be re-fetched.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>DateTime.</returns>
protected override DateTime CompareDate(BaseItem item)
{
return item.DateModified;
}
/// <summary>
/// The null mount task result
/// </summary>
protected readonly Task<IIsoMount> NullMountTaskResult = Task.FromResult<IIsoMount>(null);
/// <summary>
/// Gets the provider version.
/// </summary>
/// <value>The provider version.</value>
protected override string ProviderVersion
{
get
{
return MediaEncoder.Version;
}
}
/// <summary>
/// Gets a value indicating whether [refresh on version change].
/// </summary>
/// <value><c>true</c> if [refresh on version change]; otherwise, <c>false</c>.</value>
protected override bool RefreshOnVersionChange
{
get
{
return true;
}
}
}
}

View File

@ -1,5 +1,4 @@
using MediaBrowser.Common.IO;
using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Common.MediaInfo;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.MediaInfo;
@ -20,15 +19,17 @@ namespace MediaBrowser.Providers.MediaInfo
/// Provides a base class for extracting media information through ffprobe
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class BaseFFProbeProvider<T> : BaseFFMpegProvider<T>
where T : BaseItem
public abstract class BaseFFProbeProvider<T> : BaseMetadataProvider
where T : BaseItem, IHasMediaStreams
{
protected BaseFFProbeProvider(ILogManager logManager, IServerConfigurationManager configurationManager, IMediaEncoder mediaEncoder, IJsonSerializer jsonSerializer)
: base(logManager, configurationManager, mediaEncoder)
: base(logManager, configurationManager)
{
JsonSerializer = jsonSerializer;
MediaEncoder = mediaEncoder;
}
protected readonly IMediaEncoder MediaEncoder;
protected readonly IJsonSerializer JsonSerializer;
/// <summary>
@ -42,6 +43,56 @@ namespace MediaBrowser.Providers.MediaInfo
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
/// <summary>
/// Supportses the specified item.
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
public override bool Supports(BaseItem item)
{
return item.LocationType == LocationType.FileSystem && item is T;
}
/// <summary>
/// Override this to return the date that should be compared to the last refresh date
/// to determine if this provider should be re-fetched.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>DateTime.</returns>
protected override DateTime CompareDate(BaseItem item)
{
return item.DateModified;
}
/// <summary>
/// The null mount task result
/// </summary>
protected readonly Task<IIsoMount> NullMountTaskResult = Task.FromResult<IIsoMount>(null);
/// <summary>
/// Gets the provider version.
/// </summary>
/// <value>The provider version.</value>
protected override string ProviderVersion
{
get
{
return MediaEncoder.Version;
}
}
/// <summary>
/// Gets a value indicating whether [refresh on version change].
/// </summary>
/// <value><c>true</c> if [refresh on version change]; otherwise, <c>false</c>.</value>
protected override bool RefreshOnVersionChange
{
get
{
return true;
}
}
/// <summary>
/// Gets the media info.
/// </summary>