using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Entities; using System; using System.Threading.Tasks; namespace MediaBrowser.Controller.Providers.MediaInfo { /// /// Class BaseFFMpegProvider /// /// public abstract class BaseFFMpegProvider : BaseMetadataProvider where T : BaseItem { /// /// Supportses the specified item. /// /// The item. /// true if XXXX, false otherwise public override bool Supports(BaseItem item) { return item.LocationType == LocationType.FileSystem && item is T; } /// /// Override this to return the date that should be compared to the last refresh date /// to determine if this provider should be re-fetched. /// /// The item. /// DateTime. protected override DateTime CompareDate(BaseItem item) { return item.DateModified; } /// /// The null mount task result /// protected readonly Task NullMountTaskResult = Task.FromResult(null); /// /// Gets the provider version. /// /// The provider version. protected override string ProviderVersion { get { return Kernel.Instance.FFMpegManager.FFMpegVersion; } } /// /// Needses the refresh internal. /// /// The item. /// The provider info. /// true if XXXX, false otherwise 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); } } }