aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/LibraryService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-25 22:44:26 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-25 22:44:26 -0500
commit74f0d8bdbe22b28822711bd701a4c33853724cb8 (patch)
tree2ce3c65a60b4b97f0b4c54e00d4bddde45f3e1b0 /MediaBrowser.Api/LibraryService.cs
parentbb5e6fdcad9e92b58b754075b8df2387590aeaaf (diff)
minor dashboard cleanup
Diffstat (limited to 'MediaBrowser.Api/LibraryService.cs')
-rw-r--r--MediaBrowser.Api/LibraryService.cs37
1 files changed, 36 insertions, 1 deletions
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index 7dc8301fe..d9442b63d 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Dto;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.Movies;
@@ -32,6 +33,21 @@ namespace MediaBrowser.Api
public string Id { get; set; }
}
+ [Route("/Videos/{Id}/Subtitle/{Index}", "GET")]
+ [Api(Description = "Gets an external subtitle file")]
+ public class GetSubtitle
+ {
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ /// <value>The id.</value>
+ [ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]
+ public string Id { get; set; }
+
+ [ApiMember(Name = "Index", Description = "The subtitle stream index", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "GET")]
+ public int Index { get; set; }
+ }
+
/// <summary>
/// Class GetCriticReviews
/// </summary>
@@ -240,6 +256,25 @@ namespace MediaBrowser.Api
return ToStaticFileResult(item.Path);
}
+ public object Get(GetSubtitle request)
+ {
+ var subtitleStream = _itemRepo.GetMediaStreams(new MediaStreamQuery
+ {
+
+ Index = request.Index,
+ ItemId = new Guid(request.Id),
+ Type = MediaStreamType.Subtitle
+
+ }).FirstOrDefault();
+
+ if (subtitleStream == null)
+ {
+ throw new ResourceNotFoundException();
+ }
+
+ return ToStaticFileResult(subtitleStream.Path);
+ }
+
/// <summary>
/// Gets the specified request.
/// </summary>