mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
added collection type
This commit is contained in:
parent
19a3edd772
commit
e796413aed
7 changed files with 100 additions and 22 deletions
10
ApiClient.js
10
ApiClient.js
|
@ -896,16 +896,22 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
||||||
* Adds a virtual folder to either the default view or a user view
|
* Adds a virtual folder to either the default view or a user view
|
||||||
* @param {String} name
|
* @param {String} name
|
||||||
*/
|
*/
|
||||||
self.addVirtualFolder = function (name, userId) {
|
self.addVirtualFolder = function (name, type, userId) {
|
||||||
|
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error("null name");
|
throw new Error("null name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var options = {};
|
||||||
|
|
||||||
|
if (type) {
|
||||||
|
options.collectionType = type;
|
||||||
|
}
|
||||||
|
|
||||||
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
var url = userId ? "Users/" + userId + "/VirtualFolders" : "Library/VirtualFolders";
|
||||||
|
|
||||||
url += "/" + name;
|
url += "/" + name;
|
||||||
url = self.getUrl(url);
|
url = self.getUrl(url, options);
|
||||||
|
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
|
|
|
@ -43,8 +43,19 @@
|
||||||
|
|
||||||
<div data-role="content" class="ui-corner-bottom ui-content">
|
<div data-role="content" class="ui-corner-bottom ui-content">
|
||||||
<form id="textEntryForm">
|
<form id="textEntryForm">
|
||||||
<label for="txtValue">New name:</label>
|
<p>
|
||||||
|
<label id="lblValue" for="txtValue">New name:</label>
|
||||||
<input type="text" name="txtValue" id="txtValue" required="required" />
|
<input type="text" name="txtValue" id="txtValue" required="required" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p id="fldCollectionType">
|
||||||
|
<label for="selectCollectionType">Collection type:</label>
|
||||||
|
<select id="selectCollectionType" name="selectCollectionType"></select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="fieldDescription">
|
||||||
|
Anything not listed, including custom media types supported by plugins (e.g. photos, games) should be classified as general or mixed content.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button type="submit" data-theme="b" data-icon="ok">
|
<button type="submit" data-theme="b" data-icon="ok">
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
|
|
||||||
if (result.MusicVideoCount) {
|
if (result.MusicVideoCount) {
|
||||||
|
|
||||||
html += '<input type="radio" name="ibnMusicVideos" id="radioMusicVideos" value="on" data-mini="true">';
|
html += '<input type="radio" name="ibnItems" id="radioMusicVideos" value="on" data-mini="true">';
|
||||||
html += '<label for="radioMusicVideos">Music Videos (' + result.MusicVideoCount + ')</label>';
|
html += '<label for="radioMusicVideos">Music Videos (' + result.MusicVideoCount + ')</label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,16 @@
|
||||||
|
|
||||||
html += '<h3>' + virtualFolder.Name + '</h3>';
|
html += '<h3>' + virtualFolder.Name + '</h3>';
|
||||||
|
|
||||||
|
var typeName = MediaLibraryPage.getCollectionTypeOptions().filter(function(t) {
|
||||||
|
|
||||||
|
return t.value == virtualFolder.CollectionType;
|
||||||
|
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
typeName = typeName ? typeName.name : "General or mixed content";
|
||||||
|
|
||||||
|
html += '<p style="padding-left:.5em;">Collection type: <b>' + typeName + '</b></p>';
|
||||||
|
|
||||||
html += '<ul class="mediaFolderLocations" data-inset="true" data-role="listview" data-split-icon="minus">';
|
html += '<ul class="mediaFolderLocations" data-inset="true" data-role="listview" data-split-icon="minus">';
|
||||||
|
|
||||||
html += '<li data-role="list-divider" class="mediaLocationsHeader">Media Locations';
|
html += '<li data-role="list-divider" class="mediaLocationsHeader">Media Locations';
|
||||||
|
@ -133,13 +143,13 @@
|
||||||
|
|
||||||
addVirtualFolder: function () {
|
addVirtualFolder: function () {
|
||||||
|
|
||||||
MediaLibraryPage.getTextValue("Add Media Collection", "Name (Movies, Music, TV, etc):", "", function (name) {
|
MediaLibraryPage.getTextValue("Add Media Collection", "Name (Movies, Music, TV, etc):", "", true, function (name, type) {
|
||||||
|
|
||||||
var userId = getParameterByName("userId");
|
var userId = getParameterByName("userId");
|
||||||
|
|
||||||
MediaLibraryPage.lastVirtualFolderName = name;
|
MediaLibraryPage.lastVirtualFolderName = name;
|
||||||
|
|
||||||
ApiClient.addVirtualFolder(name, userId).done(MediaLibraryPage.processOperationResult);
|
ApiClient.addVirtualFolder(name, type, userId).done(MediaLibraryPage.processOperationResult);
|
||||||
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -171,16 +181,24 @@
|
||||||
MediaLibraryPage.directoryPicker = picker;
|
MediaLibraryPage.directoryPicker = picker;
|
||||||
},
|
},
|
||||||
|
|
||||||
getTextValue: function (header, label, initialValue, callback) {
|
getTextValue: function (header, label, initialValue, showCollectionType, callback) {
|
||||||
|
|
||||||
var page = $.mobile.activePage;
|
var page = $.mobile.activePage;
|
||||||
|
|
||||||
var popup = $('#popupEnterText', page);
|
var popup = $('#popupEnterText', page);
|
||||||
|
|
||||||
$('h3', popup).html(header);
|
$('h3', popup).html(header);
|
||||||
$('label', popup).html(label);
|
$('#lblValue', popup).html(label);
|
||||||
$('#txtValue', popup).val(initialValue);
|
$('#txtValue', popup).val(initialValue);
|
||||||
|
|
||||||
|
if (showCollectionType) {
|
||||||
|
$('#fldCollectionType', popup).show();
|
||||||
|
} else {
|
||||||
|
$('#fldCollectionType', popup).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#selectCollectionType', popup).html(MediaLibraryPage.getCollectionTypeOptionsHtml()).selectmenu('refresh');
|
||||||
|
|
||||||
popup.on("popupafteropen", function () {
|
popup.on("popupafteropen", function () {
|
||||||
$('#textEntryForm input:first', this).focus();
|
$('#textEntryForm input:first', this).focus();
|
||||||
}).on("popupafterclose", function () {
|
}).on("popupafterclose", function () {
|
||||||
|
@ -191,13 +209,45 @@
|
||||||
$('#textEntryForm', popup).on('submit', function () {
|
$('#textEntryForm', popup).on('submit', function () {
|
||||||
|
|
||||||
if (callback) {
|
if (callback) {
|
||||||
|
|
||||||
|
if (showCollectionType) {
|
||||||
|
callback($('#txtValue', popup).val(), $('#selectCollectionType', popup).val());
|
||||||
|
} else {
|
||||||
callback($('#txtValue', popup).val());
|
callback($('#txtValue', popup).val());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getCollectionTypeOptionsHtml: function () {
|
||||||
|
|
||||||
|
return MediaLibraryPage.getCollectionTypeOptions().map(function (i) {
|
||||||
|
|
||||||
|
return '<option value="' + i.value + '">' + i.name + '</option>';
|
||||||
|
|
||||||
|
}).join("");
|
||||||
|
},
|
||||||
|
|
||||||
|
getCollectionTypeOptions: function () {
|
||||||
|
|
||||||
|
return [
|
||||||
|
|
||||||
|
{ name: "General or mixed content", value: "" },
|
||||||
|
{ name: "Box sets", value: "boxsets" },
|
||||||
|
{ name: "Home videos", value: "homevideos" },
|
||||||
|
{ name: "Movies", value: "movies" },
|
||||||
|
{ name: "Music", value: "music" },
|
||||||
|
{ name: "Music videos", value: "musicvideos" },
|
||||||
|
{ name: "Trailers", value: "trailers" },
|
||||||
|
{ name: "TV shows", value: "tvshows" }
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
renameVirtualFolder: function (button) {
|
renameVirtualFolder: function (button) {
|
||||||
|
|
||||||
var folderIndex = button.getAttribute('data-folderindex');
|
var folderIndex = button.getAttribute('data-folderindex');
|
||||||
|
@ -205,7 +255,7 @@
|
||||||
|
|
||||||
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
MediaLibraryPage.lastVirtualFolderName = virtualFolder.Name;
|
||||||
|
|
||||||
MediaLibraryPage.getTextValue(virtualFolder.Name, "Rename " + virtualFolder.Name, virtualFolder.Name, function (newName) {
|
MediaLibraryPage.getTextValue(virtualFolder.Name, "Rename " + virtualFolder.Name, virtualFolder.Name, false, function (newName) {
|
||||||
|
|
||||||
if (virtualFolder.Name != newName) {
|
if (virtualFolder.Name != newName) {
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@
|
||||||
renderSessionsInPlayMenu(sessions, options, elem);
|
renderSessionsInPlayMenu(sessions, options, elem);
|
||||||
|
|
||||||
if (ApiClient.isWebSocketOpen()) {
|
if (ApiClient.isWebSocketOpen()) {
|
||||||
ApiClient.sendWebSocketMessage("SessionsStart", "1500,1500");
|
ApiClient.sendWebSocketMessage("SessionsStart", "1000,1000");
|
||||||
|
|
||||||
$(ApiClient).on("websocketmessage.remotecontrol", function (e, msg) {
|
$(ApiClient).on("websocketmessage.remotecontrol", function (e, msg) {
|
||||||
|
|
||||||
|
@ -670,7 +670,7 @@
|
||||||
updateSessionInfo(popup, sessions);
|
updateSessionInfo(popup, sessions);
|
||||||
|
|
||||||
if (ApiClient.isWebSocketOpen()) {
|
if (ApiClient.isWebSocketOpen()) {
|
||||||
ApiClient.sendWebSocketMessage("SessionsStart", "1500,1500");
|
ApiClient.sendWebSocketMessage("SessionsStart", "1000,1000");
|
||||||
|
|
||||||
$(ApiClient).on("websocketmessage.remotecontrol", function (e, msg) {
|
$(ApiClient).on("websocketmessage.remotecontrol", function (e, msg) {
|
||||||
|
|
||||||
|
@ -745,11 +745,11 @@
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += '<p class="nowPlayingTitle" style="text-align:center;margin-top:2em;"></p>';
|
html += '<p class="nowPlayingTitle" style="text-align:center;margin:1.5em 0 0;"></p>';
|
||||||
|
|
||||||
html += '<p class="nowPlayingImage" style="text-align:center;"></p>';
|
html += '<p class="nowPlayingImage" style="text-align:center;margin-top:.5em;"></p>';
|
||||||
|
|
||||||
html += '<div style="text-align:center;margin: 1em 0 1em;">';
|
html += '<div style="text-align:center;margin: 1em 0;">';
|
||||||
|
|
||||||
html += '<div style="text-align:right;vertical-align:middle;padding-right:20px;font-weight: bold;">';
|
html += '<div style="text-align:right;vertical-align:middle;padding-right:20px;font-weight: bold;">';
|
||||||
html += '<span class="nowPlayingTime"></span>';
|
html += '<span class="nowPlayingTime"></span>';
|
||||||
|
@ -816,13 +816,13 @@
|
||||||
var img = $('img', imageContainer)[0];
|
var img = $('img', imageContainer)[0];
|
||||||
|
|
||||||
var imgUrl = ApiClient.getImageUrl(item.Id, {
|
var imgUrl = ApiClient.getImageUrl(item.Id, {
|
||||||
maxheight: 200,
|
maxheight: 300,
|
||||||
type: 'Primary',
|
type: 'Primary',
|
||||||
tag: item.PrimaryImageTag
|
tag: item.PrimaryImageTag
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!img || img.src.toLowerCase().indexOf(imgUrl.toLowerCase()) == -1) {
|
if (!img || img.src.toLowerCase().indexOf(imgUrl.toLowerCase()) == -1) {
|
||||||
imageContainer.html('<img style="max-height:100px;" src="' + imgUrl + '" />');
|
imageContainer.html('<img style="max-height:150px;" src="' + imgUrl + '" />');
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -33,8 +33,19 @@
|
||||||
|
|
||||||
<div data-role="content" class="ui-corner-bottom ui-content">
|
<div data-role="content" class="ui-corner-bottom ui-content">
|
||||||
<form id="textEntryForm">
|
<form id="textEntryForm">
|
||||||
<label for="txtValue">New name:</label>
|
<p>
|
||||||
|
<label id="lblValue" for="txtValue">New name:</label>
|
||||||
<input type="text" name="txtValue" id="txtValue" required="required" />
|
<input type="text" name="txtValue" id="txtValue" required="required" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p id="fldCollectionType">
|
||||||
|
<label for="selectCollectionType">Collection type:</label>
|
||||||
|
<select id="selectCollectionType" name="selectCollectionType"></select>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="fieldDescription">
|
||||||
|
Anything not listed, including custom media types supported by plugins (e.g. photos, games) should be classified as general or mixed content.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button type="submit" data-theme="b" data-icon="ok">
|
<button type="submit" data-theme="b" data-icon="ok">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.143" targetFramework="net45" />
|
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.144" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack.Common" version="3.9.54" targetFramework="net45" />
|
||||||
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
|
<package id="ServiceStack.Text" version="3.9.54" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue