diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 83690c243..c59094cbf 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.IO;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
@@ -193,18 +194,23 @@ namespace MediaBrowser.Controller.Entities
///
/// The _file system stamp
///
- private string _fileSystemStamp;
+ private Guid? _fileSystemStamp;
///
/// 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.
///
/// The file system stamp.
[IgnoreDataMember]
- public string FileSystemStamp
+ public Guid FileSystemStamp
{
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.
///
/// Guid.
- private string GetFileSystemStamp()
+ private Guid GetFileSystemStamp()
{
// If there's no path or the item is a file, there's nothing to do
if (LocationType != LocationType.FileSystem || !ResolveArgs.IsDirectory)
{
- return string.Empty;
+ return Guid.Empty;
}
var sb = new StringBuilder();
@@ -247,7 +253,7 @@ namespace MediaBrowser.Controller.Entities
sb.Append(file.cFileName);
}
- return sb.ToString();
+ return sb.ToString().GetMD5();
}
///
diff --git a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
index dd03c88de..ed9e50f82 100644
--- a/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
+++ b/MediaBrowser.Controller/Providers/BaseMetadataProvider.cs
@@ -142,7 +142,7 @@ namespace MediaBrowser.Controller.Providers
// Save the file system stamp for future comparisons
if (RefreshOnFileSystemStampChange)
{
- data.FileSystemStamp = GetCurrentFileSystemStamp(item);
+ data.FileStamp = GetCurrentFileSystemStamp(item);
}
item.ProviderData[Id] = data;
@@ -229,7 +229,7 @@ namespace MediaBrowser.Controller.Providers
/// true if [has file system stamp changed] [the specified item]; otherwise, false.
protected bool HasFileSystemStampChanged(BaseItem item, BaseProviderInfo providerInfo)
{
- return !String.Equals(GetCurrentFileSystemStamp(item), providerInfo.FileSystemStamp);
+ return GetCurrentFileSystemStamp(item) != providerInfo.FileStamp;
}
///
@@ -287,7 +287,7 @@ namespace MediaBrowser.Controller.Providers
///
/// The item.
/// Guid.
- private string GetCurrentFileSystemStamp(BaseItem item)
+ private Guid GetCurrentFileSystemStamp(BaseItem item)
{
if (UseParentFileSystemStamp(item) && item.Parent != null)
{
diff --git a/MediaBrowser.Controller/Providers/BaseProviderInfo.cs b/MediaBrowser.Controller/Providers/BaseProviderInfo.cs
index 23779d382..6262392fd 100644
--- a/MediaBrowser.Controller/Providers/BaseProviderInfo.cs
+++ b/MediaBrowser.Controller/Providers/BaseProviderInfo.cs
@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Providers
/// Gets or sets the file system stamp.
///
/// The file system stamp.
- public string FileSystemStamp { get; set; }
+ public Guid FileStamp { get; set; }
///
/// Gets or sets the last refresh status.
///
diff --git a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs
index 165b996f6..c846fcd97 100644
--- a/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs
+++ b/MediaBrowser.Controller/Providers/Music/LastfmArtistProvider.cs
@@ -76,7 +76,11 @@ namespace MediaBrowser.Controller.Providers.Music
var ms = new MemoryStream();
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);
diff --git a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs
index 36e6416ce..979679916 100644
--- a/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs
+++ b/MediaBrowser.Server.Implementations/Providers/ProviderManager.cs
@@ -125,14 +125,14 @@ namespace MediaBrowser.Server.Implementations.Providers
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;
item.ProviderData.TryGetValue(_supportedProvidersKey, out supportedProvidersInfo);
if (supportedProvidersInfo != null)
{
// 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 (providersChanged)
@@ -144,7 +144,7 @@ namespace MediaBrowser.Server.Implementations.Providers
if (providersChanged)
{
- supportedProvidersInfo.FileSystemStamp = supportedProvidersValue;
+ supportedProvidersInfo.CustomData = supportedProvidersValue;
}
if (force) item.ClearMetaValues();