aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
index a254d862c..72dc1bdb6 100644
--- a/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
+++ b/MediaBrowser.Server.Implementations/Sync/SyncJobProcessor.cs
@@ -336,11 +336,12 @@ namespace MediaBrowser.Server.Implementations.Sync
return new[] { item };
}
- public async Task EnsureSyncJobItems(CancellationToken cancellationToken)
+ private async Task EnsureSyncJobItems(string targetId, CancellationToken cancellationToken)
{
var jobResult = _syncRepo.GetJobs(new SyncJobQuery
{
- SyncNewContent = true
+ SyncNewContent = true,
+ TargetId = targetId
});
foreach (var job in jobResult.Items)
@@ -356,7 +357,7 @@ namespace MediaBrowser.Server.Implementations.Sync
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
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
}
+ 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)
{
if (items.Length > 0)
@@ -483,7 +499,7 @@ namespace MediaBrowser.Server.Implementations.Sync
// No sense creating external subs if we're already burning one into the video
var externalSubs = streamInfo.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode ?
new List<SubtitleStreamInfo>() :
- streamInfo.GetExternalSubtitles("dummy", false);
+ streamInfo.GetExternalSubtitles(false);
// Mark as requiring conversion if transcoding the video, or if any subtitles need to be extracted
var requiresVideoTranscoding = streamInfo.PlayMethod == PlayMethod.Transcode && job.Quality != SyncQuality.Original;