From 9f46122d91f54a277d455fe6579df2f6a23f480d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 15 Nov 2017 16:33:04 -0500 Subject: [PATCH] 3.2.36.10 --- .../MediaEncoding/IMediaEncoder.cs | 3 - .../Images/LocalImageProvider.cs | 104 ++++++++++++++---- .../Savers/BaseXmlSaver.cs | 14 ++- MediaBrowser.Providers/Manager/ImageSaver.cs | 14 ++- .../Savers/BaseNfoSaver.cs | 14 ++- SharedVersion.cs | 2 +- 6 files changed, 125 insertions(+), 26 deletions(-) diff --git a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs index 31cd96c9a..2712380c7 100644 --- a/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs +++ b/MediaBrowser.Controller/MediaEncoding/IMediaEncoder.cs @@ -118,9 +118,6 @@ namespace MediaBrowser.Controller.MediaEncoding void UpdateEncoderPath(string path, string pathType); bool SupportsEncoder(string encoder); - void SetLogFilename(string name); - void ClearLogFilename(); - string[] GetPlayableStreamFileNames(string path, VideoType videoType); IEnumerable GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber); } diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index 56a2c271f..2901f51d5 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.Linq; using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; +using MediaBrowser.Controller.Entities.Movies; namespace MediaBrowser.LocalMetadata.Images { @@ -131,35 +132,91 @@ namespace MediaBrowser.LocalMetadata.Images PopulatePrimaryImages(item, images, files, imagePrefix, isInMixedFolder); - AddImage(files, images, "logo", imagePrefix, isInMixedFolder, ImageType.Logo); - AddImage(files, images, "clearart", imagePrefix, isInMixedFolder, ImageType.Art); + var added = false; + var isEpisode = item is Episode; + var isSong = item.GetType() == typeof(Audio); + var isGame = item is Game; + var isPerson = item is Person; + + // Logo + if (!isEpisode && !isSong && !isPerson) + { + added = AddImage(files, images, "logo", imagePrefix, isInMixedFolder, ImageType.Logo); + if (!added) + { + added = AddImage(files, images, "clearlogo", imagePrefix, isInMixedFolder, ImageType.Logo); + } + } + + // Art + if (!isEpisode && !isSong && !isPerson) + { + AddImage(files, images, "clearart", imagePrefix, isInMixedFolder, ImageType.Art); + } // For music albums, prefer cdart before disc if (item is MusicAlbum) { - AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc); - AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); + added = AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc); + + if (!added) + { + added = AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); + } } - else + else if (isGame || item is Video || item is BoxSet) { - AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); - AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc); + added = AddImage(files, images, "disc", imagePrefix, isInMixedFolder, ImageType.Disc); + + if (!added) + { + added = AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc); + } + + if (!added) + { + added = AddImage(files, images, "discart", imagePrefix, isInMixedFolder, ImageType.Disc); + } } - AddImage(files, images, "box", imagePrefix, isInMixedFolder, ImageType.Box); - AddImage(files, images, "back", imagePrefix, isInMixedFolder, ImageType.BoxRear); - AddImage(files, images, "boxrear", imagePrefix, isInMixedFolder, ImageType.BoxRear); - AddImage(files, images, "menu", imagePrefix, isInMixedFolder, ImageType.Menu); + if (isGame) + { + AddImage(files, images, "box", imagePrefix, isInMixedFolder, ImageType.Box); + AddImage(files, images, "menu", imagePrefix, isInMixedFolder, ImageType.Menu); + + added = AddImage(files, images, "back", imagePrefix, isInMixedFolder, ImageType.BoxRear); + + if (!added) + { + added = AddImage(files, images, "boxrear", imagePrefix, isInMixedFolder, ImageType.BoxRear); + } + } // Banner - AddImage(files, images, "banner", imagePrefix, isInMixedFolder, ImageType.Banner); + if (!isEpisode && !isSong && !isPerson) + { + AddImage(files, images, "banner", imagePrefix, isInMixedFolder, ImageType.Banner); + } // Thumb - AddImage(files, images, "landscape", imagePrefix, isInMixedFolder, ImageType.Thumb); - AddImage(files, images, "thumb", imagePrefix, isInMixedFolder, ImageType.Thumb); + if (!isEpisode && !isSong && !isPerson) + { + added = AddImage(files, images, "landscape", imagePrefix, isInMixedFolder, ImageType.Thumb); + if (!added) + { + added = AddImage(files, images, "thumb", imagePrefix, isInMixedFolder, ImageType.Thumb); + } + } - PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder, directoryService); - PopulateScreenshots(images, files, imagePrefix, isInMixedFolder); + if (!isEpisode && !isSong && !isPerson) + { + PopulateBackdrops(item, images, files, imagePrefix, isInMixedFolder, directoryService); + } + + if (item is IHasScreenshots) + { + PopulateScreenshots(images, files, imagePrefix, isInMixedFolder); + } } private static readonly string[] CommonImageFileNames = new[] @@ -232,19 +289,28 @@ namespace MediaBrowser.LocalMetadata.Images var fileNameWithoutExtension = item.FileNameWithoutExtension; if (!string.IsNullOrEmpty(fileNameWithoutExtension)) { - AddImage(files, images, fileNameWithoutExtension, ImageType.Primary); + if (AddImage(files, images, fileNameWithoutExtension, ImageType.Primary)) + { + return; + } } foreach (var name in imageFileNames) { - AddImage(files, images, imagePrefix + name, ImageType.Primary); + if (AddImage(files, images, imagePrefix + name, ImageType.Primary)) + { + return; + } } if (!isInMixedFolder) { foreach (var name in imageFileNames) { - AddImage(files, images, name, ImageType.Primary); + if (AddImage(files, images, name, ImageType.Primary)) + { + return; + } } } } diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index 259f42391..a3800e5c1 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -226,7 +226,19 @@ namespace MediaBrowser.LocalMetadata.Savers if (wasHidden || ConfigurationManager.Configuration.SaveMetadataHidden) { - FileSystem.SetHidden(path, true); + SetHidden(path, true); + } + } + + private void SetHidden(string path, bool hidden) + { + try + { + FileSystem.SetHidden(path, hidden); + } + catch (Exception ex) + { + Logger.Error("Error setting hidden attribute on {0} - {1}", path, ex.Message); } } diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 7fdbdbcc7..4bf5e9208 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -256,7 +256,7 @@ namespace MediaBrowser.Providers.Manager if (_config.Configuration.SaveMetadataHidden) { - _fileSystem.SetHidden(path, true); + SetHidden(path, true); } } finally @@ -266,6 +266,18 @@ namespace MediaBrowser.Providers.Manager } } + private void SetHidden(string path, bool hidden) + { + try + { + _fileSystem.SetHidden(path, hidden); + } + catch (Exception ex) + { + _logger.Error("Error setting hidden attribute on {0} - {1}", path, ex.Message); + } + } + /// /// Gets the save paths. /// diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 41c376ddf..d32081458 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -229,7 +229,19 @@ namespace MediaBrowser.XbmcMetadata.Savers if (wasHidden || ConfigurationManager.Configuration.SaveMetadataHidden) { - FileSystem.SetHidden(path, true); + SetHidden(path, true); + } + } + + private void SetHidden(string path, bool hidden) + { + try + { + FileSystem.SetHidden(path, hidden); + } + catch (Exception ex) + { + Logger.Error("Error setting hidden attribute on {0} - {1}", path, ex.Message); } } diff --git a/SharedVersion.cs b/SharedVersion.cs index 812369b17..1e024ec44 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.36.9")] +[assembly: AssemblyVersion("3.2.36.10")]