diff --git a/MediaBrowser.Api/Sync/SyncService.cs b/MediaBrowser.Api/Sync/SyncService.cs
index c763aa8df1..b30df572b6 100644
--- a/MediaBrowser.Api/Sync/SyncService.cs
+++ b/MediaBrowser.Api/Sync/SyncService.cs
@@ -44,6 +44,20 @@ namespace MediaBrowser.Api.Sync
public string Id { get; set; }
}
+ [Route("/Sync/JobItems/{Id}/MarkForRemoval", "POST", Summary = "Marks a job item for removal")]
+ public class MarkJobItemForRemoval : IReturnVoid
+ {
+ [ApiMember(Name = "Id", Description = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
+ public string Id { get; set; }
+ }
+
+ [Route("/Sync/JobItems/{Id}/UnmarkForRemoval", "POST", Summary = "Unmarks a job item for removal")]
+ public class UnmarkJobItemForRemoval : IReturnVoid
+ {
+ [ApiMember(Name = "Id", Description = "Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
+ public string Id { get; set; }
+ }
+
[Route("/Sync/JobItems/{Id}", "DELETE", Summary = "Cancels a sync job item")]
public class CancelSyncJobItem : IReturnVoid
{
@@ -299,5 +313,19 @@ namespace MediaBrowser.Api.Sync
Task.WaitAll(task);
}
+
+ public void Post(MarkJobItemForRemoval request)
+ {
+ var task = _syncManager.MarkJobItemForRemoval(request.Id);
+
+ Task.WaitAll(task);
+ }
+
+ public void Post(UnmarkJobItemForRemoval request)
+ {
+ var task = _syncManager.UnmarkJobItemForRemoval(request.Id);
+
+ Task.WaitAll(task);
+ }
}
}
diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.cs
index 8e4b6a44a0..62b6a3a379 100644
--- a/MediaBrowser.Controller/Sync/ISyncManager.cs
+++ b/MediaBrowser.Controller/Sync/ISyncManager.cs
@@ -128,5 +128,19 @@ namespace MediaBrowser.Controller.Sync
/// The request.
/// Task<SyncDataResponse>.
Task SyncData(SyncDataRequest request);
+
+ ///
+ /// Marks the job item for removal.
+ ///
+ /// The identifier.
+ /// Task.
+ Task MarkJobItemForRemoval(string id);
+
+ ///
+ /// Unmarks the job item for removal.
+ ///
+ /// The identifier.
+ /// Task.
+ Task UnmarkJobItemForRemoval(string id);
}
}
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index e8535278bb..b6938b2174 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -1449,12 +1449,41 @@ namespace MediaBrowser.Model.ApiClient
/// The request.
/// Task<SyncDataResponse>.
Task SyncData(SyncDataRequest request);
-
///
/// Gets the synchronize job item file URL.
///
/// The identifier.
/// System.String.
string GetSyncJobItemFileUrl(string id);
+ ///
+ /// Marks the synchronize job item for removal.
+ ///
+ /// The identifier.
+ /// Task.
+ Task MarkSyncJobItemForRemoval(string id);
+ ///
+ /// Unmarks the synchronize job item for removal.
+ ///
+ /// The identifier.
+ /// Task.
+ Task UnmarkSyncJobItemForRemoval(string id);
+ ///
+ /// Queues the failed synchronize job item for retry.
+ ///
+ /// The identifier.
+ /// Task.
+ Task QueueFailedSyncJobItemForRetry(string id);
+ ///
+ /// Cancels the synchronize job item.
+ ///
+ /// The identifier.
+ /// Task.
+ Task CancelSyncJobItem(string id);
+ ///
+ /// Enables the cancelled synchronize job item.
+ ///
+ /// The identifier.
+ /// Task.
+ Task EnableCancelledSyncJobItem(string id);
}
}
\ No newline at end of file
diff --git a/MediaBrowser.Model/Sync/SyncJobItem.cs b/MediaBrowser.Model/Sync/SyncJobItem.cs
index 133065bf92..195d1e17ef 100644
--- a/MediaBrowser.Model/Sync/SyncJobItem.cs
+++ b/MediaBrowser.Model/Sync/SyncJobItem.cs
@@ -86,8 +86,15 @@ namespace MediaBrowser.Model.Sync
///
/// The temporary path.
public string TemporaryPath { get; set; }
+ ///
+ /// Gets or sets the additional files.
+ ///
+ /// The additional files.
public List AdditionalFiles { get; set; }
-
+ ///
+ /// Gets or sets a value indicating whether this instance is marked for removal.
+ ///
+ /// true if this instance is marked for removal; otherwise, false.
public bool IsMarkedForRemoval { get; set; }
public SyncJobItem()
diff --git a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
index e4d20d3a15..62619a5672 100644
--- a/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
+++ b/MediaBrowser.Server.Implementations/Localization/JavaScript/javascript.json
@@ -59,6 +59,7 @@
"ButtonCancelItem": "Cancel item",
"ButtonQueueForRetry": "Queue for retry",
"ButtonReenable": "Re-enable",
+ "SyncJobItemStatusSyncedMarkForRemoval": "Marked for removal",
"LabelAbortedByServerShutdown": "(Aborted by server shutdown)",
"LabelScheduledTaskLastRan": "Last ran {0}, taking {1}.",
"HeaderDeleteTaskTrigger": "Delete Task Trigger",
@@ -70,6 +71,8 @@
"LabelFree": "Free",
"HeaderSelectAudio": "Select Audio",
"HeaderSelectSubtitles": "Select Subtitles",
+ "ButtonMarkForRemoval": "Mark for removal from device",
+ "ButtonUnmarkForRemoval": "Unmark for removal from device",
"LabelDefaultStream": "(Default)",
"LabelForcedStream": "(Forced)",
"LabelDefaultForcedStream": "(Default/Forced)",
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
index 7e4455ab36..b5e29533bb 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs
@@ -684,5 +684,41 @@ namespace MediaBrowser.Server.Implementations.Sync
await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
}
+
+ public async Task MarkJobItemForRemoval(string id)
+ {
+ var jobItem = _repo.GetJobItem(id);
+
+ if (jobItem.Status != SyncJobItemStatus.Synced)
+ {
+ throw new ArgumentException("Operation is not valid for this job item");
+ }
+
+ jobItem.IsMarkedForRemoval = true;
+
+ await _repo.Update(jobItem).ConfigureAwait(false);
+
+ var processor = GetSyncJobProcessor();
+
+ await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
+ }
+
+ public async Task UnmarkJobItemForRemoval(string id)
+ {
+ var jobItem = _repo.GetJobItem(id);
+
+ if (jobItem.Status != SyncJobItemStatus.Synced)
+ {
+ throw new ArgumentException("Operation is not valid for this job item");
+ }
+
+ jobItem.IsMarkedForRemoval = false;
+
+ await _repo.Update(jobItem).ConfigureAwait(false);
+
+ var processor = GetSyncJobProcessor();
+
+ await processor.UpdateJobStatus(jobItem.JobId).ConfigureAwait(false);
+ }
}
}