3.0.5518.5

This commit is contained in:
Luke Pulverenti 2015-02-19 12:46:18 -05:00
parent d451386f5d
commit f2c3dade77
7 changed files with 34 additions and 13 deletions

View File

@ -272,9 +272,11 @@ namespace MediaBrowser.Api.Sync
} }
} }
public object Get(GetReadySyncItems request) public async Task<object> Get(GetReadySyncItems request)
{ {
return ToOptimizedResult(_syncManager.GetReadySyncItems(request.TargetId)); var result = await _syncManager.GetReadySyncItems(request.TargetId).ConfigureAwait(false);
return ToOptimizedResult(result);
} }
public async Task<object> Post(SyncData request) public async Task<object> Post(SyncData request)

View File

@ -123,7 +123,7 @@ namespace MediaBrowser.Controller.Sync
/// </summary> /// </summary>
/// <param name="targetId">The target identifier.</param> /// <param name="targetId">The target identifier.</param>
/// <returns>List&lt;SyncedItem&gt;.</returns> /// <returns>List&lt;SyncedItem&gt;.</returns>
List<SyncedItem> GetReadySyncItems(string targetId); Task<List<SyncedItem>> GetReadySyncItems(string targetId);
/// <summary> /// <summary>
/// Synchronizes the data. /// Synchronizes the data.

View File

@ -210,9 +210,8 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
_libraryMonitor.ReportFileSystemChangeBeginning(path); _libraryMonitor.ReportFileSystemChangeBeginning(path);
var renameRelatedFiles = false; var renameRelatedFiles = !hasRenamedFiles &&
//var renameRelatedFiles = !hasRenamedFiles && string.Equals(Path.GetDirectoryName(path), Path.GetDirectoryName(result.TargetPath), StringComparison.OrdinalIgnoreCase);
// string.Equals(Path.GetDirectoryName(path), Path.GetDirectoryName(result.TargetPath), StringComparison.OrdinalIgnoreCase);
if (renameRelatedFiles) if (renameRelatedFiles)
{ {

View File

@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Sync
IProgress<double> progress, IProgress<double> progress,
CancellationToken cancellationToken) CancellationToken cancellationToken)
{ {
var jobItems = _syncManager.GetReadySyncItems(target.Id); var jobItems = await _syncManager.GetReadySyncItems(target.Id).ConfigureAwait(false);
var numComplete = 0; var numComplete = 0;
double startingPercent = 0; double startingPercent = 0;

View File

@ -336,11 +336,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return new[] { item }; return new[] { item };
} }
public async Task EnsureSyncJobItems(CancellationToken cancellationToken) private async Task EnsureSyncJobItems(string targetId, CancellationToken cancellationToken)
{ {
var jobResult = _syncRepo.GetJobs(new SyncJobQuery var jobResult = _syncRepo.GetJobs(new SyncJobQuery
{ {
SyncNewContent = true SyncNewContent = true,
TargetId = targetId
}); });
foreach (var job in jobResult.Items) foreach (var job in jobResult.Items)
@ -356,7 +357,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public async Task Sync(IProgress<double> progress, CancellationToken cancellationToken) public async Task Sync(IProgress<double> progress, CancellationToken cancellationToken)
{ {
await EnsureSyncJobItems(cancellationToken).ConfigureAwait(false); await EnsureSyncJobItems(null, cancellationToken).ConfigureAwait(false);
// If it already has a converting status then is must have been aborted during conversion // If it already has a converting status then is must have been aborted during conversion
var result = _syncRepo.GetJobItems(new SyncJobItemQuery var result = _syncRepo.GetJobItems(new SyncJobItemQuery
@ -375,6 +376,21 @@ namespace MediaBrowser.Server.Implementations.Sync
// Clean files in sync temp folder that are not linked to any sync jobs // Clean files in sync temp folder that are not linked to any sync jobs
} }
public async Task SyncJobItems(string targetId, bool enableConversion, IProgress<double> progress,
CancellationToken cancellationToken)
{
await EnsureSyncJobItems(targetId, cancellationToken).ConfigureAwait(false);
// If it already has a converting status then is must have been aborted during conversion
var result = _syncRepo.GetJobItems(new SyncJobItemQuery
{
Statuses = new List<SyncJobItemStatus> { SyncJobItemStatus.Queued, SyncJobItemStatus.Converting },
TargetId = targetId
});
await SyncJobItems(result.Items, true, progress, cancellationToken).ConfigureAwait(false);
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken) public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{ {
if (items.Length > 0) if (items.Length > 0)

View File

@ -695,8 +695,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return _userDataManager.SaveUserData(new Guid(action.UserId), item, userData, UserDataSaveReason.Import, CancellationToken.None); return _userDataManager.SaveUserData(new Guid(action.UserId), item, userData, UserDataSaveReason.Import, CancellationToken.None);
} }
public List<SyncedItem> GetReadySyncItems(string targetId) public async Task<List<SyncedItem>> GetReadySyncItems(string targetId)
{ {
var processor = GetSyncJobProcessor();
await processor.SyncJobItems(targetId, false, new Progress<double>(), CancellationToken.None).ConfigureAwait(false);
var jobItemResult = GetJobItems(new SyncJobItemQuery var jobItemResult = GetJobItems(new SyncJobItemQuery
{ {
TargetId = targetId, TargetId = targetId,

View File

@ -1,4 +1,4 @@
using System.Reflection; using System.Reflection;
[assembly: AssemblyVersion("3.0.*")] //[assembly: AssemblyVersion("3.0.*")]
//[assembly: AssemblyVersion("3.0.5518.4")] [assembly: AssemblyVersion("3.0.5518.5")]