diff options
| author | Luke <luke.pulverenti@gmail.com> | 2014-12-14 00:38:07 -0500 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2014-12-14 00:38:07 -0500 |
| commit | 524293ea79ab61228f8326561be70bcca4d0ea8f (patch) | |
| tree | ccfe163c8edafc8dd14b0b63d48712a6d504de9d /MediaBrowser.Server.Implementations/Devices/DeviceManager.cs | |
| parent | 00da34b90a2f2fcee4d6aa584e25fccebb375b6d (diff) | |
| parent | 9df9723fa8554df0fd51d777d3f781b0136de926 (diff) | |
Merge pull request #954 from MediaBrowser/dev
3.0.5462.0
Diffstat (limited to 'MediaBrowser.Server.Implementations/Devices/DeviceManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Devices/DeviceManager.cs | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs index e2c729b2d..8c67013ea 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs @@ -6,6 +6,7 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Model.Devices; using MediaBrowser.Model.Events; using MediaBrowser.Model.Logging; +using MediaBrowser.Model.Querying; using MediaBrowser.Model.Session; using System; using System.Collections.Generic; @@ -28,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.Devices /// Occurs when [device options updated]. /// </summary> public event EventHandler<GenericEventArgs<DeviceInfo>> DeviceOptionsUpdated; - + public DeviceManager(IDeviceRepository repo, IUserManager userManager, IFileSystem fileSystem, ILibraryMonitor libraryMonitor, IConfigurationManager config, ILogger logger) { _repo = repo; @@ -79,9 +80,30 @@ namespace MediaBrowser.Server.Implementations.Devices return _repo.GetDevice(id); } - public IEnumerable<DeviceInfo> GetDevices() + public QueryResult<DeviceInfo> GetDevices(DeviceQuery query) { - return _repo.GetDevices().OrderByDescending(i => i.DateLastModified); + IEnumerable<DeviceInfo> devices = _repo.GetDevices().OrderByDescending(i => i.DateLastModified); + + if (query.SupportsContentUploading.HasValue) + { + var val = query.SupportsContentUploading.Value; + + devices = devices.Where(i => GetCapabilities(i.Id).SupportsContentUploading == val); + } + + if (query.SupportsUniqueIdentifier.HasValue) + { + var val = query.SupportsUniqueIdentifier.Value; + + devices = devices.Where(i => GetCapabilities(i.Id).SupportsUniqueIdentifier == val); + } + + var array = devices.ToArray(); + return new QueryResult<DeviceInfo> + { + Items = array, + TotalRecordCount = array.Length + }; } public Task DeleteDevice(string id) |
