change sync job quality to a string
This commit is contained in:
parent
8f90e54faf
commit
cf6c46c6a6
|
@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Sync
|
|||
/// Gets or sets the quality.
|
||||
/// </summary>
|
||||
/// <value>The quality.</value>
|
||||
public SyncQuality Quality { get; set; }
|
||||
public string Quality { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the category.
|
||||
/// </summary>
|
||||
|
@ -98,7 +98,6 @@ namespace MediaBrowser.Model.Sync
|
|||
public SyncJob()
|
||||
{
|
||||
RequestedItemIds = new List<string>();
|
||||
Quality = SyncQuality.High;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,6 +485,12 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsOriginalQuality(SyncJob job)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(job.Quality) ||
|
||||
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)
|
||||
{
|
||||
var options = _syncManager.GetVideoOptions(jobItem, job);
|
||||
|
@ -504,7 +510,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
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;
|
||||
var requiresVideoTranscoding = streamInfo.PlayMethod == PlayMethod.Transcode && IsOriginalQuality(job);
|
||||
var requiresConversion = requiresVideoTranscoding || externalSubs.Any(i => RequiresExtraction(i, mediaSource));
|
||||
|
||||
if (requiresConversion && !enableConversion)
|
||||
|
@ -692,7 +698,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
jobItem.MediaSourceId = streamInfo.MediaSourceId;
|
||||
jobItem.TemporaryPath = GetTemporaryPath(jobItem);
|
||||
|
||||
if (streamInfo.PlayMethod == PlayMethod.Transcode && job.Quality != SyncQuality.Original)
|
||||
if (streamInfo.PlayMethod == PlayMethod.Transcode && !IsOriginalQuality(job))
|
||||
{
|
||||
if (!enableConversion)
|
||||
{
|
||||
|
|
|
@ -150,14 +150,10 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
SyncNewContent = request.SyncNewContent,
|
||||
ItemCount = items.Count,
|
||||
Category = request.Category,
|
||||
ParentId = request.ParentId
|
||||
ParentId = request.ParentId,
|
||||
Quality = request.Quality
|
||||
};
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(request.Quality))
|
||||
{
|
||||
job.Quality = (SyncQuality)Enum.Parse(typeof(SyncQuality), request.Quality, true);
|
||||
}
|
||||
|
||||
if (!request.Category.HasValue && request.ItemIds != null)
|
||||
{
|
||||
var requestedItems = request.ItemIds
|
||||
|
@ -565,34 +561,6 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
return item.Name;
|
||||
}
|
||||
|
||||
public DeviceProfile GetDeviceProfile(string targetId)
|
||||
{
|
||||
foreach (var provider in _providers)
|
||||
{
|
||||
foreach (var target in GetSyncTargets(provider))
|
||||
{
|
||||
if (string.Equals(target.Id, targetId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetDeviceProfile(provider, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public DeviceProfile GetDeviceProfile(ISyncProvider provider, SyncTarget target)
|
||||
{
|
||||
var hasProfile = provider as IHasSyncProfile;
|
||||
|
||||
if (hasProfile != null)
|
||||
{
|
||||
return hasProfile.GetDeviceProfile(target);
|
||||
}
|
||||
|
||||
return new CloudSyncProfile(true, false);
|
||||
}
|
||||
|
||||
public async Task ReportSyncJobItemTransferred(string id)
|
||||
{
|
||||
var jobItem = _repo.GetJobItem(id);
|
||||
|
@ -1021,11 +989,11 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
|
||||
if (maxBitrate.HasValue)
|
||||
{
|
||||
if (job.Quality == SyncQuality.Medium)
|
||||
if (string.Equals(job.Quality, "high", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
maxBitrate = Convert.ToInt32(maxBitrate.Value * .75);
|
||||
}
|
||||
else if (job.Quality == SyncQuality.Low)
|
||||
else if (string.Equals(job.Quality, "medium", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
maxBitrate = Convert.ToInt32(maxBitrate.Value * .5);
|
||||
}
|
||||
|
@ -1037,5 +1005,33 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
MaxBitrate = maxBitrate
|
||||
};
|
||||
}
|
||||
|
||||
public DeviceProfile GetDeviceProfile(string targetId)
|
||||
{
|
||||
foreach (var provider in _providers)
|
||||
{
|
||||
foreach (var target in GetSyncTargets(provider))
|
||||
{
|
||||
if (string.Equals(target.Id, targetId, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return GetDeviceProfile(provider, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public DeviceProfile GetDeviceProfile(ISyncProvider provider, SyncTarget target)
|
||||
{
|
||||
var hasProfile = provider as IHasSyncProfile;
|
||||
|
||||
if (hasProfile != null)
|
||||
{
|
||||
return hasProfile.GetDeviceProfile(target);
|
||||
}
|
||||
|
||||
return new CloudSyncProfile(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -210,7 +210,7 @@ namespace MediaBrowser.Server.Implementations.Sync
|
|||
|
||||
if (!reader.IsDBNull(3))
|
||||
{
|
||||
info.Quality = (SyncQuality)Enum.Parse(typeof(SyncQuality), reader.GetString(3), true);
|
||||
info.Quality = reader.GetString(3);
|
||||
}
|
||||
|
||||
if (!reader.IsDBNull(4))
|
||||
|
|
Loading…
Reference in New Issue
Block a user