cloud sync progress
This commit is contained in:
parent
20ceca1479
commit
084df0a20e
|
@ -1,5 +1,7 @@
|
||||||
using MediaBrowser.Model.Sync;
|
using MediaBrowser.Model.Sync;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Sync
|
namespace MediaBrowser.Controller.Sync
|
||||||
{
|
{
|
||||||
|
@ -17,5 +19,17 @@ namespace MediaBrowser.Controller.Sync
|
||||||
/// <param name="userId">The user identifier.</param>
|
/// <param name="userId">The user identifier.</param>
|
||||||
/// <returns>IEnumerable<SyncTarget>.</returns>
|
/// <returns>IEnumerable<SyncTarget>.</returns>
|
||||||
IEnumerable<SyncTarget> GetSyncTargets(string userId);
|
IEnumerable<SyncTarget> GetSyncTargets(string userId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transfers the item file.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="serverId">The server identifier.</param>
|
||||||
|
/// <param name="itemId">The item identifier.</param>
|
||||||
|
/// <param name="inputFile">The input file.</param>
|
||||||
|
/// <param name="pathParts">The path parts.</param>
|
||||||
|
/// <param name="target">The target.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task TransferItemFile(string serverId, string itemId, string inputFile, string[] pathParts, SyncTarget target, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,12 +31,11 @@ namespace MediaBrowser.Controller.Sync
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="serverId">The server identifier.</param>
|
/// <param name="serverId">The server identifier.</param>
|
||||||
/// <param name="itemId">The item identifier.</param>
|
/// <param name="itemId">The item identifier.</param>
|
||||||
|
/// <param name="inputFile">The input file.</param>
|
||||||
/// <param name="pathParts">The path parts.</param>
|
/// <param name="pathParts">The path parts.</param>
|
||||||
/// <param name="name">The name.</param>
|
|
||||||
/// <param name="fileType">Type of the file.</param>
|
|
||||||
/// <param name="target">The target.</param>
|
/// <param name="target">The target.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
get { return "Cloud Sync"; }
|
get { return "Cloud Sync"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ICloudSyncProvider GetProvider(SyncTarget target)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Task<List<string>> GetServerItemIds(string serverId, SyncTarget target, CancellationToken cancellationToken)
|
public Task<List<string>> GetServerItemIds(string serverId, SyncTarget target, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
@ -44,9 +49,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
throw new NotImplementedException();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using MediaBrowser.Common.Progress;
|
using MediaBrowser.Common.Progress;
|
||||||
using MediaBrowser.Controller;
|
using MediaBrowser.Controller;
|
||||||
using MediaBrowser.Controller.Sync;
|
using MediaBrowser.Controller.Sync;
|
||||||
|
using MediaBrowser.Model.Dto;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
using MediaBrowser.Model.Sync;
|
using MediaBrowser.Model.Sync;
|
||||||
using System;
|
using System;
|
||||||
|
@ -29,10 +30,6 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
var serverId = _appHost.SystemId;
|
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);
|
await SyncData(provider, serverId, target, cancellationToken).ConfigureAwait(false);
|
||||||
progress.Report(3);
|
progress.Report(3);
|
||||||
|
|
||||||
|
@ -44,6 +41,10 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
progress.Report(totalProgress);
|
progress.Report(totalProgress);
|
||||||
});
|
});
|
||||||
await GetNewMedia(provider, target, serverId, innerProgress, cancellationToken);
|
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);
|
progress.Report(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,8 +136,10 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//await provider.TransferItemFile(serverId, libraryItem.Id, internalSyncJobItem.OutputPath, target, cancellationToken)
|
string[] pathParts = GetPathParts(serverId, libraryItem);
|
||||||
// .ConfigureAwait(false);
|
|
||||||
|
await provider.TransferItemFile(serverId, libraryItem.Id, internalSyncJobItem.OutputPath, pathParts, target, cancellationToken)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
progress.Report(92);
|
progress.Report(92);
|
||||||
|
|
||||||
|
@ -170,5 +173,10 @@ namespace MediaBrowser.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
return provider.DeleteItem(serverId, itemId, target, cancellationToken);
|
return provider.DeleteItem(serverId, itemId, target, cancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string[] GetPathParts(string serverId, BaseItemDto item)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user