update details

This commit is contained in:
Luke Pulverenti 2016-12-03 02:58:48 -05:00
parent 4a9c77c327
commit 68772e7d9b
10 changed files with 32 additions and 79 deletions

View File

@ -148,7 +148,7 @@ namespace Emby.Drawing.ImageMagick
{
using (var originalImage = new MagickWand(inputPath))
{
ScaleImage(originalImage, width, height);
ScaleImage(originalImage, width, height, options.Blur ?? 0);
if (autoOrient)
{
@ -170,7 +170,7 @@ namespace Emby.Drawing.ImageMagick
{
using (var originalImage = new MagickWand(inputPath))
{
ScaleImage(originalImage, width, height);
ScaleImage(originalImage, width, height, options.Blur ?? 0);
if (autoOrient)
{
@ -221,13 +221,13 @@ namespace Emby.Drawing.ImageMagick
}
}
private void ScaleImage(MagickWand wand, int width, int height)
private void ScaleImage(MagickWand wand, int width, int height, int blur)
{
var highQuality = false;
var useResize = blur > 1;
if (highQuality)
if (useResize)
{
wand.CurrentImage.ResizeImage(width, height);
wand.CurrentImage.ResizeImage(width, height, FilterTypes.GaussianFilter, blur);
}
else
{

View File

@ -236,7 +236,7 @@ namespace Emby.Drawing
var quality = options.Quality;
var outputFormat = GetOutputFormat(options.SupportedOutputFormats[0]);
var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, outputFormat, options.AddPlayedIndicator, options.PercentPlayed, options.UnplayedCount, options.BackgroundColor, options.ForegroundLayer);
var cacheFilePath = GetCacheFilePath(originalImagePath, newSize, quality, dateModified, outputFormat, options.AddPlayedIndicator, options.PercentPlayed, options.UnplayedCount, options.Blur, options.BackgroundColor, options.ForegroundLayer);
var imageProcessingLockTaken = false;
@ -469,7 +469,7 @@ namespace Emby.Drawing
/// <summary>
/// Gets the cache file path based on a set of parameters
/// </summary>
private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, string backgroundColor, string foregroundLayer)
private string GetCacheFilePath(string originalPath, ImageSize outputSize, int quality, DateTime dateModified, ImageFormat format, bool addPlayedIndicator, double percentPlayed, int? unwatchedCount, int? blur, string backgroundColor, string foregroundLayer)
{
var filename = originalPath;
@ -498,6 +498,11 @@ namespace Emby.Drawing
filename += "p=" + unwatchedCount.Value;
}
if (blur.HasValue)
{
filename += "blur=" + blur.Value;
}
if (!string.IsNullOrEmpty(backgroundColor))
{
filename += "b=" + backgroundColor;

View File

@ -47,36 +47,6 @@ namespace Emby.Server.Implementations.Library.Validators
_fileSystem = fileSystem;
}
private bool DownloadMetadata(PersonInfo i, PeopleMetadataOptions options)
{
if (i.IsType(PersonType.Actor))
{
return options.DownloadActorMetadata;
}
if (i.IsType(PersonType.Director))
{
return options.DownloadDirectorMetadata;
}
if (i.IsType(PersonType.Composer))
{
return options.DownloadComposerMetadata;
}
if (i.IsType(PersonType.Writer))
{
return options.DownloadWriterMetadata;
}
if (i.IsType(PersonType.Producer))
{
return options.DownloadProducerMetadata;
}
if (i.IsType(PersonType.GuestStar))
{
return options.DownloadGuestStarMetadata;
}
return options.DownloadOtherPeopleMetadata;
}
/// <summary>
/// Validates the people.
/// </summary>
@ -89,28 +59,13 @@ namespace Emby.Server.Implementations.Library.Validators
innerProgress.RegisterAction(pct => progress.Report(pct * .15));
var peopleOptions = _config.Configuration.PeopleMetadataOptions;
var people = _libraryManager.GetPeople(new InternalPeopleQuery());
var dict = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
foreach (var person in people)
{
var isMetadataEnabled = DownloadMetadata(person, peopleOptions);
bool currentValue;
if (dict.TryGetValue(person.Name, out currentValue))
{
if (!currentValue && isMetadataEnabled)
{
dict[person.Name] = true;
}
}
else
{
dict[person.Name] = isMetadataEnabled;
}
dict[person.Name] = true;
}
var numComplete = 0;

View File

@ -64,6 +64,8 @@ namespace MediaBrowser.Api.Images
[ApiMember(Name = "UnplayedCount", Description = "Optional unplayed count overlay to render", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? UnplayedCount { get; set; }
public int? Blur { get; set; }
[ApiMember(Name = "BackgroundColor", Description = "Optional. Apply a background color for transparent images.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string BackgroundColor { get; set; }

View File

@ -624,6 +624,7 @@ namespace MediaBrowser.Api.Images
AddPlayedIndicator = request.AddPlayedIndicator,
PercentPlayed = request.PercentPlayed ?? 0,
UnplayedCount = request.UnplayedCount,
Blur = request.Blur,
BackgroundColor = request.BackgroundColor,
ForegroundLayer = request.ForegroundLayer,
SupportedOutputFormats = supportedFormats

View File

@ -35,6 +35,7 @@ namespace MediaBrowser.Controller.Drawing
public bool AddPlayedIndicator { get; set; }
public int? UnplayedCount { get; set; }
public int? Blur { get; set; }
public double PercentPlayed { get; set; }
@ -84,6 +85,7 @@ namespace MediaBrowser.Controller.Drawing
!AddPlayedIndicator &&
PercentPlayed.Equals(0) &&
!UnplayedCount.HasValue &&
!Blur.HasValue &&
string.IsNullOrEmpty(BackgroundColor) &&
string.IsNullOrEmpty(ForegroundLayer);
}

View File

@ -1,19 +0,0 @@
namespace MediaBrowser.Model.Configuration
{
public class PeopleMetadataOptions
{
public bool DownloadActorMetadata { get; set; }
public bool DownloadDirectorMetadata { get; set; }
public bool DownloadProducerMetadata { get; set; }
public bool DownloadWriterMetadata { get; set; }
public bool DownloadComposerMetadata { get; set; }
public bool DownloadOtherPeopleMetadata { get; set; }
public bool DownloadGuestStarMetadata { get; set; }
public PeopleMetadataOptions()
{
DownloadActorMetadata = true;
DownloadDirectorMetadata = true;
}
}
}

View File

@ -181,8 +181,6 @@ namespace MediaBrowser.Model.Configuration
public string UICulture { get; set; }
public PeopleMetadataOptions PeopleMetadataOptions { get; set; }
public bool SaveMetadataHidden { get; set; }
public NameValuePair[] ContentTypes { get; set; }
@ -260,8 +258,6 @@ namespace MediaBrowser.Model.Configuration
UICulture = "en-us";
PeopleMetadataOptions = new PeopleMetadataOptions();
MetadataOptions = new[]
{
new MetadataOptions(1, 1280) {ItemType = "Book"},

View File

@ -118,7 +118,9 @@ namespace MediaBrowser.Model.Entities
private string AddLanguageIfNeeded(string title)
{
if (!string.IsNullOrEmpty(Language) && !string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) && title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) == -1)
if (!string.IsNullOrEmpty(Language) &&
!string.Equals(Language, "und", StringComparison.OrdinalIgnoreCase) &&
!IsLanguageInTitle(title, Language))
{
title = StringHelper.FirstToUpper(Language) + " " + title;
}
@ -126,6 +128,16 @@ namespace MediaBrowser.Model.Entities
return title;
}
private bool IsLanguageInTitle(string title, string language)
{
if (title.IndexOf(Language, StringComparison.OrdinalIgnoreCase) != -1)
{
return true;
}
return false;
}
public string NalLengthSize { get; set; }
/// <summary>

View File

@ -84,7 +84,6 @@
<Compile Include="Configuration\FanartOptions.cs" />
<Compile Include="Configuration\LibraryOptions.cs" />
<Compile Include="Configuration\MetadataConfiguration.cs" />
<Compile Include="Configuration\PeopleMetadataOptions.cs" />
<Compile Include="Configuration\XbmcMetadataOptions.cs" />
<Compile Include="Configuration\SubtitlePlaybackMode.cs" />
<Compile Include="Connect\ConnectAuthenticationExchangeResult.cs" />