made file stamp a guid again
This commit is contained in:
parent
b096f895ee
commit
7a5a1511cc
|
@ -1,4 +1,5 @@
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Common.Extensions;
|
||||||
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.IO;
|
using MediaBrowser.Controller.IO;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Localization;
|
using MediaBrowser.Controller.Localization;
|
||||||
|
@ -193,18 +194,23 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The _file system stamp
|
/// The _file system stamp
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string _fileSystemStamp;
|
private Guid? _fileSystemStamp;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a directory stamp, in the form of a string, that can be used for
|
/// Gets a directory stamp, in the form of a string, that can be used for
|
||||||
/// comparison purposes to determine if the file system entries for this item have changed.
|
/// comparison purposes to determine if the file system entries for this item have changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file system stamp.</value>
|
/// <value>The file system stamp.</value>
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public string FileSystemStamp
|
public Guid FileSystemStamp
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _fileSystemStamp ?? (_fileSystemStamp = GetFileSystemStamp());
|
if (!_fileSystemStamp.HasValue)
|
||||||
|
{
|
||||||
|
_fileSystemStamp = GetFileSystemStamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
return _fileSystemStamp.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,12 +232,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// comparison purposes to determine if the file system entries for this item have changed.
|
/// comparison purposes to determine if the file system entries for this item have changed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
private string GetFileSystemStamp()
|
private Guid GetFileSystemStamp()
|
||||||
{
|
{
|
||||||
// If there's no path or the item is a file, there's nothing to do
|
// If there's no path or the item is a file, there's nothing to do
|
||||||
if (LocationType != LocationType.FileSystem || !ResolveArgs.IsDirectory)
|
if (LocationType != LocationType.FileSystem || !ResolveArgs.IsDirectory)
|
||||||
{
|
{
|
||||||
return string.Empty;
|
return Guid.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
@ -247,7 +253,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
sb.Append(file.cFileName);
|
sb.Append(file.cFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString().GetMD5();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -142,7 +142,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
// Save the file system stamp for future comparisons
|
// Save the file system stamp for future comparisons
|
||||||
if (RefreshOnFileSystemStampChange)
|
if (RefreshOnFileSystemStampChange)
|
||||||
{
|
{
|
||||||
data.FileSystemStamp = GetCurrentFileSystemStamp(item);
|
data.FileStamp = GetCurrentFileSystemStamp(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
|
@ -229,7 +229,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <returns><c>true</c> if [has file system stamp changed] [the specified item]; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if [has file system stamp changed] [the specified item]; otherwise, <c>false</c>.</returns>
|
||||||
protected bool HasFileSystemStampChanged(BaseItem item, BaseProviderInfo providerInfo)
|
protected bool HasFileSystemStampChanged(BaseItem item, BaseProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
return !String.Equals(GetCurrentFileSystemStamp(item), providerInfo.FileSystemStamp);
|
return GetCurrentFileSystemStamp(item) != providerInfo.FileStamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -287,7 +287,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item">The item.</param>
|
/// <param name="item">The item.</param>
|
||||||
/// <returns>Guid.</returns>
|
/// <returns>Guid.</returns>
|
||||||
private string GetCurrentFileSystemStamp(BaseItem item)
|
private Guid GetCurrentFileSystemStamp(BaseItem item)
|
||||||
{
|
{
|
||||||
if (UseParentFileSystemStamp(item) && item.Parent != null)
|
if (UseParentFileSystemStamp(item) && item.Parent != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// Gets or sets the file system stamp.
|
/// Gets or sets the file system stamp.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The file system stamp.</value>
|
/// <value>The file system stamp.</value>
|
||||||
public string FileSystemStamp { get; set; }
|
public Guid FileStamp { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the last refresh status.
|
/// Gets or sets the last refresh status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -76,7 +76,11 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
var ms = new MemoryStream();
|
var ms = new MemoryStream();
|
||||||
JsonSerializer.SerializeToStream(result.artist, ms);
|
JsonSerializer.SerializeToStream(result.artist, ms);
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
if (cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
ms.Dispose();
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
}
|
||||||
|
|
||||||
await _providerManager.SaveToLibraryFilesystem(item, Path.Combine(item.MetaLocation, LocalMetaFileName), ms, cancellationToken).ConfigureAwait(false);
|
await _providerManager.SaveToLibraryFilesystem(item, Path.Combine(item.MetaLocation, LocalMetaFileName), ms, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
|
|
@ -125,14 +125,14 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||||
|
|
||||||
BaseProviderInfo supportedProvidersInfo;
|
BaseProviderInfo supportedProvidersInfo;
|
||||||
|
|
||||||
var supportedProvidersValue = string.Join("+", supportedProviders.Select(i => i.GetType().Name));
|
var supportedProvidersValue = string.Join(string.Empty, supportedProviders.Select(i => i.GetType().Name));
|
||||||
var providersChanged = false;
|
var providersChanged = false;
|
||||||
|
|
||||||
item.ProviderData.TryGetValue(_supportedProvidersKey, out supportedProvidersInfo);
|
item.ProviderData.TryGetValue(_supportedProvidersKey, out supportedProvidersInfo);
|
||||||
if (supportedProvidersInfo != null)
|
if (supportedProvidersInfo != null)
|
||||||
{
|
{
|
||||||
// Force refresh if the supported providers have changed
|
// Force refresh if the supported providers have changed
|
||||||
providersChanged = force = force || !string.Equals(supportedProvidersInfo.FileSystemStamp, supportedProvidersValue);
|
providersChanged = force = force || !string.Equals(supportedProvidersInfo.CustomData, supportedProvidersValue);
|
||||||
|
|
||||||
// If providers have changed, clear provider info and update the supported providers hash
|
// If providers have changed, clear provider info and update the supported providers hash
|
||||||
if (providersChanged)
|
if (providersChanged)
|
||||||
|
@ -144,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
||||||
|
|
||||||
if (providersChanged)
|
if (providersChanged)
|
||||||
{
|
{
|
||||||
supportedProvidersInfo.FileSystemStamp = supportedProvidersValue;
|
supportedProvidersInfo.CustomData = supportedProvidersValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (force) item.ClearMetaValues();
|
if (force) item.ClearMetaValues();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user