ease up on RefreshOnFileSystemStampChange

This commit is contained in:
Luke Pulverenti 2013-06-09 21:40:28 -04:00
parent baca9f0211
commit 38a7717824
8 changed files with 18 additions and 69 deletions

View File

@ -60,6 +60,7 @@ namespace MediaBrowser.Providers.MediaInfo
{
get
{
// Need this in case external subtitle files change
return true;
}
}

View File

@ -116,17 +116,6 @@ namespace MediaBrowser.Providers.Movies
}
}
/// <summary>
/// If we save locally, refresh if they delete something
/// </summary>
protected override bool RefreshOnFileSystemStampChange
{
get
{
return ConfigurationManager.Configuration.SaveLocalMeta;
}
}
protected override bool RefreshOnVersionChange
{
get
@ -274,17 +263,6 @@ namespace MediaBrowser.Providers.Movies
return true;
}
/// <summary>
/// Determines whether [has local meta] [the specified item].
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if [has local meta] [the specified item]; otherwise, <c>false</c>.</returns>
private bool HasLocalMeta(BaseItem item)
{
//need at least the xml and folder.jpg/png or a movie.xml put in by someone else
return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName(LocalMetaFileName);
}
/// <summary>
/// Determines whether [has alt meta] [the specified item].
/// </summary>

View File

@ -21,7 +21,12 @@ namespace MediaBrowser.Providers.Music
private static readonly Task<string> BlankId = Task.FromResult("");
private readonly IProviderManager _providerManager;
/// <summary>
/// The name of the local json meta file for this item type
/// </summary>
protected string LocalMetaFileName { get; set; }
public LastfmAlbumProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
: base(jsonSerializer, httpClient, logManager, configurationManager)
{
@ -132,14 +137,6 @@ namespace MediaBrowser.Providers.Music
return item is MusicAlbum;
}
protected override bool RefreshOnFileSystemStampChange
{
get
{
return true;
}
}
/// <summary>
/// Gets the data.
/// </summary>

View File

@ -35,6 +35,11 @@ namespace MediaBrowser.Providers.Music
/// </summary>
protected readonly ILibraryManager LibraryManager;
/// <summary>
/// The name of the local json meta file for this item type
/// </summary>
protected string LocalMetaFileName { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="LastfmArtistProvider"/> class.
/// </summary>

View File

@ -71,11 +71,6 @@ namespace MediaBrowser.Providers.Music
/// <value>The HTTP client.</value>
protected IHttpClient HttpClient { get; private set; }
/// <summary>
/// The name of the local json meta file for this item type
/// </summary>
protected string LocalMetaFileName { get; set; }
protected virtual bool SaveLocalMeta
{
get
@ -84,17 +79,6 @@ namespace MediaBrowser.Providers.Music
}
}
/// <summary>
/// If we save locally, refresh if they delete something
/// </summary>
protected override bool RefreshOnFileSystemStampChange
{
get
{
return SaveLocalMeta;
}
}
/// <summary>
/// Gets the priority.
/// </summary>
@ -119,16 +103,6 @@ namespace MediaBrowser.Providers.Music
protected const string RootUrl = @"http://ws.audioscrobbler.com/2.0/?";
protected static string ApiKey = "7b76553c3eb1d341d642755aecc40a33";
/// <summary>
/// Determines whether [has local meta] [the specified item].
/// </summary>
/// <param name="item">The item.</param>
/// <returns><c>true</c> if [has local meta] [the specified item]; otherwise, <c>false</c>.</returns>
protected bool HasLocalMeta(BaseItem item)
{
return item.ResolveArgs.ContainsMetaFileByName(LocalMetaFileName);
}
/// <summary>
/// Fetches the items data.
/// </summary>

View File

@ -40,14 +40,6 @@ namespace MediaBrowser.Providers.TV
get { return MetadataProviderPriority.First; }
}
protected override bool RefreshOnFileSystemStampChange
{
get
{
return true;
}
}
/// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary>

View File

@ -121,7 +121,8 @@ namespace MediaBrowser.Providers.TV
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (HasLocalMeta(item))
// Don't proceed if there's local metadata and save local is off, as it's likely from another source
if (HasLocalMeta(item) && !ConfigurationManager.Configuration.SaveLocalMeta)
{
return false;
}
@ -181,7 +182,8 @@ namespace MediaBrowser.Providers.TV
/// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
{
if (HasLocalMeta(item))
// Don't proceed if there's local metadata and save local is off, as it's likely from another source
if (HasLocalMeta(item) && !ConfigurationManager.Configuration.SaveLocalMeta)
{
return false;
}

View File

@ -272,8 +272,8 @@ namespace MediaBrowser.Providers.TV
await DownloadSeriesZip(seriesId, seriesDataPath, cancellationToken).ConfigureAwait(false);
}
// Only examine the main info if there's no local metadata
if (!HasLocalMeta(series))
// Examine if there's no local metadata, or save local is on (to get updates)
if (!HasLocalMeta(series) || ConfigurationManager.Configuration.SaveLocalMeta)
{
var seriesXmlPath = Path.Combine(seriesDataPath, seriesXmlFilename);
var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml");