commit
e455af7c5c
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -35,13 +35,14 @@ namespace Emby.Server.Implementations.ScheduledTasks
|
|||
/// </summary>
|
||||
public IEnumerable<TaskTriggerInfo> GetDefaultTriggers()
|
||||
{
|
||||
// Randomize the default start hour because this operation can really hammer internet metadata providers
|
||||
var startHour = new Random(_appHost.SystemId.GetHashCode()).Next(0, 8);
|
||||
|
||||
return new[] {
|
||||
|
||||
return new[]
|
||||
{
|
||||
// Every so often
|
||||
new TaskTriggerInfo { Type = TaskTriggerInfo.TriggerDaily, TimeOfDayTicks = TimeSpan.FromHours(startHour).Ticks}
|
||||
new TaskTriggerInfo
|
||||
{
|
||||
Type = TaskTriggerInfo.TriggerInterval,
|
||||
IntervalTicks = TimeSpan.FromDays(7).Ticks
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -188,7 +188,13 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||
private void FetchFromItunesInfo(string xml, MediaInfo info)
|
||||
{
|
||||
// Make things simpler and strip out the dtd
|
||||
xml = xml.Substring(xml.IndexOf("<plist", StringComparison.OrdinalIgnoreCase));
|
||||
var plistIndex = xml.IndexOf("<plist", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (plistIndex != -1)
|
||||
{
|
||||
xml = xml.Substring(plistIndex);
|
||||
}
|
||||
|
||||
xml = "<?xml version=\"1.0\"?>" + xml;
|
||||
|
||||
// <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>cast</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Blender Foundation</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Janus Bager Kristensen</string>\n\t\t</dict>\n\t</array>\n\t<key>directors</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Sacha Goedegebure</string>\n\t\t</dict>\n\t</array>\n\t<key>studio</key>\n\t<string>Blender Foundation</string>\n</dict>\n</plist>\n
|
||||
|
@ -196,36 +202,44 @@ namespace MediaBrowser.MediaEncoding.Probing
|
|||
{
|
||||
using (var streamReader = new StreamReader(stream))
|
||||
{
|
||||
// Use XmlReader for best performance
|
||||
using (var reader = XmlReader.Create(streamReader))
|
||||
try
|
||||
{
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
// Loop through each element
|
||||
while (!reader.EOF)
|
||||
// Use XmlReader for best performance
|
||||
using (var reader = XmlReader.Create(streamReader))
|
||||
{
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
reader.MoveToContent();
|
||||
reader.Read();
|
||||
|
||||
// Loop through each element
|
||||
while (!reader.EOF)
|
||||
{
|
||||
switch (reader.Name)
|
||||
if (reader.NodeType == XmlNodeType.Element)
|
||||
{
|
||||
case "dict":
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
ReadFromDictNode(subtree, info);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "dict":
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
ReadFromDictNode(subtree, info);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
reader.Skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
reader.Read();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (XmlException)
|
||||
{
|
||||
// I've seen probe examples where the iTunMOVI value is just "<"
|
||||
// So we should not allow this to fail the entire probing operation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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"},
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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" />
|
||||
|
|
|
@ -377,7 +377,7 @@ namespace MediaBrowser.Providers.TV
|
|||
internal static bool IsValidSeries(Dictionary<string, string> seriesProviderIds)
|
||||
{
|
||||
string id;
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out id))
|
||||
{
|
||||
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
|
@ -386,7 +386,7 @@ namespace MediaBrowser.Providers.TV
|
|||
}
|
||||
}
|
||||
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id) && !string.IsNullOrEmpty(id))
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out id))
|
||||
{
|
||||
// This check should ideally never be necessary but we're seeing some cases of this and haven't tracked them down yet.
|
||||
if (!string.IsNullOrWhiteSpace(id))
|
||||
|
@ -405,7 +405,7 @@ namespace MediaBrowser.Providers.TV
|
|||
try
|
||||
{
|
||||
string seriesId;
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId) && !string.IsNullOrWhiteSpace(seriesId))
|
||||
{
|
||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||
|
||||
|
@ -419,7 +419,7 @@ namespace MediaBrowser.Providers.TV
|
|||
return seriesDataPath;
|
||||
}
|
||||
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrEmpty(seriesId))
|
||||
if (seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out seriesId) && !string.IsNullOrWhiteSpace(seriesId))
|
||||
{
|
||||
var seriesDataPath = GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user