sync update
This commit is contained in:
parent
975f6899fe
commit
76584ed984
|
@ -68,11 +68,5 @@ namespace MediaBrowser.Controller.Sync
|
|||
/// </summary>
|
||||
/// <returns>ISyncDataProvider.</returns>
|
||||
ISyncDataProvider GetDataProvider();
|
||||
|
||||
/// <summary>
|
||||
/// Gets all synchronize targets.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable<SyncTarget>.</returns>
|
||||
IEnumerable<SyncTarget> GetAllSyncTargets();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using MediaBrowser.Model.Dlna;
|
||||
using MediaBrowser.Model.Sync;
|
||||
using MediaBrowser.Model.Sync;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MediaBrowser.Controller.Sync
|
||||
|
@ -18,6 +17,12 @@ namespace MediaBrowser.Controller.Sync
|
|||
/// <param name="userId">The user identifier.</param>
|
||||
/// <returns>IEnumerable<SyncTarget>.</returns>
|
||||
IEnumerable<SyncTarget> GetSyncTargets(string userId);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all synchronize targets.
|
||||
/// </summary>
|
||||
/// <returns>IEnumerable<SyncTarget>.</returns>
|
||||
IEnumerable<SyncTarget> GetAllSyncTargets();
|
||||
}
|
||||
|
||||
public interface IHasUniqueTargetIds
|
||||
|
|
|
@ -42,5 +42,18 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
{
|
||||
get { return "App Sync"; }
|
||||
}
|
||||
|
||||
public IEnumerable<SyncTarget> GetAllSyncTargets()
|
||||
{
|
||||
return _deviceManager.GetDevices(new DeviceQuery
|
||||
{
|
||||
SupportsSync = true
|
||||
|
||||
}).Items.Select(i => new SyncTarget
|
||||
{
|
||||
Id = i.Id,
|
||||
Name = i.Name
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -407,6 +407,15 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
.OrderBy(i => i.Name);
|
||||
}
|
||||
|
||||
private IEnumerable<SyncTarget> GetSyncTargets(ISyncProvider provider)
|
||||
{
|
||||
return provider.GetAllSyncTargets().Select(i => new SyncTarget
|
||||
{
|
||||
Name = i.Name,
|
||||
Id = GetSyncTargetId(provider, i)
|
||||
});
|
||||
}
|
||||
|
||||
private IEnumerable<SyncTarget> GetSyncTargets(ISyncProvider provider, string userId)
|
||||
{
|
||||
return provider.GetSyncTargets(userId).Select(i => new SyncTarget
|
||||
|
@ -536,7 +545,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
{
|
||||
foreach (var provider in _providers)
|
||||
{
|
||||
foreach (var target in GetSyncTargets(provider, null))
|
||||
foreach (var target in GetSyncTargets(provider))
|
||||
{
|
||||
if (string.Equals(target.Id, targetId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user