improve handling of deleted images

This commit is contained in:
Luke Pulverenti 2016-01-06 12:55:44 -05:00
parent 4936ebf74c
commit 67f9a986a7
3 changed files with 11 additions and 2 deletions

View File

@ -170,4 +170,4 @@ namespace MediaBrowser.Providers.Folders
return GetSupportedImages(item).Any(i => !item.HasImage(i));
}
}
}
}

View File

@ -359,12 +359,13 @@ namespace MediaBrowser.Providers.Manager
private void ClearImages(IHasImages item, ImageType type)
{
var deleted = false;
var deletedImages = new List<ItemImageInfo>();
foreach (var image in item.GetImages(type).ToList())
{
if (!image.IsLocalFile)
{
// TODO: Need to get this image removed
deletedImages.Add(image);
continue;
}
@ -384,6 +385,11 @@ namespace MediaBrowser.Providers.Manager
}
}
foreach (var image in deletedImages)
{
item.RemoveImage(image);
}
if (deleted)
{
item.ValidateImages(new DirectoryService(_logger, _fileSystem));

View File

@ -15,6 +15,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
@ -130,6 +131,8 @@ namespace MediaBrowser.Providers.Subtitles
try
{
//var isText = MediaStream.IsTextFormat(response.Format);
using (var fs = _fileSystem.GetFileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.Read, true))
{
await stream.CopyToAsync(fs).ConfigureAwait(false);