sync updates

This commit is contained in:
Luke Pulverenti
2015-02-04 14:13:00 -05:00
parent 6c3209e3f9
commit f2c3e014b7
14 changed files with 61 additions and 23 deletions

View File

@@ -75,6 +75,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_taskManager.TaskCompleted += _taskManager_TaskCompleted;
_syncManager.SyncJobCreated += _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled += _syncManager_SyncJobCancelled;
}
void _syncManager_SyncJobCancelled(object sender, GenericEventArgs<SyncJob> e)
{
_sessionManager.SendMessageToUserDeviceSessions(e.Argument.TargetId, "SyncJobCancelled", e.Argument, CancellationToken.None);
}
void _syncManager_SyncJobCreated(object sender, GenericEventArgs<SyncJobCreationResult> e)
@@ -189,6 +195,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
_appHost.HasPendingRestartChanged -= kernel_HasPendingRestartChanged;
_syncManager.SyncJobCreated -= _syncManager_SyncJobCreated;
_syncManager.SyncJobCancelled -= _syncManager_SyncJobCancelled;
}
}
}

View File

@@ -19,7 +19,7 @@
"PinCodeResetComplete": "The pin code has been reset.",
"PasswordResetConfirmation": "Are you sure you wish to reset the password?",
"PinCodeResetConfirmation": "Are you sure you wish to reset the pin code?",
"HeaderPinCodeReset": "Reset Pin Code",
"HeaderPinCodeReset": "Reset Pin Code",
"PasswordSaved": "Password saved.",
"PasswordMatchError": "Password and password confirmation must match.",
"OptionRelease": "Official Release",
@@ -48,10 +48,13 @@
"LabelFailed": "(failed)",
"ButtonHelp": "Help",
"ButtonSave": "Save",
"SyncJobStatusQueued": "Queued",
"SyncJobStatusInProgress": "In-Progress",
"SyncJobStatusCompleted": "Synced",
"SyncJobStatusCompletedWithError": "Synced with errors",
"SyncJobStatusQueued": "Queued",
"SyncJobStatusConverting": "Converting",
"SyncJobStatusFailed": "Failed",
"SyncJobStatusCancelled": "Cancelled",
"SyncJobStatusCompleted": "Synced",
"SyncJobStatusTransferring": "Transferring",
"SyncJobStatusCompletedWithError": "Synced with errors",
"LabelCollection": "Collection",
"HeaderAddToCollection": "Add to Collection",
"NewCollectionNameExample": "Example: Star Wars Collection",
@@ -91,6 +94,7 @@
"HeaderSelectSubtitles": "Select Subtitles",
"ButtonMarkForRemoval": "Remove from device",
"ButtonUnmarkForRemoval": "Cancel removal from device",
"LabelSyncQualityHelp": "Use high quality for the maximum supported quality by the device. Medium and Low reduce the allowed bitrate.",
"LabelDefaultStream": "(Default)",
"LabelForcedStream": "(Forced)",
"LabelDefaultForcedStream": "(Default/Forced)",

View File

@@ -172,7 +172,23 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Progress = null;
}
if (pct >= 100)
if (jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Failed))
{
job.Status = SyncJobStatus.Failed;
}
else if (jobItems.All(i => i.Status == SyncJobItemStatus.Cancelled))
{
job.Status = SyncJobStatus.Cancelled;
}
else if (jobItems.Any(i => i.Status == SyncJobItemStatus.Converting))
{
job.Status = SyncJobStatus.Converting;
}
else if (pct >= 100)
{
if (jobItems.Any(i => i.Status == SyncJobItemStatus.Failed))
{
@@ -183,13 +199,9 @@ namespace MediaBrowser.Server.Implementations.Sync
job.Status = SyncJobStatus.Completed;
}
}
else if (pct.Equals(0) && jobItems.All(i => i.Status == SyncJobItemStatus.Queued))
{
job.Status = SyncJobStatus.Queued;
}
else
{
job.Status = SyncJobStatus.InProgress;
job.Status = SyncJobStatus.Transferring;
}
return _syncRepo.Update(job);

View File

@@ -51,6 +51,7 @@ namespace MediaBrowser.Server.Implementations.Sync
public event EventHandler<GenericEventArgs<SyncJobCreationResult>> SyncJobCreated;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobCancelled;
public event EventHandler<GenericEventArgs<SyncJob>> SyncJobUpdated;
public SyncManager(ILibraryManager libraryManager, ISyncRepository repo, IImageProcessor imageProcessor, ILogger logger, IUserManager userManager, Func<IDtoService> dtoService, IApplicationHost appHost, ITVSeriesManager tvSeriesManager, Func<IMediaEncoder> mediaEncoder, IFileSystem fileSystem, Func<ISubtitleEncoder> subtitleEncoder, IConfigurationManager config)
{