From 9747778e2842d6fa217e27767258d4647d154c62 Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 12 Mar 2015 17:57:04 +0000 Subject: [PATCH] Add validation when using Release Group token on page config Post Processing/Episode Naming/Name pattern/Custom. --- CHANGES.md | 1 + .../default/config_postProcessing.tmpl | 8 +++---- gui/slick/js/configPostProcessing.js | 24 +++++++++++++++++++ 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index f232ff8c..782c11fe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,6 +31,7 @@ * Change naming of SEARCHQUEUE threads for shorter log lines * Fix Recent Search running status on Manage Searches page * Change to no longer require restart with the "Scan and post process" option on page config/Post Processing +* Add validation when using Release Group token on page config Post Processing/Episode Naming/Name pattern/Custom [develop changelog] * Fix traceback error when using the menu item Manage/Update Kodi diff --git a/gui/slick/interfaces/default/config_postProcessing.tmpl b/gui/slick/interfaces/default/config_postProcessing.tmpl index 7b8eae7b..e4bf8ca4 100644 --- a/gui/slick/interfaces/default/config_postProcessing.tmpl +++ b/gui/slick/interfaces/default/config_postProcessing.tmpl @@ -442,7 +442,7 @@ Release Group: - %RG + -%RG RLSGROUP @@ -667,7 +667,7 @@ Release Group: - %RG + -%RG RLSGROUP @@ -865,7 +865,7 @@ Release Group: - %RG + -%RG RLSGROUP @@ -1063,7 +1063,7 @@ Release Group: - %RG + [%RG] RLSGROUP diff --git a/gui/slick/js/configPostProcessing.js b/gui/slick/js/configPostProcessing.js index b88546d8..62f921a1 100644 --- a/gui/slick/js/configPostProcessing.js +++ b/gui/slick/js/configPostProcessing.js @@ -525,4 +525,28 @@ $(document).ready(function () { } }); + $('.config_submitter').on('click', (function() { + var save_config = true; + $('#naming_pattern, #naming_abd_pattern, #naming_sports_pattern').each(function() { + if (/^((?=.*%RG)(?:(?!-%RG).)*)$/.test($(this).val()) + || /^((?=.*%rg)(?:(?!-%rg).)*)$/i.test($(this).val())) { + $(this).focus(); + alert('You must insert a minus symbol before the %RG/%rg token i.e. -%RG, or -%rg'); + save_config = false; + return save_config; + } + }); + if (save_config) { + $('#naming_anime_pattern').each(function() { + if (/^((?=.*%RG)(?:(?!\[%RG\]).)*)$/.test($(this).val()) + || /^((?=.*%rg)(?:(?!\[%rg\]).)*)$/i.test($(this).val())) { + $(this).focus(); + alert('You must insert a bracket around the %RG/%rg token i.e. [%RG], or [%rg]'); + save_config = false; + return save_config; + } + }); + } + return save_config; + })) }); \ No newline at end of file