|
|
|
@ -146,7 +146,8 @@ namespace MediaBrowser.Controller.Providers
|
|
|
|
|
/// <returns>FileSystemInfo.</returns>
|
|
|
|
|
protected virtual FileSystemInfo GetImage(BaseItem item, string filenameWithoutExtension)
|
|
|
|
|
{
|
|
|
|
|
return item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.ResolveArgs.Path, filenameWithoutExtension + ".png")) ?? item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.ResolveArgs.Path, filenameWithoutExtension + ".jpg"));
|
|
|
|
|
return item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.ResolveArgs.Path, filenameWithoutExtension + ".png"))
|
|
|
|
|
?? item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.ResolveArgs.Path, filenameWithoutExtension + ".jpg"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -155,11 +156,13 @@ namespace MediaBrowser.Controller.Providers
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
private void PopulateBaseItemImages(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
var backdropFiles = new List<string>();
|
|
|
|
|
var screenshotFiles = new List<string>();
|
|
|
|
|
|
|
|
|
|
// Primary Image
|
|
|
|
|
var image = GetImage(item, "folder");
|
|
|
|
|
var image = GetImage(item, "folder") ??
|
|
|
|
|
GetImage(item, "poster") ??
|
|
|
|
|
GetImage(item, "cover") ??
|
|
|
|
|
GetImage(item, "default");
|
|
|
|
|
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
@ -223,22 +226,25 @@ namespace MediaBrowser.Controller.Providers
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Backdrop Image
|
|
|
|
|
image = GetImage(item, "backdrop");
|
|
|
|
|
PopulateBackdrops(item);
|
|
|
|
|
|
|
|
|
|
// Screenshot Image
|
|
|
|
|
image = GetImage(item, "screenshot");
|
|
|
|
|
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
|
backdropFiles.Add(image.FullName);
|
|
|
|
|
screenshotFiles.Add(image.FullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var unfound = 0;
|
|
|
|
|
for (var i = 1; i <= 20; i++)
|
|
|
|
|
{
|
|
|
|
|
// Backdrop Image
|
|
|
|
|
image = GetImage(item, "backdrop" + i);
|
|
|
|
|
// Screenshot Image
|
|
|
|
|
image = GetImage(item, "screenshot" + i);
|
|
|
|
|
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
|
backdropFiles.Add(image.FullName);
|
|
|
|
|
screenshotFiles.Add(image.FullName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -251,28 +257,57 @@ namespace MediaBrowser.Controller.Providers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (screenshotFiles.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
item.ScreenshotImagePaths = screenshotFiles;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Populates the backdrops.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
private void PopulateBackdrops(BaseItem item)
|
|
|
|
|
{
|
|
|
|
|
var backdropFiles = new List<string>();
|
|
|
|
|
|
|
|
|
|
PopulateBackdrops(item, backdropFiles, "backdrop", "backdrop");
|
|
|
|
|
|
|
|
|
|
// Support plex/xbmc conventions
|
|
|
|
|
PopulateBackdrops(item, backdropFiles, "fanart", "fanart-");
|
|
|
|
|
PopulateBackdrops(item, backdropFiles, "background", "background-");
|
|
|
|
|
|
|
|
|
|
if (backdropFiles.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
item.BackdropImagePaths = backdropFiles;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Screenshot Image
|
|
|
|
|
image = GetImage(item, "screenshot");
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Populates the backdrops.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="backdropFiles">The backdrop files.</param>
|
|
|
|
|
/// <param name="filename">The filename.</param>
|
|
|
|
|
/// <param name="numberedSuffix">The numbered suffix.</param>
|
|
|
|
|
private void PopulateBackdrops(BaseItem item, List<string> backdropFiles, string filename, string numberedSuffix)
|
|
|
|
|
{
|
|
|
|
|
var image = GetImage(item, filename);
|
|
|
|
|
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
|
screenshotFiles.Add(image.FullName);
|
|
|
|
|
backdropFiles.Add(image.FullName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
unfound = 0;
|
|
|
|
|
var unfound = 0;
|
|
|
|
|
for (var i = 1; i <= 20; i++)
|
|
|
|
|
{
|
|
|
|
|
// Screenshot Image
|
|
|
|
|
image = GetImage(item, "screenshot" + i);
|
|
|
|
|
// Backdrop Image
|
|
|
|
|
image = GetImage(item, numberedSuffix + i);
|
|
|
|
|
|
|
|
|
|
if (image != null)
|
|
|
|
|
{
|
|
|
|
|
screenshotFiles.Add(image.FullName);
|
|
|
|
|
backdropFiles.Add(image.FullName);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
@ -284,11 +319,6 @@ namespace MediaBrowser.Controller.Providers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (screenshotFiles.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
item.ScreenshotImagePaths = screenshotFiles;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|