update default theme endpoints
This commit is contained in:
parent
333f1ea6a4
commit
ebec1e159c
|
@ -1,13 +0,0 @@
|
|||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Api.DefaultTheme
|
||||
{
|
||||
public class ItemStub
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
public Guid ImageTag { get; set; }
|
||||
public ImageType ImageType { get; set; }
|
||||
}
|
||||
}
|
50
MediaBrowser.Api/DefaultTheme/Models.cs
Normal file
50
MediaBrowser.Api/DefaultTheme/Models.cs
Normal file
|
@ -0,0 +1,50 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Api.DefaultTheme
|
||||
{
|
||||
public class ItemStub
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Id { get; set; }
|
||||
public Guid ImageTag { get; set; }
|
||||
public ImageType ImageType { get; set; }
|
||||
}
|
||||
|
||||
public class MoviesView
|
||||
{
|
||||
public BaseItemDto[] SpotlightItems { get; set; }
|
||||
public ItemStub[] MovieItems { get; set; }
|
||||
public ItemStub[] PeopleItems { get; set; }
|
||||
|
||||
public ItemStub[] BoxSetItems { get; set; }
|
||||
public ItemStub[] TrailerItems { get; set; }
|
||||
public ItemStub[] HDItems { get; set; }
|
||||
public ItemStub[] ThreeDItems { get; set; }
|
||||
|
||||
public ItemStub[] FamilyMovies { get; set; }
|
||||
|
||||
public ItemStub[] RomanceItems { get; set; }
|
||||
public ItemStub[] ComedyItems { get; set; }
|
||||
|
||||
public double FamilyMoviePercentage { get; set; }
|
||||
|
||||
public double HDMoviePercentage { get; set; }
|
||||
}
|
||||
|
||||
public class TvView
|
||||
{
|
||||
public BaseItemDto[] SpotlightItems { get; set; }
|
||||
public ItemStub[] ShowsItems { get; set; }
|
||||
public ItemStub[] ActorItems { get; set; }
|
||||
|
||||
public ItemStub[] RomanceItems { get; set; }
|
||||
public ItemStub[] ComedyItems { get; set; }
|
||||
}
|
||||
|
||||
public class HomeView
|
||||
{
|
||||
public BaseItemDto[] SpotlightItems { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Api.DefaultTheme
|
||||
{
|
||||
public class MoviesView
|
||||
{
|
||||
public BaseItemDto[] SpotlightItems { get; set; }
|
||||
public ItemStub[] MovieItems { get; set; }
|
||||
public ItemStub[] PeopleItems { get; set; }
|
||||
|
||||
public ItemStub[] BoxSetItems { get; set; }
|
||||
public ItemStub[] TrailerItems { get; set; }
|
||||
public ItemStub[] HDItems { get; set; }
|
||||
public ItemStub[] ThreeDItems { get; set; }
|
||||
|
||||
public ItemStub[] FamilyMovies { get; set; }
|
||||
|
||||
public ItemStub[] RomanticItems { get; set; }
|
||||
|
||||
public double FamilyMoviePercentage { get; set; }
|
||||
|
||||
public double HDMoviePercentage { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
using MediaBrowser.Model.Dto;
|
||||
|
||||
namespace MediaBrowser.Api.DefaultTheme
|
||||
{
|
||||
public class TvView
|
||||
{
|
||||
public BaseItemDto[] SpotlightItems { get; set; }
|
||||
public ItemStub[] ShowsItems { get; set; }
|
||||
public ItemStub[] ActorItems { get; set; }
|
||||
}
|
||||
}
|
|
@ -67,9 +67,7 @@
|
|||
<Compile Include="AlbumsService.cs" />
|
||||
<Compile Include="BaseApiService.cs" />
|
||||
<Compile Include="DefaultTheme\DefaultThemeService.cs" />
|
||||
<Compile Include="DefaultTheme\ItemStub.cs" />
|
||||
<Compile Include="DefaultTheme\MoviesView.cs" />
|
||||
<Compile Include="DefaultTheme\TvView.cs" />
|
||||
<Compile Include="DefaultTheme\Models.cs" />
|
||||
<Compile Include="DisplayPreferencesService.cs" />
|
||||
<Compile Include="EnvironmentService.cs" />
|
||||
<Compile Include="GamesService.cs" />
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);
|
||||
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, file);
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, file, FileShare.ReadWrite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace MediaBrowser.Api.Playback.Hls
|
|||
|
||||
file = Path.Combine(ApplicationPaths.EncodedMediaCachePath, file);
|
||||
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, file);
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, file, FileShare.ReadWrite);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -209,12 +209,12 @@ namespace MediaBrowser.Api.Playback.Progressive
|
|||
|
||||
if (request.Static)
|
||||
{
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, state.Item.Path, responseHeaders, isHeadRequest);
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, state.Item.Path, FileShare.Read, responseHeaders, isHeadRequest);
|
||||
}
|
||||
|
||||
if (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive))
|
||||
{
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, outputPath, responseHeaders, isHeadRequest);
|
||||
return ResultFactory.GetStaticFileResult(RequestContext, outputPath, FileShare.Read, responseHeaders, isHeadRequest);
|
||||
}
|
||||
|
||||
return GetStreamResult(state, responseHeaders, isHeadRequest).Result;
|
||||
|
|
|
@ -89,9 +89,10 @@ namespace MediaBrowser.Common.Net
|
|||
/// </summary>
|
||||
/// <param name="requestContext">The request context.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="fileShare">The file share.</param>
|
||||
/// <param name="responseHeaders">The response headers.</param>
|
||||
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
object GetStaticFileResult(IRequestContext requestContext, string path, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false);
|
||||
object GetStaticFileResult(IRequestContext requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -271,32 +271,39 @@ namespace MediaBrowser.Server.Implementations.HttpServer
|
|||
/// </summary>
|
||||
/// <param name="requestContext">The request context.</param>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="fileShare">The file share.</param>
|
||||
/// <param name="responseHeaders">The response headers.</param>
|
||||
/// <param name="isHeadRequest">if set to <c>true</c> [is head request].</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
/// <exception cref="System.ArgumentNullException">path</exception>
|
||||
public object GetStaticFileResult(IRequestContext requestContext, string path, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false)
|
||||
public object GetStaticFileResult(IRequestContext requestContext, string path, FileShare fileShare = FileShare.Read, IDictionary<string, string> responseHeaders = null, bool isHeadRequest = false)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
|
||||
if (fileShare != FileShare.Read && fileShare != FileShare.ReadWrite)
|
||||
{
|
||||
throw new ArgumentException("FileShare must be either Read or ReadWrite");
|
||||
}
|
||||
|
||||
var dateModified = File.GetLastWriteTimeUtc(path);
|
||||
|
||||
var cacheKey = path + dateModified.Ticks;
|
||||
|
||||
return GetStaticResult(requestContext, cacheKey.GetMD5(), dateModified, null, MimeTypes.GetMimeType(path), () => Task.FromResult(GetFileStream(path)), responseHeaders, isHeadRequest);
|
||||
return GetStaticResult(requestContext, cacheKey.GetMD5(), dateModified, null, MimeTypes.GetMimeType(path), () => Task.FromResult(GetFileStream(path, fileShare)), responseHeaders, isHeadRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the file stream.
|
||||
/// </summary>
|
||||
/// <param name="path">The path.</param>
|
||||
/// <param name="fileShare">The file share.</param>
|
||||
/// <returns>Stream.</returns>
|
||||
private Stream GetFileStream(string path)
|
||||
private Stream GetFileStream(string path, FileShare fileShare)
|
||||
{
|
||||
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous);
|
||||
return new FileStream(path, FileMode.Open, FileAccess.Read, fileShare, StreamDefaults.DefaultFileStreamBufferSize, FileOptions.Asynchronous);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user