diff options
Diffstat (limited to 'MediaBrowser.Api')
| -rw-r--r-- | MediaBrowser.Api/DlnaService.cs | 68 | ||||
| -rw-r--r-- | MediaBrowser.Api/Images/ImageService.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Api/MediaBrowser.Api.csproj | 2 |
3 files changed, 69 insertions, 11 deletions
diff --git a/MediaBrowser.Api/DlnaService.cs b/MediaBrowser.Api/DlnaService.cs new file mode 100644 index 000000000..d40492ee2 --- /dev/null +++ b/MediaBrowser.Api/DlnaService.cs @@ -0,0 +1,68 @@ +using MediaBrowser.Controller.Dlna; +using MediaBrowser.Model.Dlna; +using ServiceStack; +using System.Collections.Generic; +using System.Linq; + +namespace MediaBrowser.Api +{ + [Route("/Dlna/ProfileInfos", "GET", Summary = "Gets a list of profiles")] + public class GetProfileInfos : IReturn<List<DeviceProfileInfo>> + { + } + + [Route("/Dlna/Profiles/{Id}", "DELETE", Summary = "Deletes a profile")] + public class DeleteProfile : IReturnVoid + { + [ApiMember(Name = "Id", Description = "Profile Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "DELETE")] + public string Id { get; set; } + } + + [Route("/Dlna/Profiles/Default", "GET", Summary = "Gets the default profile")] + public class GetDefaultProfile : IReturn<DeviceProfile> + { + } + + [Route("/Dlna/Profiles/{Id}", "GET", Summary = "Gets a single profile")] + public class GetProfile : IReturn<DeviceProfile> + { + [ApiMember(Name = "Id", Description = "Profile Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")] + public string Id { get; set; } + } + + public class DlnaService : BaseApiService + { + private readonly IDlnaManager _dlnaManager; + + public DlnaService(IDlnaManager dlnaManager) + { + _dlnaManager = dlnaManager; + } + + public object Get(GetProfileInfos request) + { + var result = _dlnaManager.GetProfileInfos().ToList(); + + return ToOptimizedResult(result); + } + + public object Get(GetProfile request) + { + var result = _dlnaManager.GetProfile(request.Id); + + return ToOptimizedResult(result); + } + + public object Get(GetDefaultProfile request) + { + var result = _dlnaManager.GetDefaultProfile(); + + return ToOptimizedResult(result); + } + + public void Delete(DeleteProfile request) + { + _dlnaManager.DeleteProfile(request.Id); + } + } +} diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 2cdaef1ed..562da40ee 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -15,7 +15,6 @@ using ServiceStack.Text.Controller; using ServiceStack.Web; using System; using System.Collections.Generic; -using System.Drawing; using System.IO; using System.Linq; using System.Threading; @@ -776,15 +775,6 @@ namespace MediaBrowser.Api.Images var bytes = Convert.FromBase64String(text); - // Validate first - using (var validationStream = new MemoryStream(bytes)) - { - // This will throw an exception if it's not a valid image - using (Image.FromStream(validationStream)) - { - } - } - var memoryStream = new MemoryStream(bytes) { Position = 0 diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csproj index 38cf39b54..18559a68d 100644 --- a/MediaBrowser.Api/MediaBrowser.Api.csproj +++ b/MediaBrowser.Api/MediaBrowser.Api.csproj @@ -53,7 +53,6 @@ <Reference Include="System.Core" /> <Reference Include="Microsoft.CSharp" /> <Reference Include="System.Data" /> - <Reference Include="System.Drawing" /> <Reference Include="System.Xml" /> <Reference Include="ServiceStack.Interfaces"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath> @@ -67,6 +66,7 @@ <Link>Properties\SharedVersion.cs</Link> </Compile> <Compile Include="ChannelService.cs" /> + <Compile Include="DlnaService.cs" /> <Compile Include="Movies\CollectionService.cs" /> <Compile Include="Music\AlbumsService.cs" /> <Compile Include="AppThemeService.cs" /> |
