use comparedate for needsrefresh comparison
This commit is contained in:
parent
30e135e576
commit
6f15aeccd0
|
@ -107,8 +107,11 @@ namespace MediaBrowser.Providers.Music
|
|||
return false;
|
||||
}
|
||||
|
||||
var comparisonData = Guid.Empty;
|
||||
return base.NeedsRefreshInternal(item, providerInfo);
|
||||
}
|
||||
|
||||
protected override DateTime CompareDate(BaseItem item)
|
||||
{
|
||||
var artistMusicBrainzId = item.Parent.GetProviderId(MetadataProviders.Musicbrainz);
|
||||
|
||||
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
||||
|
@ -116,25 +119,15 @@ namespace MediaBrowser.Providers.Music
|
|||
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
||||
artistXmlPath = Path.Combine(artistXmlPath, "fanart.xml");
|
||||
|
||||
comparisonData = GetComparisonData(new FileInfo(artistXmlPath));
|
||||
}
|
||||
var file = new FileInfo(artistXmlPath);
|
||||
|
||||
// Refresh anytime the parent mbz id changes
|
||||
if (providerInfo.Data != comparisonData)
|
||||
if (file.Exists)
|
||||
{
|
||||
return true;
|
||||
return file.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
||||
return base.NeedsRefreshInternal(item, providerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(FileInfo artistXmlFileInfo)
|
||||
{
|
||||
return artistXmlFileInfo.Exists ? (artistXmlFileInfo.FullName + artistXmlFileInfo.LastWriteTimeUtc.Ticks).GetMD5() : Guid.Empty;
|
||||
return base.CompareDate(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -158,8 +151,6 @@ namespace MediaBrowser.Providers.Music
|
|||
item.ProviderData[Id] = data;
|
||||
}
|
||||
|
||||
var comparisonData = Guid.Empty;
|
||||
|
||||
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
||||
{
|
||||
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
||||
|
@ -167,8 +158,6 @@ namespace MediaBrowser.Providers.Music
|
|||
|
||||
var artistXmlFileInfo = new FileInfo(artistXmlPath);
|
||||
|
||||
comparisonData = GetComparisonData(artistXmlFileInfo);
|
||||
|
||||
if (artistXmlFileInfo.Exists)
|
||||
{
|
||||
var album = (MusicAlbum)item;
|
||||
|
@ -226,7 +215,6 @@ namespace MediaBrowser.Providers.Music
|
|||
|
||||
}
|
||||
|
||||
data.Data = comparisonData;
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
|
||||
return true;
|
||||
|
|
|
@ -45,28 +45,7 @@ namespace MediaBrowser.Providers.TV
|
|||
return item is Season;
|
||||
}
|
||||
|
||||
/// <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 (GetComparisonData(item) != providerInfo.Data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.NeedsRefreshInternal(item, providerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(BaseItem item)
|
||||
protected override DateTime CompareDate(BaseItem item)
|
||||
{
|
||||
var season = (Season)item;
|
||||
var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;
|
||||
|
@ -78,24 +57,13 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
||||
|
||||
return GetComparisonData(imagesFileInfo);
|
||||
}
|
||||
|
||||
return Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="imagesFileInfo">The images file info.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(FileInfo imagesFileInfo)
|
||||
if (imagesFileInfo.Exists)
|
||||
{
|
||||
var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
||||
return imagesFileInfo.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
||||
var key = date.Ticks + imagesFileInfo.FullName;
|
||||
|
||||
return key.GetMD5();
|
||||
return base.CompareDate(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -138,8 +106,6 @@ namespace MediaBrowser.Providers.TV
|
|||
item.ProviderData[Id] = data;
|
||||
}
|
||||
|
||||
data.Data = GetComparisonData(imagesFileInfo);
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -117,20 +117,10 @@ namespace MediaBrowser.Providers.TV
|
|||
return false;
|
||||
}
|
||||
|
||||
if (GetComparisonData(item) != providerInfo.Data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.NeedsRefreshInternal(item, providerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(BaseItem item)
|
||||
protected override DateTime CompareDate(BaseItem item)
|
||||
{
|
||||
var episode = (Episode)item;
|
||||
|
||||
|
@ -143,24 +133,13 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var seriesXmlFileInfo = new FileInfo(seriesXmlPath);
|
||||
|
||||
return GetComparisonData(seriesXmlFileInfo);
|
||||
}
|
||||
|
||||
return Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="seriesXmlFileInfo">The series XML file info.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(FileInfo seriesXmlFileInfo)
|
||||
if (seriesXmlFileInfo.Exists)
|
||||
{
|
||||
var date = seriesXmlFileInfo.Exists ? seriesXmlFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
||||
return seriesXmlFileInfo.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
||||
var key = date.Ticks + seriesXmlFileInfo.FullName;
|
||||
|
||||
return key.GetMD5();
|
||||
return base.CompareDate(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -207,8 +186,6 @@ namespace MediaBrowser.Providers.TV
|
|||
item.ProviderData[Id] = data;
|
||||
}
|
||||
|
||||
data.Data = GetComparisonData(seriesXmlFileInfo);
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow, status);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -104,28 +104,7 @@ namespace MediaBrowser.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
/// <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 (GetComparisonData(item) != providerInfo.Data)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.NeedsRefreshInternal(item, providerInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(BaseItem item)
|
||||
protected override DateTime CompareDate(BaseItem item)
|
||||
{
|
||||
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
||||
|
||||
|
@ -136,24 +115,13 @@ namespace MediaBrowser.Providers.TV
|
|||
|
||||
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
||||
|
||||
return GetComparisonData(imagesFileInfo);
|
||||
}
|
||||
|
||||
return Guid.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the comparison data.
|
||||
/// </summary>
|
||||
/// <param name="imagesFileInfo">The images file info.</param>
|
||||
/// <returns>Guid.</returns>
|
||||
private Guid GetComparisonData(FileInfo imagesFileInfo)
|
||||
if (imagesFileInfo.Exists)
|
||||
{
|
||||
var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
||||
return imagesFileInfo.LastWriteTimeUtc;
|
||||
}
|
||||
}
|
||||
|
||||
var key = date.Ticks + imagesFileInfo.FullName;
|
||||
|
||||
return key.GetMD5();
|
||||
return base.CompareDate(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -195,8 +163,6 @@ namespace MediaBrowser.Providers.TV
|
|||
item.ProviderData[Id] = data;
|
||||
}
|
||||
|
||||
data.Data = GetComparisonData(imagesFileInfo);
|
||||
|
||||
SetLastRefreshed(item, DateTime.UtcNow);
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user