2013-02-20 18:33:05 -07:00
|
|
|
|
using MediaBrowser.Common.IO;
|
2013-03-03 22:43:06 -07:00
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Threading.Tasks;
|
2013-03-02 10:59:15 -07:00
|
|
|
|
using MediaBrowser.Model.Logging;
|
2013-02-20 18:33:05 -07:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Providers.MediaInfo
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Class BaseFFMpegProvider
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
public abstract class BaseFFMpegProvider<T> : BaseMetadataProvider
|
|
|
|
|
where T : BaseItem
|
|
|
|
|
{
|
2013-03-03 22:43:06 -07:00
|
|
|
|
protected BaseFFMpegProvider(ILogManager logManager, IServerConfigurationManager configurationManager) : base(logManager, configurationManager)
|
2013-03-02 10:59:15 -07:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-02-20 18:33:05 -07:00
|
|
|
|
/// <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 Kernel.Instance.FFMpegManager.FFMpegVersion;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Needses the refresh internal.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="providerInfo">The provider info.</param>
|
|
|
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
|
|
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
|
|
|
{
|
|
|
|
|
// If the last run wasn't successful, try again when there's a new version of ffmpeg
|
|
|
|
|
if (providerInfo.LastRefreshStatus != ProviderRefreshStatus.Success)
|
|
|
|
|
{
|
|
|
|
|
if (!string.Equals(ProviderVersion, providerInfo.ProviderVersion))
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return base.NeedsRefreshInternal(item, providerInfo);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|