diff --git a/Emby.Drawing/Emby.Drawing.csproj b/Emby.Drawing/Emby.Drawing.csproj
index b286885a55..8aba4263c1 100644
--- a/Emby.Drawing/Emby.Drawing.csproj
+++ b/Emby.Drawing/Emby.Drawing.csproj
@@ -57,6 +57,7 @@
+
diff --git a/Emby.Drawing/GDI/DynamicImageHelpers.cs b/Emby.Drawing/GDI/DynamicImageHelpers.cs
index c49007c5fd..b4a63b31e2 100644
--- a/Emby.Drawing/GDI/DynamicImageHelpers.cs
+++ b/Emby.Drawing/GDI/DynamicImageHelpers.cs
@@ -1,11 +1,9 @@
-using Emby.Drawing.ImageMagick;
-using MediaBrowser.Common.IO;
+using MediaBrowser.Common.IO;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
-using System.Linq;
namespace Emby.Drawing.GDI
{
@@ -18,10 +16,10 @@ namespace Emby.Drawing.GDI
int height)
{
const int numStrips = 4;
- files = StripCollageBuilder.ProjectPaths(files, numStrips).ToList();
-
+ files = ImageHelpers.ProjectPaths(files, numStrips);
+
const int rows = 1;
- int cols = numStrips;
+ int cols = numStrips;
int cellWidth = 2 * (width / 3);
int cellHeight = height;
@@ -76,8 +74,8 @@ namespace Emby.Drawing.GDI
int width,
int height)
{
- files = StripCollageBuilder.ProjectPaths(files, 4).ToList();
-
+ files = ImageHelpers.ProjectPaths(files, 4);
+
const int rows = 2;
const int cols = 2;
diff --git a/Emby.Drawing/GDI/GDIImageEncoder.cs b/Emby.Drawing/GDI/GDIImageEncoder.cs
index d968b8b5fe..7e3ca530b5 100644
--- a/Emby.Drawing/GDI/GDIImageEncoder.cs
+++ b/Emby.Drawing/GDI/GDIImageEncoder.cs
@@ -21,6 +21,8 @@ namespace Emby.Drawing.GDI
{
_fileSystem = fileSystem;
_logger = logger;
+
+ _logger.Info("GDI image processor initialized");
}
public string[] SupportedInputFormats
diff --git a/Emby.Drawing/ImageHelpers.cs b/Emby.Drawing/ImageHelpers.cs
new file mode 100644
index 0000000000..90bde8b3bd
--- /dev/null
+++ b/Emby.Drawing/ImageHelpers.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Emby.Drawing
+{
+ internal static class ImageHelpers
+ {
+ internal static List ProjectPaths(List paths, int count)
+ {
+ if (count <= 0)
+ {
+ throw new ArgumentOutOfRangeException("count");
+ }
+ if (paths.Count == 0)
+ {
+ throw new ArgumentOutOfRangeException("paths");
+ }
+
+ var list = new List();
+
+ AddToList(list, paths, count);
+
+ return list.Take(count).ToList();
+ }
+
+ private static void AddToList(List list, List paths, int count)
+ {
+ while (list.Count < count)
+ {
+ foreach (var path in paths)
+ {
+ list.Add(path);
+
+ if (list.Count >= count)
+ {
+ return;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
index 380c56059d..ff4a8f55bc 100644
--- a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
+++ b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs
@@ -1,4 +1,5 @@
-using ImageMagickSharp;
+using System.Linq;
+using ImageMagickSharp;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Model.Drawing;
@@ -195,15 +196,15 @@ namespace Emby.Drawing.ImageMagick
if (ratio >= 1.4)
{
- new StripCollageBuilder(_appPaths).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
+ new StripCollageBuilder(_appPaths).BuildThumbCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height, options.Text);
}
else if (ratio >= .9)
{
- new StripCollageBuilder(_appPaths).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
+ new StripCollageBuilder(_appPaths).BuildSquareCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height, options.Text);
}
else
{
- new StripCollageBuilder(_appPaths).BuildPosterCollage(options.InputPaths, options.OutputPath, options.Width, options.Height, options.Text);
+ new StripCollageBuilder(_appPaths).BuildPosterCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height, options.Text);
}
}
diff --git a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs
index 7cdd0077de..a50a75ccd1 100644
--- a/Emby.Drawing/ImageMagick/StripCollageBuilder.cs
+++ b/Emby.Drawing/ImageMagick/StripCollageBuilder.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Common.Configuration;
using System;
using System.Collections.Generic;
-using System.Linq;
namespace Emby.Drawing.ImageMagick
{
@@ -15,7 +14,7 @@ namespace Emby.Drawing.ImageMagick
_appPaths = appPaths;
}
- public void BuildPosterCollage(IEnumerable paths, string outputPath, int width, int height, string text)
+ public void BuildPosterCollage(List paths, string outputPath, int width, int height, string text)
{
if (!string.IsNullOrWhiteSpace(text))
{
@@ -33,7 +32,7 @@ namespace Emby.Drawing.ImageMagick
}
}
- public void BuildSquareCollage(IEnumerable paths, string outputPath, int width, int height, string text)
+ public void BuildSquareCollage(List paths, string outputPath, int width, int height, string text)
{
if (!string.IsNullOrWhiteSpace(text))
{
@@ -51,7 +50,7 @@ namespace Emby.Drawing.ImageMagick
}
}
- public void BuildThumbCollage(IEnumerable paths, string outputPath, int width, int height, string text)
+ public void BuildThumbCollage(List paths, string outputPath, int width, int height, string text)
{
if (!string.IsNullOrWhiteSpace(text))
{
@@ -69,31 +68,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- internal static string[] ProjectPaths(IEnumerable paths, int count)
+ private MagickWand BuildThumbCollageWandWithText(List paths, string text, int width, int height)
{
- var clone = paths.ToList();
- var list = new List();
-
- while (list.Count < count)
- {
- foreach (var path in clone)
- {
- list.Add(path);
-
- if (list.Count >= count)
- {
- break;
- }
- }
- }
-
- return list.Take(count).ToArray();
- }
-
- private MagickWand BuildThumbCollageWandWithText(IEnumerable paths, string text, int width, int height)
- {
- var inputPaths = ProjectPaths(paths, 8);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 8);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
@@ -165,10 +143,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- private MagickWand BuildPosterCollageWand(IEnumerable paths, int width, int height)
+ private MagickWand BuildPosterCollageWand(List paths, int width, int height)
{
- var inputPaths = ProjectPaths(paths, 4);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 4);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
@@ -230,10 +208,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- private MagickWand BuildPosterCollageWandWithText(IEnumerable paths, string label, int width, int height)
+ private MagickWand BuildPosterCollageWandWithText(List paths, string label, int width, int height)
{
- var inputPaths = ProjectPaths(paths, 4);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 4);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
@@ -305,10 +283,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- private MagickWand BuildThumbCollageWand(IEnumerable paths, int width, int height)
+ private MagickWand BuildThumbCollageWand(List paths, int width, int height)
{
- var inputPaths = ProjectPaths(paths, 8);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 8);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
@@ -370,10 +348,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- private MagickWand BuildSquareCollageWand(IEnumerable paths, int width, int height)
+ private MagickWand BuildSquareCollageWand(List paths, int width, int height)
{
- var inputPaths = ProjectPaths(paths, 4);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 4);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
@@ -435,10 +413,10 @@ namespace Emby.Drawing.ImageMagick
}
}
- private MagickWand BuildSquareCollageWandWithText(IEnumerable paths, string label, int width, int height)
+ private MagickWand BuildSquareCollageWandWithText(List paths, string label, int width, int height)
{
- var inputPaths = ProjectPaths(paths, 4);
- using (var wandImages = new MagickWand(inputPaths))
+ var inputPaths = ImageHelpers.ProjectPaths(paths, 4);
+ using (var wandImages = new MagickWand(inputPaths.ToArray()))
{
var wand = new MagickWand(width, height);
wand.OpenImage("gradient:#111111-#111111");
diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs
index 59c2e95c76..2ba4f5aab7 100644
--- a/Emby.Drawing/ImageProcessor.cs
+++ b/Emby.Drawing/ImageProcessor.cs
@@ -764,7 +764,11 @@ namespace Emby.Drawing
try
{
+ _logger.Debug("Creating image collage and saving to {0}", options.OutputPath);
+
_imageEncoder.CreateImageCollage(options);
+
+ _logger.Debug("Completed creation of image collage and saved to {0}", options.OutputPath);
}
finally
{
diff --git a/MediaBrowser.Api/ApiEntryPoint.cs b/MediaBrowser.Api/ApiEntryPoint.cs
index 55aa778e2f..2cd9007544 100644
--- a/MediaBrowser.Api/ApiEntryPoint.cs
+++ b/MediaBrowser.Api/ApiEntryPoint.cs
@@ -346,7 +346,7 @@ namespace MediaBrowser.Api
// We can really reduce the timeout for apps that are using the newer api
if (!string.IsNullOrWhiteSpace(job.PlaySessionId) && job.Type != TranscodingJobType.Progressive)
{
- timerDuration = 60000;
+ timerDuration = 50000;
}
job.PingTimeout = timerDuration;
diff --git a/MediaBrowser.Api/Dlna/DlnaServerService.cs b/MediaBrowser.Api/Dlna/DlnaServerService.cs
index 29b7bf682c..bdf7d6b074 100644
--- a/MediaBrowser.Api/Dlna/DlnaServerService.cs
+++ b/MediaBrowser.Api/Dlna/DlnaServerService.cs
@@ -108,6 +108,9 @@ namespace MediaBrowser.Api.Dlna
private readonly IConnectionManager _connectionManager;
private readonly IMediaReceiverRegistrar _mediaReceiverRegistrar;
+ // TODO: Add utf-8
+ private const string XMLContentType = "text/xml";
+
public DlnaServerService(IDlnaManager dlnaManager, IContentDirectory contentDirectory, IConnectionManager connectionManager, IMediaReceiverRegistrar mediaReceiverRegistrar)
{
_dlnaManager = dlnaManager;
@@ -122,49 +125,49 @@ namespace MediaBrowser.Api.Dlna
var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase));
var xml = _dlnaManager.GetServerDescriptionXml(GetRequestHeaders(), request.UuId, serverAddress);
- return ResultFactory.GetResult(xml, "text/xml");
+ return ResultFactory.GetResult(xml, XMLContentType);
}
public object Get(GetContentDirectory request)
{
var xml = _contentDirectory.GetServiceXml(GetRequestHeaders());
- return ResultFactory.GetResult(xml, "text/xml");
+ return ResultFactory.GetResult(xml, XMLContentType);
}
public object Get(GetMediaReceiverRegistrar request)
{
var xml = _mediaReceiverRegistrar.GetServiceXml(GetRequestHeaders());
- return ResultFactory.GetResult(xml, "text/xml");
+ return ResultFactory.GetResult(xml, XMLContentType);
}
public object Get(GetConnnectionManager request)
{
var xml = _connectionManager.GetServiceXml(GetRequestHeaders());
- return ResultFactory.GetResult(xml, "text/xml");
+ return ResultFactory.GetResult(xml, XMLContentType);
}
public async Task