Merge pull request #2092 from MediaBrowser/dev

update sync settings
This commit is contained in:
Luke 2016-08-23 01:08:46 -04:00 committed by GitHub
commit 66ef2ef664
16 changed files with 98 additions and 131 deletions

View File

@ -37,7 +37,16 @@ define(['appStorage', 'events'], function (appStorage, events) {
self.set('preferredVideoBitrate', val); self.set('preferredVideoBitrate', val);
} }
return parseInt(self.get('preferredVideoBitrate') || '') || 1500000; return parseInt(self.get('preferredVideoBitrate') || '0') || 1500000;
};
self.maxStaticMusicBitrate = function (val) {
if (val !== undefined) {
self.set('maxStaticMusicBitrate', val);
}
return parseInt(self.get('maxStaticMusicBitrate') || '0') || null;
}; };
self.maxChromecastBitrate = function (val) { self.maxChromecastBitrate = function (val) {

View File

@ -441,7 +441,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'embyRouter',
items: [ items: [
{ {
Id: itemId Id: itemId
}] }],
isLocalSync: true
}); });
}); });
getResolveFunction(resolve, id)(); getResolveFunction(resolve, id)();

View File

@ -358,7 +358,8 @@
return { return {
Id: i Id: i
}; };
}) }),
isLocalSync: true
}); });
}); });
hideSelections(); hideSelections();

View File

