diff --git a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs b/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
index f9327a71c..dd7fda2c5 100644
--- a/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/ICloudSyncProvider.cs
@@ -1,5 +1,7 @@
using MediaBrowser.Model.Sync;
using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
namespace MediaBrowser.Controller.Sync
{
@@ -17,5 +19,17 @@ namespace MediaBrowser.Controller.Sync
/// The user identifier.
/// IEnumerable<SyncTarget>.
IEnumerable GetSyncTargets(string userId);
+
+ ///
+ /// Transfers the item file.
+ ///
+ /// The server identifier.
+ /// The item identifier.
+ /// The input file.
+ /// The path parts.
+ /// The target.
+ /// The cancellation token.
+ /// Task.
+ Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
index 8ef54fd43..d11dd9d73 100644
--- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
+++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs
@@ -31,12 +31,11 @@ namespace MediaBrowser.Controller.Sync
///
/// The server identifier.
/// The item identifier.
+ /// The input file.
/// The path parts.
- /// The name.
- /// Type of the file.
/// The target.
/// The cancellation token.
/// Task.
- Task TransferItemFile(string serverId, string itemId, string[] pathParts, string name, ItemFileType fileType, SyncTarget target, CancellationToken cancellationToken);
+ Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
}
}
diff --git a/MediaBrowser.Server.Implementations/Sync/CloudSyncProvider.cs b/MediaBrowser.Server.Implementations/Sync/CloudSyncProvider.cs
index 59713b138..37caa561e 100644
--- a/MediaBrowser.Server.Implementations/Sync/CloudSyncProvider.cs
+++ b/MediaBrowser.Server.Implementations/Sync/CloudSyncProvider.cs
@@ -34,6 +34,11 @@ namespace MediaBrowser.Server.Implementations.Sync
get { return "Cloud Sync"; }
}
+ private ICloudSyncProvider GetProvider(SyncTarget target)
+ {
+ return null;
+ }
+
public Task> GetServerItemIds(string serverId, SyncTarget target, CancellationToken cancellationToken)
{
throw new NotImplementedException();
@@ -44,9 +49,11 @@ namespace MediaBrowser.Server.Implementations.Sync
throw new NotImplementedException();
}
- public Task TransferItemFile(string serverId, string itemId, string[] pathParts, string name, ItemFileType fileType, SyncTarget target, CancellationToken cancellationToken)
+ public Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken)
{
- throw new NotImplementedException();
+ var provider = GetProvider(target);
+
+ return provider.TransferItemFile(serverId, itemId, inputFile, pathParts, target, cancellationToken);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs
index 099e45a6e..349e6aa1d 100644
--- a/MediaBrowser.Server.Implementations/Sync/MediaSync.cs
+++ b/MediaBrowser.Server.Implementations/Sync/MediaSync.cs
@@ -1,6 +1,7 @@
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Sync;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging;
using MediaBrowser.Model.Sync;
using System;
@@ -29,10 +30,6 @@ namespace MediaBrowser.Server.Implementations.Sync
{
var serverId = _appHost.SystemId;
- await SyncData(provider, serverId, target, cancellationToken).ConfigureAwait(false);
- progress.Report(2);
-
- // Do the data sync twice so the server knows what was removed from the device
await SyncData(provider, serverId, target, cancellationToken).ConfigureAwait(false);
progress.Report(3);
@@ -44,6 +41,10 @@ namespace MediaBrowser.Server.Implementations.Sync
progress.Report(totalProgress);
});
await GetNewMedia(provider, target, serverId, innerProgress, cancellationToken);
+
+ // Do the data sync twice so the server knows what was removed from the device
+ await SyncData(provider, serverId, target, cancellationToken).ConfigureAwait(false);
+
progress.Report(100);
}
@@ -135,8 +136,10 @@ namespace MediaBrowser.Server.Implementations.Sync
try
{
- //await provider.TransferItemFile(serverId, libraryItem.Id, internalSyncJobItem.OutputPath, target, cancellationToken)
- // .ConfigureAwait(false);
+ string[] pathParts = GetPathParts(serverId, libraryItem);
+
+ await provider.TransferItemFile(serverId, libraryItem.Id, internalSyncJobItem.OutputPath, pathParts, target, cancellationToken)
+ .ConfigureAwait(false);
progress.Report(92);
@@ -170,5 +173,10 @@ namespace MediaBrowser.Server.Implementations.Sync
{
return provider.DeleteItem(serverId, itemId, target, cancellationToken);
}
+
+ private string[] GetPathParts(string serverId, BaseItemDto item)
+ {
+ return null;
+ }
}
}