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

make metadata path configurable

This commit is contained in:
Luke Pulverenti 2014-03-25 17:13:55 -04:00
parent 3caaa0fbc2
commit a41f301fe2
16 changed files with 366 additions and 329 deletions

View file

@ -28,20 +28,6 @@
$('#chkRunAtStartup', page).checked(config.RunAtStartup).checkboxradio("refresh");
$('#txtCachePath', page).val(config.CachePath || '');
var customCachePath = config.CachePath ? true : false;
$('#chkEnableCustomCachePath', page).checked(customCachePath).checkboxradio("refresh");
if (customCachePath) {
$('#fldEnterCachePath', page).show();
$('#txtCachePath', page).attr("required", "required");
} else {
$('#fldEnterCachePath', page).hide();
$('#txtCachePath', page).removeAttr("required");
}
Dashboard.hideLoadingMsg();
}
@ -61,45 +47,6 @@
});
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: "Select Server Cache Path",
instruction: "Browse or enter the path to use for Media Browser Server cache. The folder must be writeable. The location of this folder will directly impact server performance and should ideally be placed on a solid state drive."
});
});
$('#chkEnableCustomCachePath', page).on("change.showCachePathText", function () {
if (this.checked) {
$('#fldEnterCachePath', page).show();
$('#txtCachePath', page).attr("required", "required");
} else {
$('#fldEnterCachePath', page).hide();
$('#txtCachePath', page).removeAttr("required");
}
});
}).on('pagehide', "#advancedConfigurationPage", function () {
var page = this;
$('#chkEnableCustomCachePath', page).off("change.showCachePathText");
$('#btnSelectCachePath', page).off("click.selectDirectory");
}).on('pageinit', "#advancedConfigurationPage", function () {
var page = this;
@ -127,12 +74,6 @@
ApiClient.getServerConfiguration().done(function (config) {
if ($('#chkEnableCustomCachePath', form).checked()) {
config.CachePath = $('#txtCachePath', form).val();
} else {
config.CachePath = '';
}
config.EnableDebugLevelLogging = $('#chkDebugLog', form).checked();
config.RunAtStartup = $('#chkRunAtStartup', form).checked();

View file

@ -0,0 +1,134 @@
(function ($, document, window) {
function loadPage(page, config) {
$('#txtCachePath', page).val(config.CachePath || '');
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
$('#txtMetadataPath', page).val(config.MetadataPath || '');
Dashboard.hideLoadingMsg();
}
$(document).on('pageshow', "#advancedPathsPage", function () {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
}).on('pageinit', "#advancedPathsPage", function () {
var page = this;
$('#btnSelectCachePath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtCachePath', page).val(path);
}
picker.close();
},
header: "Select Server Cache Path",
instruction: "Browse or enter the path to use for Media Browser Server cache. The folder must be writeable. The location of this folder will directly impact server performance and should ideally be placed on a solid state drive."
});
});
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtTranscodingTempPath', page).val(path);
}
picker.close();
},
header: "Select Transcoding Temporary Path",
instruction: "Browse or enter the path to use for transcoding temporary files. The folder must be writeable."
});
});
$('#btnSelectIBNPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtItemsByNamePath', page).val(path);
}
picker.close();
},
header: "Select Images By Name Path",
instruction: "Browse or enter the path to your items by name folder. The folder must be writeable."
});
});
$('#btnSelectMetadataPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtMetadataPath', page).val(path);
}
picker.close();
},
header: "Select Metadata Path",
instruction: "Browse or enter the path you'd like to store metadata within. The folder must be writeable."
});
});
});
window.AdvancedPathsPage = {
onSubmit: function () {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getServerConfiguration().done(function (config) {
config.CachePath = $('#txtCachePath', form).val();
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
config.ItemsByNamePath = $('#txtItemsByNamePath', form).val();
config.MetadataPath = $('#txtMetadataPath', form).val();
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
});
// Disable default form submission
return false;
}
};
})(jQuery, document, window);

View file

