From 7f7d2f85e324bc9e2c6b170c89af0541601e8cad Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 15 Dec 2014 00:49:04 -0500 Subject: [PATCH] display sync targets --- MediaBrowser.Model/Devices/DeviceQuery.cs | 5 ++++ .../Devices/DeviceManager.cs | 7 ++++++ .../Sync/AppSyncProvider.cs | 23 ++++++++++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Model/Devices/DeviceQuery.cs b/MediaBrowser.Model/Devices/DeviceQuery.cs index 76f7117b6..c3b4313f4 100644 --- a/MediaBrowser.Model/Devices/DeviceQuery.cs +++ b/MediaBrowser.Model/Devices/DeviceQuery.cs @@ -13,5 +13,10 @@ namespace MediaBrowser.Model.Devices /// /// null if [supports unique identifier] contains no value, true if [supports unique identifier]; otherwise, false. public bool? SupportsUniqueIdentifier { get; set; } + /// + /// Gets or sets a value indicating whether [supports synchronize]. + /// + /// null if [supports synchronize] contains no value, true if [supports synchronize]; otherwise, false. + public bool? SupportsSync { get; set; } } } diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs index 8c67013ea..6cdc58118 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceManager.cs @@ -91,6 +91,13 @@ namespace MediaBrowser.Server.Implementations.Devices devices = devices.Where(i => GetCapabilities(i.Id).SupportsContentUploading == val); } + if (query.SupportsSync.HasValue) + { + var val = query.SupportsSync.Value; + + devices = devices.Where(i => GetCapabilities(i.Id).SupportsSync == val); + } + if (query.SupportsUniqueIdentifier.HasValue) { var val = query.SupportsUniqueIdentifier.Value; diff --git a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs index c3cd047b6..94eed50f6 100644 --- a/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs +++ b/MediaBrowser.Server.Implementations/Sync/AppSyncProvider.cs @@ -1,16 +1,33 @@ -using MediaBrowser.Controller.Sync; +using MediaBrowser.Controller.Devices; +using MediaBrowser.Controller.Sync; +using MediaBrowser.Model.Devices; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Sync; -using System; using System.Collections.Generic; +using System.Linq; namespace MediaBrowser.Server.Implementations.Sync { public class AppSyncProvider : ISyncProvider { + private readonly IDeviceManager _deviceManager; + + public AppSyncProvider(IDeviceManager deviceManager) + { + _deviceManager = deviceManager; + } + public IEnumerable GetSyncTargets() { - return new List(); + return _deviceManager.GetDevices(new DeviceQuery + { + SupportsSync = true + + }).Items.Select(i => new SyncTarget + { + Id = i.Id, + Name = i.Name + }); } public DeviceProfile GetDeviceProfile(SyncTarget target)