1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

sync updates

This commit is contained in:
Luke Pulverenti 2015-03-15 15:10:27 -04:00
parent 249adcb2c3
commit 63d1ad89c8
2 changed files with 29 additions and 30 deletions

View file

@ -24,30 +24,17 @@
return; return;
} }
var quality = $('#selectQuality', form).val();
if (quality == 'custom') {
quality = parseFloat($('#txtBitrate', form).val()) * 1000000;
}
var options = { var options = {
userId: userId, userId: userId,
TargetId: target, TargetId: target,
Profile: $('#selectProfile', form).val() || null,
Quality: quality || null,
Name: $('#txtSyncJobName', form).val(),
SyncNewContent: $('#chkSyncNewContent', form).checked(),
UnwatchedOnly: $('#chkUnwatchedOnly', form).checked(),
ItemLimit: $('#txtItemLimit').val() || null,
ParentId: syncOptions.ParentId, ParentId: syncOptions.ParentId,
Category: syncOptions.Category Category: syncOptions.Category
}; };
setJobValues(options, form);
if (syncOptions.items && syncOptions.items.length) { if (syncOptions.items && syncOptions.items.length) {
options.ItemIds = (syncOptions.items || []).map(function (i) { options.ItemIds = (syncOptions.items || []).map(function (i) {
return i.Id || i; return i.Id || i;
@ -69,6 +56,23 @@
}); });
} }
function setJobValues(job, form) {
var bitrate = $('#txtBitrate', form).val() || null;
if (bitrate) {
bitrate = parseFloat(bitrate) * 1000000;
}
job.Name = $('#txtSyncJobName', form).val();
job.Quality = $('#selectQuality', form).val() || null;
job.Profile = $('#selectProfile', form).val() || null;
job.Bitrate = bitrate;
job.ItemLimit = $('#txtItemLimit', form).val() || null;
job.SyncNewContent = $('#chkSyncNewContent', form).checked();
job.UnwatchedOnly = $('#chkUnwatchedOnly', form).checked();
}
function renderForm(options) { function renderForm(options) {
var elem = options.elem; var elem = options.elem;
@ -288,7 +292,7 @@
$('#txtBitrate', form).attr('required', 'required'); $('#txtBitrate', form).attr('required', 'required');
} else { } else {
$('.fldBitrate', form).hide(); $('.fldBitrate', form).hide();
$('#txtBitrate', form).removeAttr('required'); $('#txtBitrate', form).removeAttr('required').val('');
} }
} }
@ -349,8 +353,8 @@
showMenu: showSyncMenu, showMenu: showSyncMenu,
isAvailable: isAvailable, isAvailable: isAvailable,
renderForm: renderForm renderForm: renderForm,
setJobValues: setJobValues
}; };
function showSyncButtonsPerUser(page) { function showSyncButtonsPerUser(page) {

View file

@ -261,6 +261,12 @@
$('#chkSyncNewContent', page).checked(job.SyncNewContent).checkboxradio('refresh'); $('#chkSyncNewContent', page).checked(job.SyncNewContent).checkboxradio('refresh');
$('#txtItemLimit', page).val(job.ItemLimit); $('#txtItemLimit', page).val(job.ItemLimit);
if (job.Bitrate) {
$('#txtBitrate', page).val(job.Bitrate / 1000000);
} else {
$('#txtBitrate', page).val('');
}
var target = editOptions.Targets.filter(function (t) { var target = editOptions.Targets.filter(function (t) {
return t.Id == job.TargetId; return t.Id == job.TargetId;
})[0]; })[0];
@ -320,18 +326,7 @@
ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs/' + id)).done(function (job) { ApiClient.getJSON(ApiClient.getUrl('Sync/Jobs/' + id)).done(function (job) {
var quality = $('#selectQuality', page).val(); SyncManager.setJobValues(job, page);
if (quality == 'custom') {
quality = parseFloat($('#txtBitrate', page).val()) * 1000000;
}
job.Name = $('#txtSyncJobName', page).val();
job.Quality = quality || null;
job.Profile = $('#selectProfile', page).val() || null;
job.ItemLimit = $('#txtItemLimit', page).val() || job.ItemLimit;
job.SyncNewContent = $('#chkSyncNewContent', page).checked();
job.UnwatchedOnly = $('#chkUnwatchedOnly', page).checked();
ApiClient.ajax({ ApiClient.ajax({