diff --git a/MediaBrowser.Api/Images/ImageRequest.cs b/MediaBrowser.Api/Images/ImageRequest.cs
index ab10a62635..1c11f527d6 100644
--- a/MediaBrowser.Api/Images/ImageRequest.cs
+++ b/MediaBrowser.Api/Images/ImageRequest.cs
@@ -1,4 +1,5 @@
using MediaBrowser.Model.Entities;
+using ServiceStack.ServiceHost;
namespace MediaBrowser.Api.Images
{
@@ -10,28 +11,39 @@ namespace MediaBrowser.Api.Images
///
/// The max width
///
+ [ApiMember(Name = "MaxWidth", Description = "The maximum image width to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MaxWidth { get; set; }
+
///
/// The max height
///
+ [ApiMember(Name = "MaxHeight", Description = "The maximum image height to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? MaxHeight { get; set; }
+
///
/// The width
///
+ [ApiMember(Name = "Width", Description = "The fixed image width to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Width { get; set; }
+
///
/// The height
///
+ [ApiMember(Name = "Height", Description = "The fixed image height to return.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Height { get; set; }
+
///
/// Gets or sets the quality.
///
/// The quality.
+ [ApiMember(Name = "Quality", Description = "Optional quality setting, from 0-100. Defaults to 90 and should suffice in most cases.", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
public int? Quality { get; set; }
+
///
/// Gets or sets the tag.
///
/// The tag.
+ [ApiMember(Name = "Tag", Description = "Optional. Supply the cache tag from the item object to receive strong caching headers.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Tag { get; set; }
}
@@ -44,11 +56,18 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the type of the image.
///
/// The type of the image.
+ [ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
+ [ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
+ [ApiMember(Name = "Type", Description = "Image Type", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public ImageType Type { get; set; }
+
///
/// Gets or sets the index.
///
/// The index.
+ [ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]
+ [ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "POST")]
+ [ApiMember(Name = "Index", Description = "Image Index", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "DELETE")]
public int? Index { get; set; }
}
}
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index 75602f9c53..c854c47f51 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -28,6 +28,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
///
/// The id.
+ [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Id { get; set; }
}
@@ -43,6 +44,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
///
/// The name.
+ [ApiMember(Name = "Name", Description = "Person name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@@ -58,6 +60,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
///
/// The name.
+ [ApiMember(Name = "Name", Description = "Studio name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@@ -73,6 +76,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the name.
///
/// The name.
+ [ApiMember(Name = "Name", Description = "Genre name", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public string Name { get; set; }
}
@@ -88,6 +92,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the year.
///
/// The year.
+ [ApiMember(Name = "Year", Description = "Year", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "GET")]
public int Year { get; set; }
}
@@ -103,6 +108,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
///
/// The id.
+ [ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
public Guid Id { get; set; }
}
@@ -118,6 +124,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
///
/// The id.
+ [ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")]
public Guid Id { get; set; }
}
@@ -130,6 +137,7 @@ namespace MediaBrowser.Api.Images
/// Gets or sets the id.
///
/// The id.
+ [ApiMember(Name = "Id", Description = "User Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
public Guid Id { get; set; }
///
@@ -316,8 +324,7 @@ namespace MediaBrowser.Api.Images
Item = item,
Request = request,
CropWhiteSpace = request.Type == ImageType.Logo || request.Type == ImageType.Art,
- OriginalImageDateModified = originalFileImageDateModified,
- ContentType = contentType
+ OriginalImageDateModified = originalFileImageDateModified
}, contentType);
}
diff --git a/MediaBrowser.Api/Images/ImageWriter.cs b/MediaBrowser.Api/Images/ImageWriter.cs
index 22c8510568..4541a6afe4 100644
--- a/MediaBrowser.Api/Images/ImageWriter.cs
+++ b/MediaBrowser.Api/Images/ImageWriter.cs
@@ -1,9 +1,7 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using ServiceStack.Service;
-using ServiceStack.ServiceHost;
using System;
-using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
@@ -12,7 +10,7 @@ namespace MediaBrowser.Api.Images
///
/// Class ImageWriter
///
- public class ImageWriter : IStreamWriter, IHasOptions
+ public class ImageWriter : IStreamWriter
{
///
/// Gets or sets the request.
@@ -33,11 +31,6 @@ namespace MediaBrowser.Api.Images
/// The original image date modified
///
public DateTime OriginalImageDateModified;
- ///
- /// Gets or sets the type of the content.
- ///
- /// The type of the content.
- public string ContentType { get; set; }
///
/// Writes to.
@@ -45,8 +38,6 @@ namespace MediaBrowser.Api.Images
/// The response stream.
public void WriteTo(Stream responseStream)
{
- Options["Content-Type"] = ContentType;
-
var task = WriteToAsync(responseStream);
Task.WaitAll(task);
@@ -63,18 +54,5 @@ namespace MediaBrowser.Api.Images
OriginalImageDateModified, responseStream, Request.Width, Request.Height, Request.MaxWidth,
Request.MaxHeight, Request.Quality);
}
-
- ///
- /// The _options
- ///
- private readonly IDictionary _options = new Dictionary { };
- ///
- /// Gets the options.
- ///
- /// The options.
- public IDictionary Options
- {
- get { return _options; }
- }
}
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
index ef9483b6e4..cdb6adbe73 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/BaseRestService.cs
@@ -83,7 +83,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var key = cacheKey.ToString("N");
- var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, string.Empty);
+ var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@@ -117,9 +117,11 @@ namespace MediaBrowser.Server.Implementations.HttpServer
throw new ArgumentNullException("factoryFn");
}
+ Response.ContentType = contentType;
+
var key = cacheKey.ToString("N");
- var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, contentType);
+ var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@@ -183,7 +185,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var key = cacheKey.ToString("N");
- var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration, contentType);
+ Response.ContentType = contentType;
+
+ var result = PreProcessCachedResult(cacheKey, key, lastDateModified, cacheDuration);
if (result != null)
{
@@ -278,9 +282,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// The cache key string.
/// The last date modified.
/// Duration of the cache.
- /// Type of the content.
/// System.Object.
- private object PreProcessCachedResult(Guid cacheKey, string cacheKeyString, DateTime? lastDateModified, TimeSpan? cacheDuration, string contentType)
+ private object PreProcessCachedResult(Guid cacheKey, string cacheKeyString, DateTime? lastDateModified, TimeSpan? cacheDuration)
{
Response.AddHeader("ETag", cacheKeyString);
@@ -290,11 +293,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer
AddExpiresHeader(cacheKeyString, cacheDuration);
//ctx.Response.SendChunked = false;
- if (!string.IsNullOrEmpty(contentType))
- {
- Response.ContentType = contentType;
- }
-
Response.StatusCode = 304;
return new byte[]{};