sync updates

This commit is contained in:
Luke Pulverenti
2015-02-03 13:14:53 -05:00
parent cf37c5cac1
commit 7fd4b97481
3 changed files with 75 additions and 23 deletions

View File

@@ -103,14 +103,14 @@ namespace MediaBrowser.Server.Implementations.Sync
var target = GetSyncTargets(request.UserId)
.FirstOrDefault(i => string.Equals(request.TargetId, i.Id));
if (target == null)
{
throw new ArgumentException("Sync target not found.");
}
var jobId = Guid.NewGuid().ToString("N");
var job = new SyncJob
{
Id = jobId,
@@ -748,5 +748,39 @@ namespace MediaBrowser.Server.Implementations.Sync
{
return _repo.GetLibraryItemIds(query);
}
public AudioOptions GetAudioOptions(SyncJobItem jobItem)
{
var profile = GetDeviceProfile(jobItem.TargetId);
return new AudioOptions
{
Profile = profile
};
}
public VideoOptions GetVideoOptions(SyncJobItem jobItem, SyncJob job)
{
var profile = GetDeviceProfile(jobItem.TargetId);
var maxBitrate = profile.MaxStaticBitrate;
if (maxBitrate.HasValue)
{
if (job.Quality == SyncQuality.Medium)
{
maxBitrate = Convert.ToInt32(maxBitrate.Value * .75);
}
else if (job.Quality == SyncQuality.Low)
{
maxBitrate = Convert.ToInt32(maxBitrate.Value * .5);
}
}
return new VideoOptions
{
Profile = profile,
MaxBitrate = maxBitrate
};
}
}
}