diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-09-10 14:28:22 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-09-10 14:28:22 -0400 |
| commit | baf2f801549a284501ee836053aa113adf5b1503 (patch) | |
| tree | 4ae5c00cbef70a5c05866b0d2ea0ad2b7f13bf10 /MediaBrowser.Api/Devices/DeviceService.cs | |
| parent | ce0435a66d98be8519a0c6e438674caf3badc076 (diff) | |
update camera upload
Diffstat (limited to 'MediaBrowser.Api/Devices/DeviceService.cs')
| -rw-r--r-- | MediaBrowser.Api/Devices/DeviceService.cs | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/MediaBrowser.Api/Devices/DeviceService.cs b/MediaBrowser.Api/Devices/DeviceService.cs index ab0a4a4b2..759eea353 100644 --- a/MediaBrowser.Api/Devices/DeviceService.cs +++ b/MediaBrowser.Api/Devices/DeviceService.cs @@ -1,4 +1,6 @@ -using MediaBrowser.Controller.Devices; +using System; +using System.Linq; +using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Devices; using MediaBrowser.Model.Querying; @@ -128,15 +130,32 @@ namespace MediaBrowser.Api.Devices var id = Request.QueryString["Id"]; var name = Request.QueryString["Name"]; - var task = _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo + if (Request.ContentType.IndexOf("multi", StringComparison.OrdinalIgnoreCase) == -1) { - MimeType = Request.ContentType, - Album = album, - Name = name, - Id = id - }); - - Task.WaitAll(task); + var task = _deviceManager.AcceptCameraUpload(deviceId, request.RequestStream, new LocalFileInfo + { + MimeType = Request.ContentType, + Album = album, + Name = name, + Id = id + }); + + Task.WaitAll(task); + } + else + { + var file = Request.Files.First(); + + var task = _deviceManager.AcceptCameraUpload(deviceId, file.InputStream, new LocalFileInfo + { + MimeType = file.ContentType, + Album = album, + Name = name, + Id = id + }); + + Task.WaitAll(task); + } } } } |
