|
|
@ -1,4 +1,5 @@
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
using MediaBrowser.Common.IO;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
|
|
@ -268,7 +269,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.ScreenshotImagePaths[imageIndex.Value] = path;
|
|
|
|
item.ScreenshotImagePaths[imageIndex.Value] = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else if (!item.ScreenshotImagePaths.Contains(path, StringComparer.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.ScreenshotImagePaths.Add(path);
|
|
|
|
item.ScreenshotImagePaths.Add(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -282,7 +283,7 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.BackdropImagePaths[imageIndex.Value] = path;
|
|
|
|
item.BackdropImagePaths[imageIndex.Value] = path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else if (!item.BackdropImagePaths.Contains(path, StringComparer.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
item.BackdropImagePaths.Add(path);
|
|
|
|
item.BackdropImagePaths.Add(path);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -333,14 +334,14 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException("imageIndex");
|
|
|
|
throw new ArgumentNullException("imageIndex");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filename = imageIndex.Value == 0 ? "backdrop" : "backdrop" + imageIndex.Value.ToString(UsCulture);
|
|
|
|
filename = GetBackdropSaveFilename(item.BackdropImagePaths, "backdrop", "backdrop", imageIndex.Value);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case ImageType.Screenshot:
|
|
|
|
case ImageType.Screenshot:
|
|
|
|
if (!imageIndex.HasValue)
|
|
|
|
if (!imageIndex.HasValue)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new ArgumentNullException("imageIndex");
|
|
|
|
throw new ArgumentNullException("imageIndex");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
filename = imageIndex.Value == 0 ? "screenshot" : "screenshot" + imageIndex.Value.ToString(UsCulture);
|
|
|
|
filename = GetBackdropSaveFilename(item.ScreenshotImagePaths, "screenshot", "screenshot", imageIndex.Value);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
filename = type.ToString().ToLower();
|
|
|
|
filename = type.ToString().ToLower();
|
|
|
@ -380,6 +381,24 @@ namespace MediaBrowser.Server.Implementations.Providers
|
|
|
|
return path;
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string GetBackdropSaveFilename(List<string> images, string zeroIndexFilename, string numberedIndexPrefix, int index)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var filesnames = images.Select(Path.GetFileNameWithoutExtension).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (index == 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return zeroIndexFilename;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var current = index;
|
|
|
|
|
|
|
|
while (filesnames.Contains(numberedIndexPrefix + current.ToString(UsCulture), StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
current++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return numberedIndexPrefix + current.ToString(UsCulture);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Gets the compatible save paths.
|
|
|
|
/// Gets the compatible save paths.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|