aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Api/AppThemeService.cs22
-rw-r--r--MediaBrowser.Api/Images/ImageService.cs9
-rw-r--r--MediaBrowser.Model/Themes/AppTheme.cs4
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs19
-rw-r--r--MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs21
5 files changed, 46 insertions, 29 deletions
diff --git a/MediaBrowser.Api/AppThemeService.cs b/MediaBrowser.Api/AppThemeService.cs
index d1819cce4..54141b3e2 100644
--- a/MediaBrowser.Api/AppThemeService.cs
+++ b/MediaBrowser.Api/AppThemeService.cs
@@ -13,16 +13,16 @@ namespace MediaBrowser.Api
[Api(Description = "Gets a list of available themes for an app")]
public class GetAppThemes : IReturn<List<AppThemeInfo>>
{
- [ApiMember(Name = "ApplicationName", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
- public string ApplicationName { get; set; }
+ [ApiMember(Name = "App", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string App { get; set; }
}
[Route("/Themes/Info", "GET")]
[Api(Description = "Gets an app theme")]
public class GetAppTheme : IReturn<AppTheme>
{
- [ApiMember(Name = "ApplicationName", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
- public string ApplicationName { get; set; }
+ [ApiMember(Name = "App", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string App { get; set; }
[ApiMember(Name = "Name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Name { get; set; }
@@ -32,11 +32,11 @@ namespace MediaBrowser.Api
[Api(Description = "Gets an app theme")]
public class GetAppThemeImage
{
- [ApiMember(Name = "ApplicationName", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
- public string ApplicationName { get; set; }
+ [ApiMember(Name = "App", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string App { get; set; }
- [ApiMember(Name = "ThemeName", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
- public string ThemeName { get; set; }
+ [ApiMember(Name = "Theme", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
+ public string Theme { get; set; }
[ApiMember(Name = "Name", IsRequired = true, DataType = "string", ParameterType = "query", Verb = "GET")]
public string Name { get; set; }
@@ -64,14 +64,14 @@ namespace MediaBrowser.Api
public object Get(GetAppThemes request)
{
- var result = _themeManager.GetThemes(request.ApplicationName).ToList();
+ var result = _themeManager.GetThemes(request.App).ToList();
return ToOptimizedResult(result);
}
public object Get(GetAppTheme request)
{
- var result = _themeManager.GetTheme(request.ApplicationName, request.Name);
+ var result = _themeManager.GetTheme(request.App, request.Name);
return ToOptimizedResult(result);
}
@@ -83,7 +83,7 @@ namespace MediaBrowser.Api
public object Get(GetAppThemeImage request)
{
- var info = _themeManager.GetImageImageInfo(request.ApplicationName, request.ThemeName, request.Name);
+ var info = _themeManager.GetImageImageInfo(request.App, request.Theme, request.Name);
var cacheGuid = new Guid(info.CacheTag);
diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs
index daa52f5a0..2cdaef1ed 100644
--- a/MediaBrowser.Api/Images/ImageService.cs
+++ b/MediaBrowser.Api/Images/ImageService.cs
@@ -707,10 +707,11 @@ namespace MediaBrowser.Api.Images
var currentItem = item;
var currentRequest = request;
- var responseHeaders = new Dictionary<string, string>();
-
- responseHeaders.Add("transferMode.dlna.org", "Interactive");
- responseHeaders.Add("realTimeInfo.dlna.org", "DLNA.ORG_TLAG=*");
+ var responseHeaders = new Dictionary<string, string>
+ {
+ {"transferMode.dlna.org", "Interactive"},
+ {"realTimeInfo.dlna.org", "DLNA.ORG_TLAG=*"}
+ };
return ToCachedResult(cacheGuid, originalFileImageDateModified, cacheDuration, () => new ImageWriter
{
diff --git a/MediaBrowser.Model/Themes/AppTheme.cs b/MediaBrowser.Model/Themes/AppTheme.cs
index a0532854d..a814fec33 100644
--- a/MediaBrowser.Model/Themes/AppTheme.cs
+++ b/MediaBrowser.Model/Themes/AppTheme.cs
@@ -5,7 +5,7 @@ namespace MediaBrowser.Model.Themes
{
public class AppTheme
{
- public string ApplicationName { get; set; }
+ public string AppName { get; set; }
public string Name { get; set; }
@@ -23,7 +23,7 @@ namespace MediaBrowser.Model.Themes
public class AppThemeInfo
{
- public string ApplicationName { get; set; }
+ public string AppName { get; set; }
public string Name { get; set; }
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
index 4c21d2eb7..8455d9f58 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpResultFactory.cs
@@ -238,8 +238,19 @@ namespace MediaBrowser.Server.Implementations.HttpServer
return hasOptions;
}
- // Otherwise wrap into an HttpResult
- var httpResult = new HttpResult(result, contentType ?? "text/html", HttpStatusCode.NotModified);
+ IHasOptions httpResult;
+
+ var stream = result as Stream;
+
+ if (stream != null)
+ {
+ httpResult = new StreamWriter(stream, contentType, _logger);
+ }
+ else
+ {
+ // Otherwise wrap into an HttpResult
+ httpResult = new HttpResult(result, contentType ?? "text/html", HttpStatusCode.NotModified);
+ }
AddResponseHeaders(httpResult, responseHeaders);
@@ -478,7 +489,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (!SupportsCompression)
{
responseHeaders["Content-Length"] = originalContentLength.ToString(UsCulture);
-
+
if (isHeadRequest)
{
return GetHttpResult(new byte[] { }, contentType);
@@ -495,7 +506,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{
return GetHttpResult(new byte[] { }, contentType);
}
-
+
return new CompressedResult(contents, requestedCompressionType, contentType);
}
diff --git a/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs b/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs
index ca792bcd3..9845f3867 100644
--- a/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs
+++ b/MediaBrowser.Server.Implementations/Themes/AppThemeManager.cs
@@ -63,6 +63,11 @@ namespace MediaBrowser.Server.Implementations.Themes
return Path.Combine(GetThemesPath(applicationName), name);
}
+ private string GetImagesPath(string applicationName, string themeName)
+ {
+ return Path.Combine(GetThemePath(applicationName, themeName), "images");
+ }
+
public IEnumerable<AppThemeInfo> GetThemes(string applicationName)
{
var path = GetThemesPath(applicationName);
@@ -97,9 +102,11 @@ namespace MediaBrowser.Server.Implementations.Themes
var themePath = GetThemePath(applicationName, name);
var file = Path.Combine(themePath, "theme.json");
+ var imagesPath = GetImagesPath(applicationName, name);
+
var theme = _json.DeserializeFromFile<AppTheme>(file);
- theme.Images = new DirectoryInfo(themePath)
+ theme.Images = new DirectoryInfo(imagesPath)
.EnumerateFiles("*", SearchOption.TopDirectoryOnly)
.Where(i => _supportedImageExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
.Select(GetThemeImage)
@@ -123,7 +130,7 @@ namespace MediaBrowser.Server.Implementations.Themes
public void SaveTheme(AppTheme theme)
{
- var themePath = GetThemePath(theme.ApplicationName, theme.Name);
+ var themePath = GetThemePath(theme.AppName, theme.Name);
var file = Path.Combine(themePath, "theme.json");
Directory.CreateDirectory(themePath);
@@ -131,7 +138,7 @@ namespace MediaBrowser.Server.Implementations.Themes
// Clone it so that we don't serialize all the images - they're always dynamic
var clone = new AppTheme
{
- ApplicationName = theme.ApplicationName,
+ AppName = theme.AppName,
Name = theme.Name,
Options = theme.Options,
Images = null
@@ -142,12 +149,10 @@ namespace MediaBrowser.Server.Implementations.Themes
public InternalThemeImage GetImageImageInfo(string applicationName, string themeName, string imageName)
{
- var themePath = GetThemePath(applicationName, themeName);
-
- var fullPath = Path.Combine(themePath, imageName);
+ var imagesPath = GetImagesPath(applicationName, themeName);
- var file = new DirectoryInfo(themePath).EnumerateFiles("*", SearchOption.TopDirectoryOnly)
- .First(i => string.Equals(i.FullName, fullPath, StringComparison.OrdinalIgnoreCase));
+ var file = new DirectoryInfo(imagesPath).EnumerateFiles("*", SearchOption.TopDirectoryOnly)
+ .First(i => string.Equals(i.Name, imageName, StringComparison.OrdinalIgnoreCase));
var themeImage = GetThemeImage(file);