mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
#680 - episode organization
This commit is contained in:
parent
807141cbce
commit
9db90f464a
8 changed files with 283 additions and 46 deletions
|
@ -30,14 +30,14 @@
|
|||
|
||||
})[0];
|
||||
|
||||
var message = 'The following file will be deleted:<p>' + item.OriginalPath + '</p><p>Are you sure you wish to proceed?</p>';
|
||||
var message = 'The following file will be deleted:<p style="word-wrap:break-word;">' + item.OriginalPath + '</p><p>Are you sure you wish to proceed?</p>';
|
||||
|
||||
Dashboard.confirm(message, "Delete File", function (confirmResult) {
|
||||
|
||||
if (confirmResult) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
|
||||
ApiClient.deleteOriginalFileFromOrganizationResult(id).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
@ -50,6 +50,55 @@
|
|||
});
|
||||
}
|
||||
|
||||
function organizeEpsiodeWithCorrections(page, item) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getItems({
|
||||
recursive: true,
|
||||
includeItemTypes: 'Series',
|
||||
sortBy: 'SortName'
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
showEpisodeCorrectionPopup(page, item, result.Items);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function showEpisodeCorrectionPopup(page, item, allSeries) {
|
||||
|
||||
var popup = $('.episodeCorrectionPopup', page).popup("open");
|
||||
|
||||
$('.inputFile', popup).html(item.OriginalFileName);
|
||||
|
||||
$('#txtSeason', popup).val(item.ExtractedSeasonNumber);
|
||||
$('#txtEpisode', popup).val(item.ExtractedEpisodeNumber);
|
||||
$('#txtEndingEpisode', popup).val(item.ExtractedEndingEpisodeNumber);
|
||||
|
||||
$('#hfResultId', popup).val(item.Id);
|
||||
|
||||
if (item.ExtractedName) {
|
||||
$('#fldRememberCorrection', popup).hide();
|
||||
} else {
|
||||
$('#fldRememberCorrection', popup).hide();
|
||||
}
|
||||
|
||||
$('#chkRememberEpisodeCorrection', popup).checked(false).checkboxradio('refresh');
|
||||
|
||||
var seriesHtml = allSeries.map(function (s) {
|
||||
|
||||
return '<option value="' + s.Id + '">' + s.Name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
seriesHtml = '<option value=""></option>' + seriesHtml;
|
||||
|
||||
$('#selectSeries', popup).html(seriesHtml).selectmenu('refresh');
|
||||
}
|
||||
|
||||
function organizeFile(page, id) {
|
||||
|
||||
var item = currentResult.Items.filter(function (i) {
|
||||
|
@ -57,7 +106,16 @@
|
|||
|
||||
})[0];
|
||||
|
||||
var message = 'The following file will be moved from:<p>' + item.OriginalPath + '</p><p>to:</p><p>' + item.TargetPath + '</p><p>Are you sure you wish to proceed?</p>';
|
||||
if (!item.TargetPath) {
|
||||
|
||||
if (item.Type == "Episode") {
|
||||
organizeEpsiodeWithCorrections(page, item);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var message = 'The following file will be moved from:<p style="word-wrap:break-word;">' + item.OriginalPath + '</p><p>to:</p><p style="word-wrap:break-word;">' + item.TargetPath + '</p><p>Are you sure you wish to proceed?</p>';
|
||||
|
||||
Dashboard.confirm(message, "Organize File", function (confirmResult) {
|
||||
|
||||
|
@ -76,7 +134,34 @@
|
|||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function submitEpisodeForm(form) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var page = $(form).parents('.page');
|
||||
|
||||
var resultId = $('#hfResultId', form).val();
|
||||
|
||||
var options = {
|
||||
|
||||
SeriesId: $('#selectSeries', form).val(),
|
||||
SeasonNumber: $('#txtSeason', form).val(),
|
||||
EpisodeNumber: $('#txtEpisode', form).val(),
|
||||
EndingEpisodeNumber: $('#txtEndingEpisode', form).val(),
|
||||
RememberCorrection: $('#chkRememberEpisodeCorrection', form).checked()
|
||||
};
|
||||
|
||||
ApiClient.performEpisodeOrganization(resultId, options).done(function () {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
$('.episodeCorrectionPopup', page).popup("close");
|
||||
|
||||
reloadItems(page);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
@ -133,6 +218,16 @@
|
|||
|
||||
html += '<tr>';
|
||||
|
||||
html += '<td class="organizerButtonCell">';
|
||||
|
||||
|
||||
if (item.Status != 'Success') {
|
||||
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="delete" data-mini="true" data-iconpos="notext" class="btnDeleteResult organizerButton" title="Delete File">Delete File</button>';
|
||||
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="action" data-mini="true" data-iconpos="notext" class="btnProcessResult organizerButton" title="Organize File">Process</button>';
|
||||
}
|
||||
|
||||
html += '</td>';
|
||||
|
||||
html += '<td>';
|
||||
|
||||
var date = parseISO8601Date(item.Date, { toLocal: true });
|
||||
|
@ -141,32 +236,28 @@
|
|||
html += '</td>';
|
||||
|
||||
html += '<td>';
|
||||
html += item.OriginalFileName || '';
|
||||
var status = item.Status;
|
||||
|
||||
if (status == 'SkippedExisting') {
|
||||
html += '<div style="color:blue;">';
|
||||
html += item.OriginalFileName;
|
||||
html += '</div>';
|
||||
}
|
||||
else if (status == 'Failure') {
|
||||
html += '<a data-resultid="' + item.Id + '" style="color:red;" href="#" class="btnShowStatusMessage">';
|
||||
html += item.OriginalFileName;
|
||||
html += '</a>';
|
||||
} else {
|
||||
html += '<div style="color:green;">';
|
||||
html += item.OriginalFileName;
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</td>';
|
||||
|
||||
html += '<td>';
|
||||
html += item.TargetPath || '';
|
||||
html += '</td>';
|
||||
|
||||
html += '<td>';
|
||||
html += getStatusText(item, true);
|
||||
html += '</td>';
|
||||
|
||||
html += '<td class="organizerButtonCell">';
|
||||
|
||||
|
||||
if (item.Status == 'SkippedExisting') {
|
||||
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="action" data-mini="true" data-iconpos="notext" class="btnProcessResult organizerButton" title="Organize File">Process</button>';
|
||||
} else {
|
||||
html += '<button style="visibility:hidden;" type="button" data-inline="true" data-icon="info" data-mini="true" data-iconpos="notext" class="organizerButton"></button>';
|
||||
}
|
||||
|
||||
if (item.Status != 'Success') {
|
||||
html += '<button data-resultid="' + item.Id + '" type="button" data-inline="true" data-icon="delete" data-mini="true" data-iconpos="notext" class="btnDeleteResult organizerButton" title="Delete">Delete File</button>';
|
||||
}
|
||||
|
||||
html += '</td>';
|
||||
|
||||
html += '</tr>';
|
||||
|
||||
return html;
|
||||
|
@ -218,9 +309,29 @@
|
|||
query.StartIndex -= query.Limit;
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
$('.btnClearLog', page).show();
|
||||
$('.legend', page).show();
|
||||
} else {
|
||||
$('.btnClearLog', page).hide();
|
||||
$('.legend', page).hide();
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('pageshow', "#libraryFileOrganizerLogPage", function () {
|
||||
$(document).on('pageinit', "#libraryFileOrganizerLogPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.btnClearLog', page).on('click', function () {
|
||||
|
||||
ApiClient.clearOrganizationLog().done(function () {
|
||||
reloadItems(page);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}).on('pageshow', "#libraryFileOrganizerLogPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
@ -231,4 +342,13 @@
|
|||
currentResult = null;
|
||||
});
|
||||
|
||||
window.OrganizerLogPage = {
|
||||
|
||||
onEpisodeCorrectionFormSubmit: function () {
|
||||
|
||||
submitEpisodeForm(this);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery, document, window);
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
var timeout;
|
||||
var idleState = true;
|
||||
|
||||
var msieWebmMessage = "For more reliable video playback with Internet Explorer desktop edition, please install google's webm plugin for IE.<br/><br/><a target='_blank' href='https://tools.google.com/dlpage/webmmf'>https://tools.google.com/dlpage/webmmf</a>";
|
||||
|
||||
self.playlist = [];
|
||||
var currentPlaylistIndex = 0;
|
||||
|
||||
|
@ -180,6 +182,11 @@
|
|||
currentProgressInterval = null;
|
||||
}
|
||||
}
|
||||
|
||||
function canPlayWebm() {
|
||||
|
||||
return testableVideoElement.canPlayType('video/webm').replace(/no/, '');
|
||||
}
|
||||
|
||||
function getTranscodingExtension() {
|
||||
|
||||
|
@ -192,7 +199,7 @@
|
|||
}
|
||||
|
||||
// Chrome or IE with plugin installed
|
||||
if (media.canPlayType('video/webm').replace(/no/, '') && !$.browser.mozilla) {
|
||||
if (canPlayWebm() && !$.browser.mozilla) {
|
||||
return '.webm';
|
||||
}
|
||||
|
||||
|
@ -896,6 +903,10 @@
|
|||
if (item.Type == "Channel") {
|
||||
errorMsg += " Please ensure there is an open tuner availalble.";
|
||||
}
|
||||
|
||||
if ($.browser.msie && !canPlayWebm()) {
|
||||
errorMsg += " " + msieWebmMessage;
|
||||
}
|
||||
|
||||
Dashboard.alert({
|
||||
title: 'Video Error',
|
||||
|
@ -1079,9 +1090,9 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
else if ($.browser.msie && videoType) {
|
||||
else if ($.browser.msie && videoType && !canPlayWebm()) {
|
||||
|
||||
self.playWithWarning(items, startPosition, user, "iewebmplugin", "Internet Explorer Playback", "For optimal video playback of Internet Explorer desktop edition, please install google's webm plugin for IE.<br/><br/><a target='_blank' href='https://tools.google.com/dlpage/webmmf'>https://tools.google.com/dlpage/webmmf</a>");
|
||||
self.playWithWarning(items, startPosition, user, "iewebmplugin", "Internet Explorer Playback", msieWebmMessage);
|
||||
return;
|
||||
|
||||
}
|
||||
|
@ -1093,7 +1104,9 @@
|
|||
|
||||
self.playWithWarning = function (items, startPosition, user, localStorageKeyName, header, text) {
|
||||
|
||||
localStorageKeyName += new Date().getMonth();
|
||||
// Increment this version when changes are made and we want users to see the prompts again
|
||||
var warningVersion = "2";
|
||||
localStorageKeyName += new Date().getMonth() + warningVersion;
|
||||
|
||||
if (localStorage.getItem(localStorageKeyName) == "1") {
|
||||
|
||||
|
|
|
@ -393,9 +393,9 @@ var Dashboard = {
|
|||
|
||||
confirmInternal: function (message, title, showCancel, callback) {
|
||||
|
||||
$('#confirmFlyout').popup("close").remove();
|
||||
$('.confirmFlyout').popup("close").remove();
|
||||
|
||||
var html = '<div data-role="popup" data-transition="slidefade" id="confirmFlyout" style="max-width:500px;" data-theme="a">';
|
||||
var html = '<div data-role="popup" data-transition="slidefade" class="confirmFlyout" style="max-width:500px;" data-theme="a">';
|
||||
|
||||
html += '<div class="ui-bar-a" style="text-align:center;">';
|
||||
html += '<h3>' + title + '</h3>';
|
||||
|
@ -407,10 +407,10 @@ var Dashboard = {
|
|||
html += message;
|
||||
html += '</div>';
|
||||
|
||||
html += '<p><button type="button" data-icon="check" onclick="$(\'#confirmFlyout\')[0].confirm=true;$(\'#confirmFlyout\').popup(\'close\');" data-theme="b">Ok</button></p>';
|
||||
html += '<p><button type="button" data-icon="check" onclick="$(\'.confirmFlyout\')[0].confirm=true;$(\'.confirmFlyout\').popup(\'close\');" data-theme="b">Ok</button></p>';
|
||||
|
||||
if (showCancel) {
|
||||
html += '<p><button type="button" data-icon="delete" onclick="$(\'#confirmFlyout\').popup(\'close\');" data-theme="a">Cancel</button></p>';
|
||||
html += '<p><button type="button" data-icon="delete" onclick="$(\'.confirmFlyout\').popup(\'close\');" data-theme="a">Cancel</button></p>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
|
@ -419,7 +419,7 @@ var Dashboard = {
|
|||
|
||||
$(document.body).append(html);
|
||||
|
||||
$('#confirmFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
|
||||
$('.confirmFlyout').popup({ history: false }).trigger('create').popup("open").on("popupafterclose", function () {
|
||||
|
||||
if (callback) {
|
||||
callback(this.confirm == true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue