|
|
|
@ -450,15 +450,6 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var deviceProfile = _syncManager.GetDeviceProfile(jobItem.TargetId);
|
|
|
|
|
if (deviceProfile == null)
|
|
|
|
|
{
|
|
|
|
|
jobItem.Status = SyncJobItemStatus.Failed;
|
|
|
|
|
_logger.Error("Unable to locate SyncTarget for JobItem {0}, SyncTargetId {1}", jobItem.Id, jobItem.TargetId);
|
|
|
|
|
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jobItem.Progress = 0;
|
|
|
|
|
|
|
|
|
|
var user = _userManager.GetUserById(job.UserId);
|
|
|
|
@ -466,17 +457,17 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
var video = item as Video;
|
|
|
|
|
if (video != null)
|
|
|
|
|
{
|
|
|
|
|
await Sync(jobItem, job, video, user, deviceProfile, enableConversion, progress, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
await Sync(jobItem, job, video, user, enableConversion, progress, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (item is Audio)
|
|
|
|
|
{
|
|
|
|
|
await Sync(jobItem, job, (Audio)item, user, deviceProfile, enableConversion, progress, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
await Sync(jobItem, job, (Audio)item, user, enableConversion, progress, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else if (item is Photo)
|
|
|
|
|
{
|
|
|
|
|
await Sync(jobItem, (Photo)item, deviceProfile, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
await Sync(jobItem, (Photo)item, cancellationToken).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
@ -491,13 +482,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
string.Equals(job.Quality, "original", StringComparison.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, SyncJob job, Video item, User user, DeviceProfile profile, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, SyncJob job, Video item, User user, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
var options = _syncManager.GetVideoOptions(jobItem, job);
|
|
|
|
|
|
|
|
|
|
options.DeviceId = jobItem.TargetId;
|
|
|
|
|
options.Context = EncodingContext.Static;
|
|
|
|
|
options.Profile = profile;
|
|
|
|
|
options.ItemId = item.Id.ToString("N");
|
|
|
|
|
options.MediaSources = _mediaSourceManager.GetStaticMediaSources(item, false, user).ToList();
|
|
|
|
|
|
|
|
|
@ -548,7 +538,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jobItem.OutputPath = await _mediaEncoder.EncodeVideo(new EncodingJobOptions(streamInfo, profile)
|
|
|
|
|
jobItem.OutputPath = await _mediaEncoder.EncodeVideo(new EncodingJobOptions(streamInfo, options.Profile)
|
|
|
|
|
{
|
|
|
|
|
OutputDirectory = jobItem.TemporaryPath
|
|
|
|
|
|
|
|
|
@ -682,13 +672,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
|
|
|
|
|
private const int DatabaseProgressUpdateIntervalSeconds = 2;
|
|
|
|
|
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, SyncJob job, Audio item, User user, DeviceProfile profile, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, SyncJob job, Audio item, User user, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
var options = _syncManager.GetAudioOptions(jobItem);
|
|
|
|
|
var options = _syncManager.GetAudioOptions(jobItem, job);
|
|
|
|
|
|
|
|
|
|
options.DeviceId = jobItem.TargetId;
|
|
|
|
|
options.Context = EncodingContext.Static;
|
|
|
|
|
options.Profile = profile;
|
|
|
|
|
options.ItemId = item.Id.ToString("N");
|
|
|
|
|
options.MediaSources = _mediaSourceManager.GetStaticMediaSources(item, false, user).ToList();
|
|
|
|
|
|
|
|
|
@ -725,7 +714,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jobItem.OutputPath = await _mediaEncoder.EncodeAudio(new EncodingJobOptions(streamInfo, profile)
|
|
|
|
|
jobItem.OutputPath = await _mediaEncoder.EncodeAudio(new EncodingJobOptions(streamInfo, options.Profile)
|
|
|
|
|
{
|
|
|
|
|
OutputDirectory = jobItem.TemporaryPath
|
|
|
|
|
|
|
|
|
@ -773,7 +762,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|
|
|
|
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, Photo item, DeviceProfile profile, CancellationToken cancellationToken)
|
|
|
|
|
private async Task Sync(SyncJobItem jobItem, Photo item, CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
jobItem.OutputPath = item.Path;
|
|
|
|
|
|
|
|
|
|