Skip to content

Commit

Permalink
display sync targets
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Dec 15, 2014
1 parent dcd22cd commit dce2136
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
5 changes: 5 additions & 0 deletions MediaBrowser.Model/Devices/DeviceQuery.cs
Expand Up @@ -13,5 +13,10 @@ public class DeviceQuery
/// </summary>
/// <value><c>null</c> if [supports unique identifier] contains no value, <c>true</c> if [supports unique identifier]; otherwise, <c>false</c>.</value>
public bool? SupportsUniqueIdentifier { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [supports synchronize].
/// </summary>
/// <value><c>null</c> if [supports synchronize] contains no value, <c>true</c> if [supports synchronize]; otherwise, <c>false</c>.</value>
public bool? SupportsSync { get; set; }
}
}
7 changes: 7 additions & 0 deletions MediaBrowser.Server.Implementations/Devices/DeviceManager.cs
Expand Up @@ -91,6 +91,13 @@ public QueryResult<DeviceInfo> GetDevices(DeviceQuery query)
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;
Expand Down
23 changes: 20 additions & 3 deletions 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<SyncTarget> GetSyncTargets()
{
return new List<SyncTarget>();
return _deviceManager.GetDevices(new DeviceQuery
{
SupportsSync = true

}).Items.Select(i => new SyncTarget
{
Id = i.Id,
Name = i.Name
});
}

public DeviceProfile GetDeviceProfile(SyncTarget target)
Expand Down

0 comments on commit dce2136

Please sign in to comment.