diff --git a/dashboard-ui/autoorganizelog.html b/dashboard-ui/autoorganizelog.html index c7d133c1af..d7785d1119 100644 --- a/dashboard-ui/autoorganizelog.html +++ b/dashboard-ui/autoorganizelog.html @@ -12,6 +12,7 @@
diff --git a/dashboard-ui/autoorganizesmart.html b/dashboard-ui/autoorganizesmart.html new file mode 100644 index 0000000000..c78dfe4596 --- /dev/null +++ b/dashboard-ui/autoorganizesmart.html @@ -0,0 +1,29 @@ + + + + ${TitleAutoOrganize} + + + + + + + + + ${TabActivityLog} + ${TabTV} + ${TabSmartMatch} + + + + + ${TabSmartMatchInfo} + + + + + + + + + diff --git a/dashboard-ui/autoorganizetv.html b/dashboard-ui/autoorganizetv.html index 64d776cf27..c46d7014b3 100644 --- a/dashboard-ui/autoorganizetv.html +++ b/dashboard-ui/autoorganizetv.html @@ -11,6 +11,7 @@ ${TabActivityLog} ${TabTV} + ${TabSmartMatch} diff --git a/dashboard-ui/bower_components/emby-apiclient/apiclient.js b/dashboard-ui/bower_components/emby-apiclient/apiclient.js index 690e24621a..8484f89836 100644 --- a/dashboard-ui/bower_components/emby-apiclient/apiclient.js +++ b/dashboard-ui/bower_components/emby-apiclient/apiclient.js @@ -1129,6 +1129,29 @@ }); }; + self.getSmartMatchInfos = function (options) { + + options = options || {}; + + var url = self.getUrl("Library/FileOrganizationSmartMatch", options); + + return self.ajax({ + type: "GET", + url: url, + dataType: "json" + }); + }; + + self.deleteSmartMatchEntry = function (id, options) { + + var url = self.getUrl("Library/FileOrganizationSmartMatch/" + id + "/Delete", options || {}); + + return self.ajax({ + type: "POST", + url: url + }); + }; + self.getLiveTvSeriesTimer = function (id) { if (!id) { diff --git a/dashboard-ui/scripts/autoorganizelog.js b/dashboard-ui/scripts/autoorganizelog.js index e27ad96bb0..4282d6c162 100644 --- a/dashboard-ui/scripts/autoorganizelog.js +++ b/dashboard-ui/scripts/autoorganizelog.js @@ -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 () { diff --git a/dashboard-ui/scripts/autoorganizesmart.js b/dashboard-ui/scripts/autoorganizesmart.js new file mode 100644 index 0000000000..37a59a7663 --- /dev/null +++ b/dashboard-ui/scripts/autoorganizesmart.js @@ -0,0 +1,126 @@ +(function ($, document, window) { + + var query = { + + StartIndex: 0, + Limit: 100000 + }; + + var currentResult; + + function reloadList(page) { + + Dashboard.showLoadingMsg(); + + ApiClient.getSmartMatchInfos(query).done(function (infos) { + + currentResult = infos; + + populateList(page, infos); + + Dashboard.hideLoadingMsg(); + }); + } + + 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 += ""; + } + + html += "" + currentType + ""; + + html += ''; + } + + html += "" + info.Name + ""; + + for (var n = 0; n < info.MatchStrings.length; n++) { + html += ""; + + html += ""; + + html += "" + info.MatchStrings[n] + ""; + + html += "" + Globalize.translate('ButtonDelete') + ""; + + html += ""; + + html += ""; + } + } + + html += ""; + + $('.divMatchInfos', page).html(html).trigger('create'); + } + + + $(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).done(function () { + + reloadList(page); + + }); + + }); + + }).on('pageshowready', "#libraryFileOrganizerSmartMatchPage", function () { + + var page = this; + + Dashboard.showLoadingMsg(); + + reloadList(page); + + }).on('pagebeforehide', "#libraryFileOrganizerSmartMatchPage", function () { + + var page = this; + currentResult = null; + }); + +})(jQuery, document, window); \ No newline at end of file diff --git a/dashboard-ui/strings/html/en-US.json b/dashboard-ui/strings/html/en-US.json index 96264c34e5..48bc4a4aaf 100644 --- a/dashboard-ui/strings/html/en-US.json +++ b/dashboard-ui/strings/html/en-US.json @@ -574,6 +574,8 @@ "LabelMinResumeDurationHelp": "Titles shorter than this will not be resumable", "TitleAutoOrganize": "Auto-Organize", "TabActivityLog": "Activity Log", + "TabSmartMatch": "Smart Match", + "TabSmartMatchInfo": "This page lists the match-strings for all library items which were added from within the Auto-Organize correction dialog", "HeaderName": "Name", "HeaderDate": "Date", "HeaderSource": "Source", @@ -589,6 +591,7 @@ "LabelEpisodeNumber": "Episode number", "LabelEndingEpisodeNumber": "Ending episode number:", "LabelEndingEpisodeNumberHelp": "Only required for multi-episode files", + "LabelOrganizeSmartMatchOption": "In the future, organize all files into the selected series if the name contains", "HeaderSupportTheTeam": "Support the Emby Team", "LabelSupportAmount": "Amount (USD)", "HeaderSupportTheTeamHelp": "Help ensure the continued development of this project by purchasing Emby Premiere. A portion of all income will be contributed to other free tools we depend on.", diff --git a/dashboard-ui/strings/html/server.json b/dashboard-ui/strings/html/server.json index 47281f7c8e..99f0b00fc5 100644 --- a/dashboard-ui/strings/html/server.json +++ b/dashboard-ui/strings/html/server.json @@ -576,6 +576,8 @@ "LabelMinResumeDurationHelp": "Titles shorter than this will not be resumable", "TitleAutoOrganize": "Auto-Organize", "TabActivityLog": "Activity Log", + "TabSmartMatch": "Smart Match", + "TabSmartMatchInfo": "This page lists the match-strings for all library items which were added from within the Auto-Organize correction dialog", "HeaderName": "Name", "HeaderDate": "Date", "HeaderSource": "Source", @@ -592,6 +594,7 @@ "LabelEpisodeNumber": "Episode number:", "LabelEndingEpisodeNumber": "Ending episode number:", "LabelEndingEpisodeNumberHelp": "Only required for multi-episode files", + "LabelOrganizeSmartMatchOption": "In the future, organize all files into the selected series if the name contains", "HeaderSupportTheTeam": "Support the Emby Team", "LabelSupportAmount": "Amount (USD)", "HeaderSupportTheTeamHelp": "Help ensure the continued development of this project by purchasing Emby Premiere. A portion of all income will be contributed to other free tools we depend on.",
${TabSmartMatchInfo}
" + info.MatchStrings[n] + "