@ -12,13 +12,6 @@
<div class="checkboxList uploadServerList"> <div class="checkboxList uploadServerList">
</div> </div>
<br />
<br />
<button is="emby-button" type="submit" class="raised submit block">
<i class="md-icon">check</i>
<span>${ButtonSave}</span>
</button>
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,4 +1,4 @@
define(['dialogHelper', 'paper-checkbox', 'paper-input', 'emby-button', 'paper-icon-button-light'], function (dialogHelper) { define(['dialogHelper', 'paper-checkbox', 'emby-input', 'emby-button', 'paper-icon-button-light'], function (dialogHelper) {
var extractedName; var extractedName;
var extractedYear; var extractedYear;

View File

@ -25,14 +25,14 @@
<select id="selectSeriesFolder" data-mini="true"></select> <select id="selectSeriesFolder" data-mini="true"></select>
</div> </div>
</div> </div>
<div style="margin: 1em 0;"> <div class="inputContainer">
<paper-input id="txtSeason" type="number" pattern="[0-9]*" required min="0" label="${LabelSeasonNumber}"></paper-input> <input is="emby-input" id="txtSeason" type="number" pattern="[0-9]*" required min="0" label="${LabelSeasonNumber}"/>
</div> </div>
<div style="margin: 1em 0;"> <div class="inputContainer">
<paper-input id="txtEpisode" type="number" pattern="[0-9]*" required min="0" label="${LabelEpisodeNumber}"></paper-input> <input is="emby-input" id="txtEpisode" type="number" pattern="[0-9]*" required min="0" label="${LabelEpisodeNumber}"/>
</div> </div>
<div style="margin: 1em 0;"> <div class="inputContainer">
<paper-input id="txtEndingEpisode" type="number" pattern="[0-9]*" min="0" label="${LabelEndingEpisodeNumber}"></paper-input> <input is="emby-input" id="txtEndingEpisode" type="number" pattern="[0-9]*" min="0" label="${LabelEndingEpisodeNumber}"/>
<div class="fieldDescription">${LabelEndingEpisodeNumberHelp}</div> <div class="fieldDescription">${LabelEndingEpisodeNumberHelp}</div>
</div> </div>
<div class="fldRemember hide"> <div class="fldRemember hide">

View File

@ -24,7 +24,7 @@
<div class="inputContainer"> <div class="inputContainer">
<div style="display: flex; align-items: center;"> <div style="display: flex; align-items: center;">
<div style="flex-grow:1;"> <div style="flex-grow:1;">
<input is="emby-input" id="txtMetadataPath" label="${LabelMetadataPath}" required="required" autocomplete="off" /> <input is="emby-input" id="txtMetadataPath" label="${LabelMetadataPath}" autocomplete="off" />
</div> </div>
<button type="button" is="paper-icon-button-light" id="btnSelectMetadataPath" title="${ButtonSelectDirectory}"><i class="md-icon">search</i></button> <button type="button" is="paper-icon-button-light" id="btnSelectMetadataPath" title="${ButtonSelectDirectory}"><i class="md-icon">search</i></button>
</div> </div>

View File

@ -2,14 +2,13 @@
<div data-role="content"> <div data-role="content">
<div class="readOnlyContent" style="margin: 0 auto;"> <div class="readOnlyContent" style="margin: 0 auto;">
<h1 class="settingsMenuHeader">${HeaderSettings}</h1> <h1 class="settingsMenuHeader" style="padding-left:.25em;">${HeaderSettings}</h1>
<div> <div>
<a href="#" class="clearLink lnkDisplayPreferences"> <a href="#" class="clearLink lnkDisplayPreferences">
<div class="listItem"> <div class="listItem">
<i class="md-icon listItemIcon" style="background-color: #03a9f4;">tv</i> <i class="md-icon listItemIcon" style="background-color: #03a9f4;">tv</i>
<div class="listItemBody two-line"> <div class="listItemBody">
<div>${ButtonDisplaySettings}</div> <div>${HeaderDisplay}</div>
<div class="secondary">${ButtonDisplaySettingsHelp}</div>
</div> </div>
</div> </div>
</a> </a>
@ -17,9 +16,8 @@
<a href="#" class="clearLink lnkHomeScreenPreferences"> <a href="#" class="clearLink lnkHomeScreenPreferences">
<div class="listItem"> <div class="listItem">
<i class="md-icon listItemIcon" style="background-color: #e57373;">home</i> <i class="md-icon listItemIcon" style="background-color: #e57373;">home</i>
<div class="listItemBody two-line"> <div class="listItemBody">
<div>${ButtonHomeScreenSettings}</div> <div>${TabHomeScreen}</div>
<div class="secondary">${ButtonHomeScreenSettingsHelp}</div>
</div> </div>
</div> </div>
</a> </a>
@ -27,9 +25,8 @@
<a href="#" class="clearLink lnkLanguagePreferences"> <a href="#" class="clearLink lnkLanguagePreferences">
<div class="listItem"> <div class="listItem">
<i class="md-icon listItemIcon" style="background-color: #81c784;">play_circle_filled</i> <i class="md-icon listItemIcon" style="background-color: #81c784;">play_circle_filled</i>
<div class="listItemBody two-line"> <div class="listItemBody">
<div>${ButtonPlaybackSettings}</div> <div>${TitlePlayback}</div>
<div class="secondary">${ButtonPlaybackSettingsHelp}</div>
</div> </div>
</div> </div>
</a> </a>
@ -37,9 +34,8 @@
<a href="#" class="clearLink lnkMyProfile"> <a href="#" class="clearLink lnkMyProfile">
<div class="listItem"> <div class="listItem">
<i class="md-icon listItemIcon" style="background-color: #ffd54f;">person</i> <i class="md-icon listItemIcon" style="background-color: #ffd54f;">person</i>
<div class="listItemBody two-line"> <div class="listItemBody">
<div>${ButtonProfile}</div> <div>${ButtonProfile}</div>
<div class="secondary">${ButtonProfileHelp}</div>
</div> </div>
</div> </div>
</a> </a>
@ -63,8 +59,7 @@
</a> </a>
</div> </div>
<div> <div>
<br /> <h1 class="headerUser" style="padding-left:.25em;"></h1>
<h1 class="headerUser"></h1>
<div> <div>
<a href="selectserver.html" class="clearLink selectServer hide"> <a href="selectserver.html" class="clearLink selectServer hide">
<div class="listItem"> <div class="listItem">
@ -84,8 +79,7 @@
</div> </div>
<div class="adminSection hide"> <div class="adminSection hide">
<br /> <h1 style="padding-left:.25em;">${HeaderAdmin}</h1>
<h1>${HeaderAdmin}</h1>
<div> <div>
<a href="dashboard.html" class="clearLink"> <a href="dashboard.html" class="clearLink">
<div class="listItem"> <div class="listItem">

View File

@ -19,16 +19,22 @@
</div> </div>
</div> </div>
<div class="selectContainer">
<select is="emby-select" class="selectAudioBitrate" label="${LabelMaxAudioFileBitrate}">
<option value="">${OptionNone}</option>
<option value="320000">320K</option>
<option value="256000">256K</option>
<option value="192000">192K</option>
<option value="128000">128K</option>
<option value="64000">64K</option>
</select>
<div class="fieldDescription">${LabelMaxAudioFileBitrateHelp}</div>
</div>
<label class="checkboxContainer"> <label class="checkboxContainer">
<input type="checkbox" is="emby-checkbox" id="chkWifi" /> <input type="checkbox" is="emby-checkbox" id="chkWifi" />
<span>${OptionSyncOnlyOnWifi}</span> <span>${OptionSyncOnlyOnWifi}</span>
</label> </label>
<br />
<button is="emby-button" type="submit" class="raised submit block">
<i class="md-icon">check</i>
<span>${ButtonSave}</span>
</button>
</form> </form>
</div> </div>
</div> </div>

View File

@ -16,7 +16,7 @@
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
} }
function saveUser(page, user) { function saveUser(page) {
var chkUploadServer = page.querySelectorAll('.chkUploadServer'); var chkUploadServer = page.querySelectorAll('.chkUploadServer');
var cameraUploadServers = []; var cameraUploadServers = [];
@ -47,13 +47,7 @@
Dashboard.showLoadingMsg(); Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId(); saveUser(view);
ApiClient.getUser(userId).then(function (user) {
saveUser(view, user);
});
// Disable default form submission // Disable default form submission
e.preventDefault(); e.preventDefault();
@ -72,6 +66,11 @@
loadForm(page, user); loadForm(page, user);
}); });
}); });
view.addEventListener('viewbeforehide', function () {
saveUser(this);
});
}; };
}); });

