sync image file names
This commit is contained in:
parent
b050772b77
commit
1fe1908aee
|
@ -122,6 +122,16 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
private void PopulateImages(IHasImages item, List<LocalImageInfo> images, List<FileSystemMetadata> files, bool supportParentSeriesFiles, IDirectoryService directoryService)
|
||||
{
|
||||
if (supportParentSeriesFiles)
|
||||
{
|
||||
var season = item as Season;
|
||||
|
||||
if (season != null)
|
||||
{
|
||||
PopulateSeasonImagesFromSeriesFolder(season, images, directoryService);
|
||||
}
|
||||
}
|
||||
|
||||
var imagePrefix = item.FileNameWithoutExtension + "-";
|
||||
var isInMixedFolder = item.IsInMixedFolder;
|
||||
|
||||
|
@ -151,33 +161,33 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
AddImage(files, images, "banner", imagePrefix, isInMixedFolder, ImageType.Banner);
|
||||
|
||||
// Thumb
|
||||
AddImage(files, images, "thumb", imagePrefix, isInMixedFolder, ImageType.Thumb);
|
||||
AddImage(files, images, "landscape", imagePrefix, isInMixedFolder, ImageType.Thumb);
|
||||
AddImage(files, images, "thumb", imagePrefix, isInMixedFolder, ImageType.Thumb);
|
||||
|
||||
PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder, directoryService);
|
||||
PopulateScreenshots(images, files, imagePrefix, isInMixedFolder);
|
||||
|
||||
if (supportParentSeriesFiles)
|
||||
{
|
||||
var season = item as Season;
|
||||
|
||||
if (season != null)
|
||||
{
|
||||
PopulateSeasonImagesFromSeriesFolder(season, images, directoryService);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulatePrimaryImages(IHasImages item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder)
|
||||
{
|
||||
var names = new List<string>
|
||||
{
|
||||
"folder",
|
||||
"poster",
|
||||
"cover",
|
||||
"default"
|
||||
};
|
||||
|
||||
if (item is MusicAlbum || item is MusicArtist)
|
||||
{
|
||||
// these prefer folder
|
||||
names.Insert(0, "poster");
|
||||
names.Insert(0, "folder");
|
||||
}
|
||||
else
|
||||
{
|
||||
names.Insert(0, "folder");
|
||||
names.Insert(0, "poster");
|
||||
}
|
||||
|
||||
// Support plex/kodi convention
|
||||
if (item is Series)
|
||||
{
|
||||
|
@ -212,8 +222,6 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
|
||||
private void PopulateBackdrops(IHasImages item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder, IDirectoryService directoryService)
|
||||
{
|
||||
PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", isInMixedFolder, ImageType.Backdrop);
|
||||
|
||||
if (!string.IsNullOrEmpty(item.Path))
|
||||
{
|
||||
var name = item.FileNameWithoutExtension;
|
||||
|
@ -241,6 +249,8 @@ namespace MediaBrowser.LocalMetadata.Images
|
|||
{
|
||||
PopulateBackdropsFromExtraFanart(extraFanartFolder.FullName, images, directoryService);
|
||||
}
|
||||
|
||||
PopulateBackdrops(images, files, imagePrefix, "backdrop", "backdrop", isInMixedFolder, ImageType.Backdrop);
|
||||
}
|
||||
|
||||
private void PopulateBackdropsFromExtraFanart(string path, List<LocalImageInfo> images, IDirectoryService directoryService)
|
||||
|
|
|
@ -332,7 +332,50 @@ namespace MediaBrowser.Providers.Manager
|
|||
/// </exception>
|
||||
private string GetStandardSavePath(IHasImages item, ImageType type, int? imageIndex, string mimeType, bool saveLocally)
|
||||
{
|
||||
var season = item as Season;
|
||||
var extension = MimeTypes.ToExtension(mimeType);
|
||||
|
||||
if (type == ImageType.Thumb && saveLocally)
|
||||
{
|
||||
if (season != null && season.IndexNumber.HasValue)
|
||||
{
|
||||
var seriesFolder = season.SeriesPath;
|
||||
|
||||
var seasonMarker = season.IndexNumber.Value == 0
|
||||
? "-specials"
|
||||
: season.IndexNumber.Value.ToString("00", UsCulture);
|
||||
|
||||
var imageFilename = "season" + seasonMarker + "-landscape" + extension;
|
||||
|
||||
return Path.Combine(seriesFolder, imageFilename);
|
||||
}
|
||||
|
||||
if (item.IsInMixedFolder)
|
||||
{
|
||||
return GetSavePathForItemInMixedFolder(item, type, "landscape", extension);
|
||||
}
|
||||
|
||||
return Path.Combine(item.ContainingFolderPath, "landscape" + extension);
|
||||
}
|
||||
|
||||
if (type == ImageType.Banner && saveLocally)
|
||||
{
|
||||
if (season != null && season.IndexNumber.HasValue)
|
||||
{
|
||||
var seriesFolder = season.SeriesPath;
|
||||
|
||||
var seasonMarker = season.IndexNumber.Value == 0
|
||||
? "-specials"
|
||||
: season.IndexNumber.Value.ToString("00", UsCulture);
|
||||
|
||||
var imageFilename = "season" + seasonMarker + "-banner" + extension;
|
||||
|
||||
return Path.Combine(seriesFolder, imageFilename);
|
||||
}
|
||||
}
|
||||
|
||||
string filename;
|
||||
var folderName = item is MusicAlbum || item is MusicArtist ? "folder" : "poster";
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -342,11 +385,14 @@ namespace MediaBrowser.Providers.Manager
|
|||
case ImageType.BoxRear:
|
||||
filename = "back";
|
||||
break;
|
||||
case ImageType.Thumb:
|
||||
filename = "landscape";
|
||||
break;
|
||||
case ImageType.Disc:
|
||||
filename = item is MusicAlbum ? "cdart" : "disc";
|
||||
break;
|
||||
case ImageType.Primary:
|
||||
filename = item is Episode ? _fileSystem.GetFileNameWithoutExtension(item.Path) : "folder";
|
||||
filename = item is Episode ? _fileSystem.GetFileNameWithoutExtension(item.Path) : folderName;
|
||||
break;
|
||||
case ImageType.Backdrop:
|
||||
filename = GetBackdropSaveFilename(item.GetImages(type), "backdrop", "backdrop", imageIndex);
|
||||
|
@ -359,8 +405,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
break;
|
||||
}
|
||||
|
||||
var extension = mimeType.Split('/').Last();
|
||||
|
||||
if (string.Equals(extension, "jpeg", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
extension = "jpg";
|
||||
|
@ -393,7 +437,7 @@ namespace MediaBrowser.Providers.Manager
|
|||
{
|
||||
if (string.IsNullOrEmpty(filename))
|
||||
{
|
||||
filename = "folder";
|
||||
filename = folderName;
|
||||
}
|
||||
path = Path.Combine(item.GetInternalMetadataPath(), filename + extension);
|
||||
}
|
||||
|
@ -526,45 +570,6 @@ namespace MediaBrowser.Providers.Manager
|
|||
return new[] { Path.Combine(item.ContainingFolderPath, "poster" + extension) };
|
||||
}
|
||||
|
||||
if (type == ImageType.Banner)
|
||||
{
|
||||
if (season != null && season.IndexNumber.HasValue)
|
||||
{
|
||||
var seriesFolder = season.SeriesPath;
|
||||
|
||||
var seasonMarker = season.IndexNumber.Value == 0
|
||||
? "-specials"
|
||||
: season.IndexNumber.Value.ToString("00", UsCulture);
|
||||
|
||||
var imageFilename = "season" + seasonMarker + "-banner" + extension;
|
||||
|
||||
return new[] { Path.Combine(seriesFolder, imageFilename) };
|
||||
}
|
||||
}
|
||||
|
||||
if (type == ImageType.Thumb)
|
||||
{
|
||||
if (season != null && season.IndexNumber.HasValue)
|
||||
{
|
||||
var seriesFolder = season.SeriesPath;
|
||||
|
||||
var seasonMarker = season.IndexNumber.Value == 0
|
||||
? "-specials"
|
||||
: season.IndexNumber.Value.ToString("00", UsCulture);
|
||||
|
||||
var imageFilename = "season" + seasonMarker + "-landscape" + extension;
|
||||
|
||||
return new[] { Path.Combine(seriesFolder, imageFilename) };
|
||||
}
|
||||
|
||||
if (item.IsInMixedFolder)
|
||||
{
|
||||
return new[] { GetSavePathForItemInMixedFolder(item, type, "landscape", extension) };
|
||||
}
|
||||
|
||||
return new[] { Path.Combine(item.ContainingFolderPath, "landscape" + extension) };
|
||||
}
|
||||
|
||||
// All other paths are the same
|
||||
return new[] { GetStandardSavePath(item, type, imageIndex, mimeType, true) };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user