Merge pull request #3020 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-11-15 16:33:29 -05:00 committed by GitHub
commit 27681a963e
6 changed files with 125 additions and 26 deletions

View File

@ -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<string> GetPrimaryPlaylistVobFiles(string path, IIsoMount isoMount, uint? titleNumber);
}

View File

@ -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,36 +132,92 @@ namespace MediaBrowser.LocalMetadata.Images
PopulatePrimaryImages(item, images, files, imagePrefix, isInMixedFolder);
AddImage(files, images, "logo", imagePrefix, isInMixedFolder, ImageType.Logo);
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);
}
else
added = AddImage(files, images, "cdart", imagePrefix, isInMixedFolder, ImageType.Disc);
if (!added)
{
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);
}
}
else if (isGame || item is Video || item is BoxSet)
{
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);
}
}
if (isGame)
{
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);
added = AddImage(files, images, "back", imagePrefix, isInMixedFolder, ImageType.BoxRear);
if (!added)
{
added = AddImage(files, images, "boxrear", imagePrefix, isInMixedFolder, ImageType.BoxRear);
}
}
// 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);
}
}
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;
}
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}
/// <summary>
/// Gets the save paths.
/// </summary>

View File

@ -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);
}
}

View File

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.36.9")]
[assembly: AssemblyVersion("3.2.36.10")]