aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2014-12-12 22:56:30 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2014-12-12 22:56:30 -0500
commitab3da461130b0db2f77e7e848c4bbd1280e5524a (patch)
tree0ee0ef36f4d710a491d4e8c5ef083df16c710d42 /MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
parent3fb40eb02e3ab4bf84e34ebed126db8d6f760e92 (diff)
more sync movement
Diffstat (limited to 'MediaBrowser.Server.Implementations/Devices/DeviceManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Devices/DeviceManager.cs28
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)