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