Eric Reed 11 years ago
commit 8999ef9441

@ -165,7 +165,8 @@ namespace MediaBrowser.Server.Implementations.Dto
{ {
var folder = (Folder)item; var folder = (Folder)item;
dto.ChildCount = folder.GetChildren(user, true).Count(); dto.ChildCount = folder.GetChildren(user, true)
.Count();
if (!(folder is UserRootFolder)) if (!(folder is UserRootFolder))
{ {

@ -67,7 +67,8 @@ namespace MediaBrowser.Server.Implementations.IO
public async void RemoveTempIgnore(string path) public async void RemoveTempIgnore(string path)
{ {
// This is an arbitraty amount of time, but delay it because file system writes often trigger events after RemoveTempIgnore has been called. // This is an arbitraty amount of time, but delay it because file system writes often trigger events after RemoveTempIgnore has been called.
await Task.Delay(2000).ConfigureAwait(false); // Seeing long delays in some situations, especially over the network.
await Task.Delay(40000).ConfigureAwait(false);
string val; string val;
_tempIgnoredPaths.TryRemove(path, out val); _tempIgnoredPaths.TryRemove(path, out val);

@ -13,6 +13,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Server.Implementations.Providers namespace MediaBrowser.Server.Implementations.Providers
{ {
@ -37,17 +38,19 @@ namespace MediaBrowser.Server.Implementations.Providers
/// </summary> /// </summary>
private readonly IDirectoryWatchers _directoryWatchers; private readonly IDirectoryWatchers _directoryWatchers;
private readonly IFileSystem _fileSystem; private readonly IFileSystem _fileSystem;
private readonly ILogger _logger;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="ImageSaver"/> class. /// Initializes a new instance of the <see cref="ImageSaver"/> class.
/// </summary> /// </summary>
/// <param name="config">The config.</param> /// <param name="config">The config.</param>
/// <param name="directoryWatchers">The directory watchers.</param> /// <param name="directoryWatchers">The directory watchers.</param>
public ImageSaver(IServerConfigurationManager config, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem) public ImageSaver(IServerConfigurationManager config, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem, ILogger logger)
{ {
_config = config; _config = config;
_directoryWatchers = directoryWatchers; _directoryWatchers = directoryWatchers;
_fileSystem = fileSystem; _fileSystem = fileSystem;
_logger = logger;
_remoteImageCache = new FileSystemRepository(config.ApplicationPaths.DownloadedImagesDataPath); _remoteImageCache = new FileSystemRepository(config.ApplicationPaths.DownloadedImagesDataPath);
} }
@ -170,7 +173,12 @@ namespace MediaBrowser.Server.Implementations.Providers
/// <returns>Task.</returns> /// <returns>Task.</returns>
private async Task SaveImageToLocation(Stream source, string path, CancellationToken cancellationToken) private async Task SaveImageToLocation(Stream source, string path, CancellationToken cancellationToken)
{ {
_logger.Debug("Saving image to {0}", path);
var parentFolder = Path.GetDirectoryName(path);
_directoryWatchers.TemporarilyIgnore(path); _directoryWatchers.TemporarilyIgnore(path);
_directoryWatchers.TemporarilyIgnore(parentFolder);
try try
{ {
@ -196,6 +204,7 @@ namespace MediaBrowser.Server.Implementations.Providers
finally finally
{ {
_directoryWatchers.RemoveTempIgnore(path); _directoryWatchers.RemoveTempIgnore(path);
_directoryWatchers.RemoveTempIgnore(parentFolder);
} }
} }

@ -349,7 +349,7 @@ namespace MediaBrowser.Server.Implementations.Providers
/// <returns>Task.</returns> /// <returns>Task.</returns>
public Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, string sourceUrl, CancellationToken cancellationToken) public Task SaveImage(BaseItem item, Stream source, string mimeType, ImageType type, int? imageIndex, string sourceUrl, CancellationToken cancellationToken)
{ {
return new ImageSaver(ConfigurationManager, _directoryWatchers, _fileSystem).SaveImage(item, source, mimeType, type, imageIndex, sourceUrl, cancellationToken); return new ImageSaver(ConfigurationManager, _directoryWatchers, _fileSystem, _logger).SaveImage(item, source, mimeType, type, imageIndex, sourceUrl, cancellationToken);
} }
/// <summary> /// <summary>

Loading…
Cancel
Save