Files
jellyfin-jellyfin-1/MediaBrowser.Server.Implementations/Sync/CloudSyncProvider.cs

58 lines
1.7 KiB
C#
Raw Normal View History

2014-07-21 21:29:06 -04:00
using MediaBrowser.Common;
using MediaBrowser.Controller.Sync;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Sync;
2015-02-05 00:29:37 -05:00
using System;
2014-07-21 21:29:06 -04:00
using System.Collections.Generic;
2015-02-26 15:06:42 -05:00
using System.IO;
2014-07-21 21:29:06 -04:00
using System.Linq;
2015-02-05 00:29:37 -05:00
using System.Threading;
using System.Threading.Tasks;
2014-07-21 21:29:06 -04:00
namespace MediaBrowser.Server.Implementations.Sync
{
2015-02-05 00:29:37 -05:00
public class CloudSyncProvider : IServerSyncProvider
2014-07-21 21:29:06 -04:00
{
2015-02-05 16:14:08 -05:00
private readonly ICloudSyncProvider[] _providers = {};
2014-07-21 21:29:06 -04:00
public CloudSyncProvider(IApplicationHost appHost)
{
_providers = appHost.GetExports<ICloudSyncProvider>().ToArray();
}
2014-12-31 01:24:49 -05:00
public IEnumerable<SyncTarget> GetSyncTargets(string userId)
{
2015-02-07 01:02:42 -05:00
return _providers.SelectMany(i => i.GetSyncTargets(userId));
2014-12-31 01:24:49 -05:00
}
2014-07-21 21:29:06 -04:00
public DeviceProfile GetDeviceProfile(SyncTarget target)
{
2014-07-22 12:36:34 -04:00
return new DeviceProfile();
2014-07-21 21:29:06 -04:00
}
public string Name
{
get { return "Cloud Sync"; }
}
2015-02-05 00:29:37 -05:00
2015-02-22 14:05:38 -05:00
private ICloudSyncProvider GetProvider(SyncTarget target)
{
return null;
}
2015-02-26 15:06:42 -05:00
public Task SendFile(string inputFile, string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken)
2015-02-05 00:29:37 -05:00
{
2015-02-26 15:06:42 -05:00
var provider = GetProvider(target);
2015-02-05 00:29:37 -05:00
2015-02-26 15:06:42 -05:00
return provider.SendFile(inputFile, pathParts, target, progress, cancellationToken);
2015-02-05 00:29:37 -05:00
}
2015-02-26 15:06:42 -05:00
public Task<Stream> GetFile(string[] pathParts, SyncTarget target, IProgress<double> progress, CancellationToken cancellationToken)
2015-02-05 00:29:37 -05:00
{
2015-02-22 14:05:38 -05:00
var provider = GetProvider(target);
2015-02-26 15:06:42 -05:00
return provider.GetFile(pathParts, target, progress, cancellationToken);
2015-02-05 00:29:37 -05:00
}
2014-07-21 21:29:06 -04:00
}
}