diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-01 14:24:27 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-10-01 14:24:27 -0400 |
| commit | 3d40c5ba36c5e98954c2bc6073b4cf35cd42711a (patch) | |
| tree | be7328c6d1d2193041c9b3dd00ff40fd0f825599 /MediaBrowser.Server.Implementations | |
| parent | 900266eb54e3b13219eb21e6d22fb34ce28059ab (diff) | |
fixed xml providers running over and over
Diffstat (limited to 'MediaBrowser.Server.Implementations')
6 files changed, 13 insertions, 40 deletions
diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index 305bede56..7a16747fb 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -225,10 +225,7 @@ namespace MediaBrowser.Server.Implementations.Drawing { var parentPath = Path.GetDirectoryName(cacheFilePath); - if (!Directory.Exists(parentPath)) - { - Directory.CreateDirectory(parentPath); - } + Directory.CreateDirectory(parentPath); // Save to the cache location using (var cacheFileStream = new FileStream(cacheFilePath, FileMode.Create, FileAccess.Write, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous)) @@ -374,10 +371,7 @@ namespace MediaBrowser.Server.Implementations.Drawing { var parentPath = Path.GetDirectoryName(croppedImagePath); - if (!Directory.Exists(parentPath)) - { - Directory.CreateDirectory(parentPath); - } + Directory.CreateDirectory(parentPath); using (var outputStream = new FileStream(croppedImagePath, FileMode.Create, FileAccess.Write, FileShare.Read)) { @@ -528,10 +522,7 @@ namespace MediaBrowser.Server.Implementations.Drawing var parentPath = Path.GetDirectoryName(fullCachePath); - if (!Directory.Exists(parentPath)) - { - Directory.CreateDirectory(parentPath); - } + Directory.CreateDirectory(parentPath); // Update the file system cache File.WriteAllText(fullCachePath, size.Width.ToString(UsCulture) + @"|" + size.Height.ToString(UsCulture)); @@ -701,10 +692,7 @@ namespace MediaBrowser.Server.Implementations.Drawing { var parentDirectory = Path.GetDirectoryName(enhancedImagePath); - if (!Directory.Exists(parentDirectory)) - { - Directory.CreateDirectory(parentDirectory); - } + Directory.CreateDirectory(parentDirectory); //And then save it in the cache using (var outputStream = new FileStream(enhancedImagePath, FileMode.Create, FileAccess.Write, FileShare.Read)) diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index ebbefb239..27b71cc8a 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -527,16 +527,13 @@ namespace MediaBrowser.Server.Implementations.Library { try { - if (f.Exists) - { - var item = ResolvePath(f, parent) as T; + var item = ResolvePath(f, parent) as T; - if (item != null) + if (item != null) + { + lock (list) { - lock (list) - { - list.Add(item); - } + list.Add(item); } } } diff --git a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs index b511ae80c..c9777e54a 100644 --- a/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs +++ b/MediaBrowser.Server.Implementations/Localization/LocalizationManager.cs @@ -48,10 +48,7 @@ namespace MediaBrowser.Server.Implementations.Localization var localizationPath = LocalizationPath; - if (!Directory.Exists(localizationPath)) - { - Directory.CreateDirectory(localizationPath); - } + Directory.CreateDirectory(localizationPath); var existingFiles = Directory.EnumerateFiles(localizationPath, "ratings-*.txt", SearchOption.TopDirectoryOnly) .Select(Path.GetFileName) diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs index 5ce44efd5..ee47dbd81 100644 --- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs +++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs @@ -322,10 +322,7 @@ namespace MediaBrowser.Server.Implementations.Persistence /// <returns>Task.</returns> public Task SaveCriticReviews(Guid itemId, IEnumerable<ItemReview> criticReviews) { - if (!Directory.Exists(_criticReviewsPath)) - { - Directory.CreateDirectory(_criticReviewsPath); - } + Directory.CreateDirectory(_criticReviewsPath); var path = Path.Combine(_criticReviewsPath, itemId + ".json"); diff --git a/MediaBrowser.Server.Implementations/Providers/ImageSaver.cs b/MediaBrowser.Server.Implementations/Providers/ImageSaver.cs index d8872f318..d0f4882e4 100644 --- a/MediaBrowser.Server.Implementations/Providers/ImageSaver.cs +++ b/MediaBrowser.Server.Implementations/Providers/ImageSaver.cs @@ -273,10 +273,7 @@ namespace MediaBrowser.Server.Implementations.Providers var parentPath = Path.GetDirectoryName(path); - if (!Directory.Exists(parentPath)) - { - Directory.CreateDirectory(parentPath); - } + Directory.CreateDirectory(parentPath); return path; } diff --git a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index 4829dc405..c82899948 100644 --- a/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/MediaBrowser.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -182,10 +182,7 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks var parentPath = Path.GetDirectoryName(failHistoryPath); - if (!Directory.Exists(parentPath)) - { - Directory.CreateDirectory(parentPath); - } + Directory.CreateDirectory(parentPath); File.WriteAllText(failHistoryPath, string.Join("|", previouslyFailedImages.ToArray())); } |
