diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-28 10:26:19 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-08-28 10:26:19 -0400 |
| commit | 89b8660fc8e98d7650d5974858a2b4acd0d43052 (patch) | |
| tree | e21e798b36df67b711e6756b348e0b955e829492 /MediaBrowser.Api/LibraryService.cs | |
| parent | b7d8e3a9dde18b14d2aef94c3f5762694db0b26d (diff) | |
added item downloader endpoint
Diffstat (limited to 'MediaBrowser.Api/LibraryService.cs')
| -rw-r--r-- | MediaBrowser.Api/LibraryService.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs index f319b3106..ed2ef3884 100644 --- a/MediaBrowser.Api/LibraryService.cs +++ b/MediaBrowser.Api/LibraryService.cs @@ -18,6 +18,18 @@ using System.Threading.Tasks; namespace MediaBrowser.Api { + [Route("/Items/{Id}/File", "GET")] + [Api(Description = "Gets the original file of an item")] + public class GetFile + { + /// <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; } + } + /// <summary> /// Class GetCriticReviews /// </summary> @@ -193,6 +205,22 @@ namespace MediaBrowser.Api _userDataRepository = userDataRepository; } + public object Get(GetFile request) + { + var item = DtoBuilder.GetItemByClientId(request.Id, _userManager, _libraryManager); + + if (item.LocationType == LocationType.Remote || item.LocationType == LocationType.Virtual) + { + throw new ArgumentException("This command cannot be used for remote or virtual items."); + } + if (Directory.Exists(item.Path)) + { + throw new ArgumentException("This command cannot be used for directories."); + } + + return ToStaticFileResult(item.Path); + } + /// <summary> /// Gets the specified request. /// </summary> |