@ -11,7 +11,11 @@
Dashboard.showLoadingMsg();
DashboardPage.pollForInfo(page);
DashboardPage.startInterval();
$(ApiClient).on("websocketmessage", DashboardPage.onWebSocketMessage).on("websocketopen", DashboardPage.onWebSocketConnectionChange).on("websocketerror", DashboardPage.onWebSocketConnectionChange).on("websocketclose", DashboardPage.onWebSocketConnectionChange);
$(ApiClient).on("websocketmessage", DashboardPage.onWebSocketMessage)
.on("websocketopen", DashboardPage.onWebSocketConnectionChange)
.on("websocketerror", DashboardPage.onWebSocketConnectionChange)
.on("websocketclose", DashboardPage.onWebSocketConnectionChange);
DashboardPage.lastAppUpdateCheck = null;
DashboardPage.lastPluginUpdateCheck = null;
@ -26,9 +30,47 @@
});
DashboardPage.reloadSystemInfo(page);
DashboardPage.reloadNews(page);
},
reloadSystemInfo: function (page) {
ApiClient.getSystemInfo().done(function (systemInfo) {
Dashboard.updateSystemInfo(systemInfo);
$('#appVersionNumber', page).html(systemInfo.Version);
var port = systemInfo.HttpServerPortNumber;
if (port == systemInfo.WebSocketPortNumber) {
$('#ports', page).html('Running on port <b>' + port + '</b>');
} else {
$('#ports', page).html('Running on ports <b>' + port + '</b> and <b>' + systemInfo.WebSocketPortNumber + '</b>');
}
if (systemInfo.CanSelfRestart) {
$('.btnRestartContainer', page).removeClass('hide');
} else {
$('.btnRestartContainer', page).addClass('hide');
}
DashboardPage.renderUrls(page, systemInfo);
DashboardPage.renderPendingInstallations(page, systemInfo);
if (systemInfo.CanSelfUpdate) {
$('#btnUpdateApplicationContainer', page).show();
$('#btnManualUpdateContainer', page).hide();
} else {
$('#btnUpdateApplicationContainer', page).hide();
$('#btnManualUpdateContainer', page).show();
}
DashboardPage.renderHasPendingRestart(page, systemInfo.HasPendingRestart);
});
},
reloadNews: function (page) {
var query = {
@ -85,14 +127,16 @@
startInterval: function () {
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("DashboardInfoStart", "0,1500");
ApiClient.sendWebSocketMessage("SessionsStart", "0,1500");
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStart", "0,1500");
}
},
stopInterval: function () {
if (ApiClient.isWebSocketOpen()) {
ApiClient.sendWebSocketMessage("DashboardInfoStop");
ApiClient.sendWebSocketMessage("SessionsStop");
ApiClient.sendWebSocketMessage("ScheduledTasksInfoStop");
}
},
@ -100,9 +144,24 @@
var page = $.mobile.activePage;
if (msg.MessageType == "DashboardInfo") {
if (msg.MessageType == "Sessions") {
DashboardPage.renderInfo(page, msg.Data);
}
else if (msg.MessageType == "RestartRequired") {
DashboardPage.renderHasPendingRestart(page, true);
}
else if (msg.MessageType == "ServerShuttingDown") {
DashboardPage.renderHasPendingRestart(page, false);
}
else if (msg.MessageType == "ServerRestarting") {
DashboardPage.renderHasPendingRestart(page, false);
}
else if (msg.MessageType == "ScheduledTasksInfo") {
var tasks = msg.Data;
DashboardPage.renderRunningTasks(page, tasks);
}
},
onWebSocketConnectionChange: function () {
@ -113,25 +172,21 @@
pollForInfo: function (page) {
$.getJSON("dashboardInfo").done(function (result) {
DashboardPage.renderInfo(page, result);
ApiClient.getSessions().done(function (sessions) {
DashboardPage.renderInfo(page, sessions);
});
},
renderInfo: function (page, dashboardInfo) {
renderInfo: function (page, sessions) {
DashboardPage.lastDashboardInfo = dashboardInfo;
DashboardPage.renderRunningTasks(dashboardInfo);
DashboardPage.renderSystemInfo(page, dashboardInfo);
DashboardPage.renderActiveConnections(page, dashboardInfo);
DashboardPage.renderActiveConnections(page, sessions);
DashboardPage.renderPluginUpdateInfo(page);
Dashboard.hideLoadingMsg();
},
renderActiveConnections: function (page, dashboardInfo) {
renderActiveConnections: function (page, sessions) {
var html = '';
@ -141,9 +196,9 @@
var deviceId = ApiClient.deviceId();
for (var i = 0, length = dashboardInfo.ActiveConnections.length; i < length; i++) {
for (var i = 0, length = sessions.length; i < length; i++) {
var connection = dashboardInfo.ActiveConnections[i];
var connection = sessions[i];
var rowId = 'trSession' + connection.Id;
@ -351,27 +406,42 @@
return html;
},
renderRunningTasks: function (dashboardInfo) {
systemUpdateTaskName: "Check for application updates",
var page = $.mobile.activePage;
renderRunningTasks: function (page, tasks) {
var html = '';
if (!dashboardInfo.RunningTasks.length) {
tasks = tasks.filter(function (t) {
return t.State != 'Idle';
});
if (tasks.filter(function (t) {
return t.Name == DashboardPage.systemUpdateTaskName;
}).length) {
$('#btnUpdateApplication', page).buttonEnabled(false);
} else {
$('#btnUpdateApplication', page).buttonEnabled(true);
}
if (!tasks.length) {
html += '<p>No tasks are currently running.</p>';
$('#runningTasksCollapsible', page).hide();
} else {
$('#runningTasksCollapsible', page).show();
}
for (var i = 0, length = dashboardInfo.RunningTasks.length; i < length; i++) {
for (var i = 0, length = tasks.length; i < length; i++) {
var task = dashboardInfo.RunningTasks[i];
var task = tasks[i];
html += '<p>';
html += task.Name+"<br/>";
html += task.Name + "<br/>";
if (task.State == "Running") {
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
@ -395,43 +465,6 @@
$('#divRunningTasks', page).html(html).trigger('create');
},
renderSystemInfo: function (page, dashboardInfo) {
Dashboard.updateSystemInfo(dashboardInfo.SystemInfo);
$('#appVersionNumber', page).html(dashboardInfo.SystemInfo.Version);
var port = dashboardInfo.SystemInfo.HttpServerPortNumber;
if (port == dashboardInfo.SystemInfo.WebSocketPortNumber) {
$('#ports', page).html('Running on port <b>' + port + '</b>');
} else {
$('#ports', page).html('Running on ports <b>' + port + '</b> and <b>' + dashboardInfo.SystemInfo.WebSocketPortNumber + '</b>');
}
if (dashboardInfo.RunningTasks.filter(function (task) {
return task.Id == dashboardInfo.ApplicationUpdateTaskId;
}).length) {
$('#btnUpdateApplication', page).buttonEnabled(false);
} else {
$('#btnUpdateApplication', page).buttonEnabled(true);
}
if (dashboardInfo.SystemInfo.CanSelfRestart) {
$('.btnRestartContainer', page).removeClass('hide');
} else {
$('.btnRestartContainer', page).addClass('hide');
}
DashboardPage.renderUrls(page, dashboardInfo.SystemInfo);
DashboardPage.renderApplicationUpdateInfo(page, dashboardInfo);
DashboardPage.renderPluginUpdateInfo(page, dashboardInfo);
DashboardPage.renderPendingInstallations(page, dashboardInfo.SystemInfo);
},
renderUrls: function (page, systemInfo) {
var url = ApiClient.serverAddress() + "/mediabrowser";
@ -448,14 +481,14 @@
}
},
renderApplicationUpdateInfo: function (page, dashboardInfo) {
renderHasPendingRestart: function (page, hasPendingRestart) {
$('#updateFail', page).hide();
if (!dashboardInfo.SystemInfo.HasPendingRestart) {
if (!hasPendingRestart) {
// Only check once every 10 mins
if (DashboardPage.lastAppUpdateCheck && (new Date().getTime() - DashboardPage.lastAppUpdateCheck) < 600000) {
// Only check once every 30 mins
if (DashboardPage.lastAppUpdateCheck && (new Date().getTime() - DashboardPage.lastAppUpdateCheck) < 1800000) {
return;
}
@ -473,14 +506,6 @@
$('#pUpdateNow', page).show();
if (dashboardInfo.SystemInfo.CanSelfUpdate) {
$('#btnUpdateApplicationContainer', page).show();
$('#btnManualUpdateContainer', page).hide();
} else {
$('#btnUpdateApplicationContainer', page).hide();
$('#btnManualUpdateContainer', page).show();
}
$('#newVersionNumber', page).html("Version " + version.versionStr + " is now available for download.");
}
@ -492,11 +517,7 @@
} else {
if (dashboardInfo.SystemInfo.HasPendingRestart) {
$('#pUpToDate', page).hide();
} else {
$('#pUpToDate', page).show();
}
$('#pUpToDate', page).hide();
$('#pUpdateNow', page).hide();
}
@ -526,10 +547,10 @@
$('#pendingInstallations', page).html(html);
},
renderPluginUpdateInfo: function (page, dashboardInfo) {
renderPluginUpdateInfo: function (page) {
// Only check once every 10 mins
if (DashboardPage.lastPluginUpdateCheck && (new Date().getTime() - DashboardPage.lastPluginUpdateCheck) < 600000) {
// Only check once every 30 mins
if (DashboardPage.lastPluginUpdateCheck && (new Date().getTime() - DashboardPage.lastPluginUpdateCheck) < 1800000) {
return;
}
@ -592,11 +613,19 @@
Dashboard.showLoadingMsg();
ApiClient.startScheduledTask(DashboardPage.lastDashboardInfo.ApplicationUpdateTaskId).done(function () {
ApiClient.getScheduledTasks().done(function (tasks) {
DashboardPage.pollForInfo(page);
var task = tasks.filter(function (t) {
Dashboard.hideLoadingMsg();
return t.Name == DashboardPage.systemUpdateTaskName;
});
ApiClient.startScheduledTask(task.Id).done(function () {
DashboardPage.pollForInfo(page);
Dashboard.hideLoadingMsg();
});
});
},

View file

@ -278,18 +278,24 @@
removeItemsFromCollection(page);
});
}).on('pagebeforeshow', "#editCollectionTitlesPage", function () {
var page = this;
reload(page);
$("body").on("popupafteropen.collections", ".popupIdentify", function (e) {
$("#txtLookupName").focus().select();
});
}).on('pagehide', "#editCollectionTitlesPage", function () {
var page = this;
currentItem = null;
$("body").off("popupafteropen.collections");
});
window.EditCollectionItemsPage = {

View file

@ -63,19 +63,6 @@
$('#refreshLoading', page).hide();
if (item.Type != "TvChannel" &&
item.Type != "Genre" &&
item.Type != "Studio" &&
item.Type != "MusicGenre" &&
item.Type != "GameGenre" &&
item.Type != "Person" &&
item.Type != "MusicArtist" &&
item.Type != "CollectionFolder") {
$('#fldDelete', page).show();
} else {
$('#fldDelete', page).hide();
}
LibraryBrowser.renderName(item, $('.itemName', page), true);
updateTabs(page, item);
@ -95,7 +82,25 @@
$('#btnEditCollectionTitles', page).hide();
}
Dashboard.hideLoadingMsg();
Dashboard.getCurrentUser().done(function(user) {
if (user.Configuration.EnableContentDeletion &&
item.Type != "TvChannel" &&
item.Type != "Genre" &&
item.Type != "Studio" &&
item.Type != "MusicGenre" &&
item.Type != "GameGenre" &&
item.Type != "Person" &&
item.Type != "MusicArtist" &&
item.Type != "CollectionFolder") {
$('#fldDelete', page).show();
} else {
$('#fldDelete', page).hide();
}
Dashboard.hideLoadingMsg();
});
});
}

View file

@ -10,60 +10,12 @@
}).checkboxradio('refresh');
$('#txtTranscodingTempPath', page).val(config.TranscodingTempPath || '');
var transcodingTempPath = config.TranscodingTempPath ? true : false;
$('#chkEnableCustomTranscodingTempPath', page).checked(transcodingTempPath).checkboxradio("refresh");
if (transcodingTempPath) {
$('#fldEnterTranscodingTempPath', page).show();
$('#txtTranscodingTempPath', page).attr("required", "required");
} else {
$('#fldEnterTranscodingTempPath', page).hide();
$('#txtTranscodingTempPath', page).removeAttr("required");
}
$('#chkAllowUpscaling', page).checked(config.AllowVideoUpscaling).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
}
$(document).on('pageinit', "#encodingSettingsPage", function () {
var page = this;
$('#btnSelectTranscodingTempPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtTranscodingTempPath', page).val(path);
}
picker.close();
},
header: "Select Transcoding Temporary Path",
instruction: "Browse or enter the path to use for transcoding temporary files. The folder must be writeable."
});
});
$('#chkEnableCustomTranscodingTempPath', page).on("change.showTranscodingTempPathText", function () {
if (this.checked) {
$('#fldEnterTranscodingTempPath', page).show();
$('#txtTranscodingTempPath', page).attr("required", "required");
} else {
$('#fldEnterTranscodingTempPath', page).hide();
$('#txtTranscodingTempPath', page).removeAttr("required");
}
});
}).on('pageshow', "#encodingSettingsPage", function () {
$(document).on('pageshow', "#encodingSettingsPage", function () {
Dashboard.showLoadingMsg();
@ -86,12 +38,6 @@
ApiClient.getServerConfiguration().done(function (config) {
if ($('#chkEnableCustomTranscodingTempPath', form).checked()) {
config.TranscodingTempPath = $('#txtTranscodingTempPath', form).val();
} else {
config.TranscodingTempPath = '';
}
config.AllowVideoUpscaling = $('#chkAllowUpscaling', form).checked();
config.EnableDebugEncodingLogging = $('#chkEnableDebugEncodingLogging', form).checked();
config.MediaEncodingQuality = $('.radioEncodingQuality:checked', form).val();

View file

@ -2,19 +2,6 @@
function loadPage(page, config) {
$('#txtItemsByNamePath', page).val(config.ItemsByNamePath || '');
var customIbn = config.ItemsByNamePath ? true : false;
$('#chkEnableCustomIBNPath', page).checked(customIbn).checkboxradio("refresh");
if (customIbn) {
$('#fieldEnterIBNPath', page).show();
$('#txtItemsByNamePath', page).attr("required", "required");
} else {
$('#fieldEnterIBNPath', page).hide();
$('#txtItemsByNamePath', page).removeAttr("required");
}
$('#txtSeasonZeroName', page).val(config.SeasonZeroDisplayName);
$('#chkEnableRealtimeMonitor', page).checked(config.EnableRealtimeMonitor).checkboxradio("refresh");
@ -28,50 +15,12 @@
var page = this;
$('#btnSelectIBNPath', page).on("click.selectDirectory", function () {
var picker = new DirectoryBrowser(page);
picker.show({
callback: function (path) {
if (path) {
$('#txtItemsByNamePath', page).val(path);
}
picker.close();
},
header: "Select Images By Name Path",
instruction: "Browse or enter the path to your items by name folder. The folder must be writeable."
});
});
$('#chkEnableCustomIBNPath', page).on("change.showIBNText", function () {
if (this.checked) {
$('#fieldEnterIBNPath', page).show();
$('#txtItemsByNamePath', page).attr("required", "required");
} else {
$('#fieldEnterIBNPath', page).hide();
$('#txtItemsByNamePath', page).removeAttr("required");
}
});
ApiClient.getServerConfiguration().done(function (config) {
loadPage(page, config);
});
}).on('pagehide', "#librarySettingsPage", function () {
var page = this;
$('#chkEnableCustomIBNPath', page).off("change.showIBNText");
$('#btnSelectIBNPath', page).off("click.selectDirectory");
});
function librarySettingsPage() {
@ -85,12 +34,6 @@
ApiClient.getServerConfiguration().done(function (config) {
if ($('#chkEnableCustomIBNPath', form).checked()) {
config.ItemsByNamePath = $('#txtItemsByNamePath', form).val();
} else {
config.ItemsByNamePath = '';
}
config.SeasonZeroDisplayName = $('#txtSeasonZeroName', form).val();
config.EnableRealtimeMonitor = $('#chkEnableRealtimeMonitor', form).checked();

View file

@ -728,10 +728,6 @@ var Dashboard = {
name: "Metadata",
href: "metadata.html",
selected: pageElem.id == "metadataConfigurationPage" || pageElem.id == "advancedMetadataConfigurationPage" || pageElem.id == "metadataImagesConfigurationPage"
}, {
name: "Plugins",
href: "plugins.html",
selected: page.hasClass("pluginConfigurationPage")
}, {
name: "Auto-Organize",
href: "autoorganizelog.html",
@ -744,6 +740,10 @@ var Dashboard = {
name: "Live TV",
href: "livetvstatus.html",
selected: page.hasClass("liveTvSettingsPage")
}, {
name: "Plugins",
href: "plugins.html",
selected: page.hasClass("pluginConfigurationPage")
}, {
name: "Users",
divider: true,

View file

@ -26,6 +26,7 @@
$('#chkManageLiveTv', page).checked(user.Configuration.EnableLiveTvManagement || false).checkboxradio("refresh");
$('#chkEnableLiveTvAccess', page).checked(user.Configuration.EnableLiveTvAccess || false).checkboxradio("refresh");
$('#chkEnableContentDeletion', page).checked(user.Configuration.EnableContentDeletion || false).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
}
@ -59,6 +60,7 @@
user.Configuration.EnableLiveTvManagement = $('#chkManageLiveTv', page).checked();
user.Configuration.EnableMediaPlayback = $('#chkEnableMediaPlayback', page).checked();
user.Configuration.EnableLiveTvAccess = $('#chkEnableLiveTvAccess', page).checked();
user.Configuration.EnableContentDeletion = $('#chkEnableContentDeletion', page).checked();
var userId = getParameterByName("userId");