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 get
{ {
// Need this in case external subtitle files change
return true; 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 protected override bool RefreshOnVersionChange
{ {
get get
@ -274,17 +263,6 @@ namespace MediaBrowser.Providers.Movies
return true; 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> /// <summary>
/// Determines whether [has alt meta] [the specified item]. /// Determines whether [has alt meta] [the specified item].
/// </summary> /// </summary>

View file

@ -21,7 +21,12 @@ namespace MediaBrowser.Providers.Music
private static readonly Task<string> BlankId = Task.FromResult(""); private static readonly Task<string> BlankId = Task.FromResult("");
private readonly IProviderManager _providerManager; 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) public LastfmAlbumProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager)
: base(jsonSerializer, httpClient, logManager, configurationManager) : base(jsonSerializer, httpClient, logManager, configurationManager)
{ {
@ -132,14 +137,6 @@ namespace MediaBrowser.Providers.Music
return item is MusicAlbum; return item is MusicAlbum;
} }
protected override bool RefreshOnFileSystemStampChange
{
get
{
return true;
}
}
/// <summary> /// <summary>
/// Gets the data. /// Gets the data.
/// </summary> /// </summary>

View file

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

View file

@ -71,11 +71,6 @@ namespace MediaBrowser.Providers.Music
/// <value>The HTTP client.</value> /// <value>The HTTP client.</value>
protected IHttpClient HttpClient { get; private set; } 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 protected virtual bool SaveLocalMeta
{ {
get 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> /// <summary>
/// Gets the priority. /// Gets the priority.
/// </summary> /// </summary>
@ -119,16 +103,6 @@ namespace MediaBrowser.Providers.Music
protected const string RootUrl = @"http://ws.audioscrobbler.com/2.0/?"; protected const string RootUrl = @"http://ws.audioscrobbler.com/2.0/?";
protected static string ApiKey = "7b76553c3eb1d341d642755aecc40a33"; 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> /// <summary>
/// Fetches the items data. /// Fetches the items data.
/// </summary> /// </summary>

View file

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

View file

@ -121,7 +121,8 @@ namespace MediaBrowser.Providers.TV
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) 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; return false;
} }
@ -181,7 +182,8 @@ namespace MediaBrowser.Providers.TV
/// <returns>Task{System.Boolean}.</returns> /// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) 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; return false;
} }

View file

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