View File

@ -2057,7 +2057,8 @@
if (this.checked) { if (this.checked) {
require(['syncDialog'], function (syncDialog) { require(['syncDialog'], function (syncDialog) {
syncDialog.showMenu({ syncDialog.showMenu({
items: [currentItem] items: [currentItem],
isLocalSync: true
}).then(function () { }).then(function () {
reload(view, params); reload(view, params);
}, resetSyncStatus); }, resetSyncStatus);

View File

@ -62,9 +62,7 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
var currentSrc = (self.getCurrentSrc(mediaRenderer) || '').toLowerCase(); var currentSrc = (self.getCurrentSrc(mediaRenderer) || '').toLowerCase();
if (currentSrc.indexOf('.m3u8') != -1) { if (currentSrc.indexOf('.m3u8') != -1) {
if (currentSrc.indexOf('forcelivestream=true') == -1) {
return true; return true;
}
} else { } else {
var duration = mediaRenderer.duration(); var duration = mediaRenderer.duration();
return duration && !isNaN(duration) && duration != Number.POSITIVE_INFINITY && duration != Number.NEGATIVE_INFINITY; return duration && !isNaN(duration) && duration != Number.POSITIVE_INFINITY && duration != Number.NEGATIVE_INFINITY;
@ -538,11 +536,6 @@ define(['appSettings', 'userSettings', 'appStorage', 'datetime'], function (appS
if (mediaSource.TranscodingSubProtocol == 'hls') { if (mediaSource.TranscodingSubProtocol == 'hls') {
if (mediaUrl.toLowerCase().indexOf('forcelivestream=true') != -1) {
startPositionInSeekParam = 0;
startTimeTicksOffset = startPosition || 0;
}
contentType = 'application/x-mpegURL'; contentType = 'application/x-mpegURL';
} else { } else {

View File

@ -1,45 +1,26 @@
define(['appSettings', 'apphost'], function (appSettings, appHost) { define(['appSettings', 'apphost', 'emby-checkbox', 'emby-select', 'emby-input'], function (appSettings, appHost) {
function loadForm(page, user) { function loadForm(page, user) {
page.querySelector('#txtSyncPath').value = appSettings.syncPath() || ''; page.querySelector('#txtSyncPath').value = appSettings.syncPath() || '';
page.querySelector('#chkWifi').checked = appSettings.syncOnlyOnWifi(); page.querySelector('#chkWifi').checked = appSettings.syncOnlyOnWifi();
page.querySelector('.selectAudioBitrate').value = appSettings.maxStaticMusicBitrate() || '';
Dashboard.hideLoadingMsg();
} }
function saveUser(page, user) { function saveUser(page) {
var syncPath = page.querySelector('#txtSyncPath').value; var syncPath = page.querySelector('#txtSyncPath').value;
appSettings.syncPath(syncPath); appSettings.syncPath(syncPath);
appSettings.syncOnlyOnWifi(page.querySelector('#chkWifi').checked); appSettings.syncOnlyOnWifi(page.querySelector('#chkWifi').checked);
appSettings.maxStaticMusicBitrate(page.querySelector('.selectAudioBitrate').value || null);
Dashboard.hideLoadingMsg();
require(['toast'], function (toast) {
toast(Globalize.translate('SettingsSaved'));
});
if (syncPath) {
if (window.MainActivity) {
MainActivity.authorizeStorage();
}
}
} }
return function (view, params) { return function (view, params) {
view.querySelector('form').addEventListener('submit', function (e) { view.querySelector('form').addEventListener('submit', function (e) {
Dashboard.showLoadingMsg(); saveUser(view);
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
ApiClient.getUser(userId).then(function (user) {
saveUser(view, user);
});
// Disable default form submission // Disable default form submission
e.preventDefault(); e.preventDefault();
@ -61,8 +42,6 @@
view.addEventListener('viewshow', function () { view.addEventListener('viewshow', function () {
var page = this; var page = this;
Dashboard.showLoadingMsg();
var userId = getParameterByName('userId') || Dashboard.getCurrentUserId(); var userId = getParameterByName('userId') || Dashboard.getCurrentUserId();
ApiClient.getUser(userId).then(function (user) { ApiClient.getUser(userId).then(function (user) {
@ -76,6 +55,11 @@
page.querySelector('.fldSyncPath').classList.add('hide'); page.querySelector('.fldSyncPath').classList.add('hide');
} }
}); });
view.addEventListener('viewbeforehide', function () {
saveUser(this);
});
}; };
}); });

View File

@ -922,6 +922,7 @@ var Dashboard = {
} }
profile.MaxStreamingBitrate = bitrateSetting; profile.MaxStreamingBitrate = bitrateSetting;
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
resolve(profile); resolve(profile);
}); });

View File

@ -86,7 +86,7 @@
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
require(['emby-checkbox', 'emby-input', 'emby-collapse'], function () { require(['emby-checkbox', 'emby-input', 'emby-select'], function () {
appHost.appInfo().then(function (appInfo) { appHost.appInfo().then(function (appInfo) {
renderFormInternal(options, appInfo, resolve); renderFormInternal(options, appInfo, resolve);
@ -104,22 +104,22 @@
var html = ''; var html = '';
var targetContainerClass = options.isLocalSync ? ' hide' : '';
if (options.showName || dialogOptions.Options.indexOf('Name') != -1) { if (options.showName || dialogOptions.Options.indexOf('Name') != -1) {
html += '<div class="inputContainer">'; html += '<div class="inputContainer' + targetContainerClass + '">';
html += '<input is="emby-input" type="text" id="txtSyncJobName" class="txtSyncJobName" required="required" label="' + Globalize.translate('LabelSyncJobName') + '"/>'; html += '<input is="emby-input" type="text" id="txtSyncJobName" class="txtSyncJobName" required="required" label="' + Globalize.translate('LabelSyncJobName') + '"/>';
html += '</div>'; html += '</div>';
html += '<br/>';
} }
html += '<div>';
if (options.readOnlySyncTarget) { if (options.readOnlySyncTarget) {
html += '<div class="inputContainer">'; html += '<div class="inputContainer' + targetContainerClass + '">';
html += '<input is="emby-input" type="text" id="selectSyncTarget" readonly label="' + Globalize.translate('LabelSyncTo') + '"/>'; html += '<input is="emby-input" type="text" id="selectSyncTarget" readonly label="' + Globalize.translate('LabelSyncTo') + '"/>';
html += '</div>'; html += '</div>';
} else { } else {
html += '<label for="selectSyncTarget" class="selectLabel">' + Globalize.translate('LabelSyncTo') + '</label>'; html += '<div class="selectContainer' + targetContainerClass + '">';
html += '<select id="selectSyncTarget" required="required" data-mini="true">'; html += '<select is="emby-select" id="selectSyncTarget" required="required" label="' + Globalize.translate('LabelSyncTo') + '">';
html += targets.map(function (t) { html += targets.map(function (t) {
@ -133,34 +133,26 @@
html += '<div class="fieldDescription">' + Globalize.translate('LabelSyncNoTargetsHelp') + '</div>'; html += '<div class="fieldDescription">' + Globalize.translate('LabelSyncNoTargetsHelp') + '</div>';
html += '<div class="fieldDescription"><a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></div>'; html += '<div class="fieldDescription"><a href="https://github.com/MediaBrowser/Wiki/wiki/Sync" target="_blank">' + Globalize.translate('ButtonLearnMore') + '</a></div>';
} }
}
html += '</div>'; html += '</div>';
}
html += '<div class="fldProfile" style="display:none;">'; html += '<div class="fldProfile selectContainer" style="display:none;">';
html += '<br/>'; html += '<select is="emby-select" id="selectProfile" label="' + Globalize.translate('LabelProfile') + '">';
html += '<label for="selectProfile" class="selectLabel">' + Globalize.translate('LabelProfile') + '</label>';
html += '<select id="selectProfile" data-mini="true">';
html += '</select>'; html += '</select>';
html += '<div class="fieldDescription profileDescription"></div>'; html += '<div class="fieldDescription profileDescription"></div>';
html += '</div>'; html += '</div>';
html += '<div class="fldQuality" style="display:none;">'; html += '<div class="fldQuality selectContainer" style="display:none;">';
html += '<br/>'; html += '<select is="emby-select" id="selectQuality" data-mini="true" required="required" label="' + Globalize.translate('LabelQuality') + '">';
html += '<label for="selectQuality" class="selectLabel">' + Globalize.translate('LabelQuality') + '</label>';
html += '<select id="selectQuality" data-mini="true" required="required">';
html += '</select>'; html += '</select>';
html += '<div class="fieldDescription qualityDescription"></div>'; html += '<div class="fieldDescription qualityDescription"></div>';
html += '</div>'; html += '</div>';
html += '<div class="fldBitrate" style="display:none;">'; html += '<div class="fldBitrate inputContainer" style="display:none;">';
html += '<br/>';
html += '<div class="inputContainer">';
html += '<input is="emby-input" type="number" step=".1" min=".1" id="txtBitrate" label="' + Globalize.translate('LabelBitrateMbps') + '"/>'; html += '<input is="emby-input" type="number" step=".1" min=".1" id="txtBitrate" label="' + Globalize.translate('LabelBitrateMbps') + '"/>';
html += '</div>'; html += '</div>';
html += '</div>';
if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) { if (dialogOptions.Options.indexOf('UnwatchedOnly') != -1) {
html += '<br/>';
html += '<div class="checkboxContainer checkboxContainer-withDescription">'; html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>'; html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkUnwatchedOnly"/>'; html += '<input is="emby-checkbox" type="checkbox" id="chkUnwatchedOnly"/>';
@ -170,13 +162,7 @@
html += '</div>'; html += '</div>';
} }
if (dialogOptions.Options.indexOf('SyncNewContent') != -1 ||
dialogOptions.Options.indexOf('ItemLimit') != -1) {
html += '<div is="emby-collapse" title="' + Globalize.translate('HeaderAdvanced') + '">';
html += '<div class="collapseContent">';
if (dialogOptions.Options.indexOf('SyncNewContent') != -1) { if (dialogOptions.Options.indexOf('SyncNewContent') != -1) {
html += '<br/>';
html += '<div class="checkboxContainer checkboxContainer-withDescription">'; html += '<div class="checkboxContainer checkboxContainer-withDescription">';
html += '<label>'; html += '<label>';
html += '<input is="emby-checkbox" type="checkbox" id="chkSyncNewContent"/>'; html += '<input is="emby-checkbox" type="checkbox" id="chkSyncNewContent"/>';
@ -192,10 +178,6 @@
html += '<div class="fieldDescription">' + Globalize.translate('LabelItemLimitHelp') + '</div>'; html += '<div class="fieldDescription">' + Globalize.translate('LabelItemLimitHelp') + '</div>';
html += '</div>'; html += '</div>';
} }
html += '</div>';
html += '</div>';
html += '<br/>';
}
//html += '</div>'; //html += '</div>';
//html += '</div>'; //html += '</div>';
@ -312,7 +294,8 @@
renderForm({ renderForm({
elem: dlg.querySelector('.formFields'), elem: dlg.querySelector('.formFields'),
dialogOptions: dialogOptions, dialogOptions: dialogOptions,
dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery) dialogOptionsFn: getTargetDialogOptionsFn(dialogOptionsQuery),
isLocalSync: options.isLocalSync
}); });
return promise.then(function () { return promise.then(function () {

View File

@ -2108,7 +2108,7 @@
"LabelSyncJobName": "Sync job name:", "LabelSyncJobName": "Sync job name:",
"LabelQuality": "Quality:", "LabelQuality": "Quality:",
"OptionAutomaticallySyncNewContent": "Automatically sync new content", "OptionAutomaticallySyncNewContent": "Automatically sync new content",
"OptionAutomaticallySyncNewContentHelp": "New content added to will be automatically synced to the device.", "OptionAutomaticallySyncNewContentHelp": "New content added to this folder will be automatically synced to the device.",
"OptionSyncUnwatchedVideosOnly": "Sync unwatched videos only", "OptionSyncUnwatchedVideosOnly": "Sync unwatched videos only",
"OptionSyncUnwatchedVideosOnlyHelp": "Only unwatched videos will be synced, and videos will be removed from the device as they are watched.", "OptionSyncUnwatchedVideosOnlyHelp": "Only unwatched videos will be synced, and videos will be removed from the device as they are watched.",
"LabelItemLimit": "Item limit:", "LabelItemLimit": "Item limit:",
@ -2320,5 +2320,7 @@
"ManageOfflineDownloads": "Manage offline downloads", "ManageOfflineDownloads": "Manage offline downloads",
"MessageDownloadScheduled": "Download scheduled", "MessageDownloadScheduled": "Download scheduled",
"RememberMe": "Remember me", "RememberMe": "Remember me",
"HeaderOfflineSync": "Offline Sync" "HeaderOfflineSync": "Offline Sync",
"LabelMaxAudioFileBitrate": "Max audio file bitrate:",
"LabelMaxAudioFileBitrateHelp": "Audio files with a higher bitrate will be converted by Emby Server. Select a higher value for better quality, or a lower value to conserve local storage space."
} }