mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #1432 from softworkz/SeriesDetectionV2
Supersedes #1192: Auto-Organize - Added feature to remember/persist series matching in manual organization dialog
This commit is contained in:
commit
b1caaf694f
8 changed files with 206 additions and 1 deletions
|
@ -76,6 +76,9 @@
|
|||
$('#txtEpisode', popup).val(item.ExtractedEpisodeNumber);
|
||||
$('#txtEndingEpisode', popup).val(item.ExtractedEndingEpisodeNumber);
|
||||
|
||||
$('#chkRememberCorrection', popup).val(false);
|
||||
$('.extractedName', popup).html(item.ExtractedName);
|
||||
|
||||
$('#hfResultId', popup).val(item.Id);
|
||||
|
||||
var seriesHtml = allSeries.map(function (s) {
|
||||
|
@ -146,7 +149,8 @@
|
|||
SeriesId: $('#selectSeries', form).val(),
|
||||
SeasonNumber: $('#txtSeason', form).val(),
|
||||
EpisodeNumber: $('#txtEpisode', form).val(),
|
||||
EndingEpisodeNumber: $('#txtEndingEpisode', form).val()
|
||||
EndingEpisodeNumber: $('#txtEndingEpisode', form).val(),
|
||||
RememberCorrection: $('#chkRememberCorrection', form).checked()
|
||||
};
|
||||
|
||||
ApiClient.performEpisodeOrganization(resultId, options).then(function () {
|
||||
|
|
136
dashboard-ui/scripts/autoorganizesmart.js
Normal file
136
dashboard-ui/scripts/autoorganizesmart.js
Normal file
|
@ -0,0 +1,136 @@
|
|||
(function ($, document, window) {
|
||||
|
||||
var query = {
|
||||
|
||||
StartIndex: 0,
|
||||
Limit: 100000
|
||||
};
|
||||
|
||||
var currentResult;
|
||||
|
||||
function reloadList(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getSmartMatchInfos(query).then(function (infos) {
|
||||
|
||||
currentResult = infos;
|
||||
|
||||
populateList(page, infos);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
}, onApiFailure);
|
||||
|
||||
}
|
||||
|
||||
function populateList(page, result) {
|
||||
|
||||
var infos = result.Items;
|
||||
|
||||
if (infos.length > 0) {
|
||||
infos = infos.sort(function (a, b) {
|
||||
|
||||
a = a.OrganizerType + " " + a.Name;
|
||||
b = b.OrganizerType + " " + b.Name;
|
||||
|
||||
if (a == b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (a < b) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
var html = "";
|
||||
var currentType;
|
||||
|
||||
for (var i = 0, length = infos.length; i < length; i++) {
|
||||
|
||||
var info = infos[i];
|
||||
|
||||
if (info.OrganizerType != currentType) {
|
||||
currentType = info.OrganizerType;
|
||||
|
||||
if (html.length > 0)
|
||||
{
|
||||
html += "</ul>";
|
||||
}
|
||||
|
||||
html += "<h2>" + currentType + "</h2>";
|
||||
|
||||
html += '<ul data-role="listview" data-inset="true" data-auto-enhanced="false" data-split-icon="action">';
|
||||
}
|
||||
|
||||
html += "<li data-role='list-divider'><h3 style='font-weight:bold'>" + info.Name + "</h3></li>";
|
||||
|
||||
for (var n = 0; n < info.MatchStrings.length; n++) {
|
||||
html += "<li title='" + info.MatchStrings[n] + "'>";
|
||||
|
||||
html += "<a style='padding-top: 0.5em; padding-bottom: 0.5em'>";
|
||||
|
||||
html += "<p>" + info.MatchStrings[n] + "</p>";
|
||||
|
||||
html += "<a id='btnDeleteMatchEntry" + info.Id + "' class='btnDeleteMatchEntry' href='#' data-id='" + info.Id + "' data-matchstring='" + info.MatchStrings[n] + "' data-icon='delete'>" + Globalize.translate('ButtonDelete') + "</a>";
|
||||
|
||||
html += "</a>";
|
||||
|
||||
html += "</li>";
|
||||
}
|
||||
}
|
||||
|
||||
html += "</ul>";
|
||||
|
||||
$('.divMatchInfos', page).html(html).trigger('create');
|
||||
}
|
||||
|
||||
function onApiFailure(e) {
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
|
||||
Dashboard.alert({
|
||||
title: Globalize.translate('AutoOrganizeError'),
|
||||
message: Globalize.translate('ErrorOrganizingFileWithErrorCode', e.getResponseHeader("X-Application-Error-Code"))
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#libraryFileOrganizerSmartMatchPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
$('.divMatchInfos', page).on('click', '.btnDeleteMatchEntry', function () {
|
||||
|
||||
var button = this;
|
||||
var id = button.getAttribute('data-id');
|
||||
|
||||
var options = {
|
||||
|
||||
MatchString: button.getAttribute('data-matchstring')
|
||||
};
|
||||
|
||||
ApiClient.deleteSmartMatchEntry(id, options).then(function () {
|
||||
|
||||
reloadList(page);
|
||||
|
||||
}, onApiFailure);
|
||||
|
||||
});
|
||||
|
||||
}).on('pageshow', "#libraryFileOrganizerSmartMatchPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
reloadList(page);
|
||||
|
||||
}).on('pagebeforehide', "#libraryFileOrganizerSmartMatchPage", function () {
|
||||
|
||||
var page = this;
|
||||
currentResult = null;
|
||||
});
|
||||
|
||||
})(jQuery, document, window);
|
Loading…
Add table
Add a link
Reference in a new issue