From 5eb1b4730085ea6c62954a64ced169afb083a84f Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 27 Oct 2015 22:49:48 +0800 Subject: [PATCH] Add version to anime renaming pattern --- CHANGES.md | 1 + .../default/config_postProcessing.tmpl | 9 +++++++-- gui/slick/js/configPostProcessing.js | 12 ++++++------ sickbeard/naming.py | 16 ++++++++++------ sickbeard/tv.py | 1 + sickbeard/webserve.py | 6 +++--- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 08ec3fb1..849b2574 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -72,6 +72,7 @@ * Add genres and rating to all Trakt shows * Add AniDb Random and Hot to Add Show page * Add IMDb Popular to Add Show page +* Add version to anime renaming pattern [develop changelog] Enable Alpha Ratio again now that the secure login page over https is fixed diff --git a/gui/slick/interfaces/default/config_postProcessing.tmpl b/gui/slick/interfaces/default/config_postProcessing.tmpl index 9c340a65..d04f5e72 100644 --- a/gui/slick/interfaces/default/config_postProcessing.tmpl +++ b/gui/slick/interfaces/default/config_postProcessing.tmpl @@ -17,9 +17,9 @@ -#if $varExists('header') +#if $varExists('header')

$header

-#else +#else

$title

#end if @@ -1073,6 +1073,11 @@ %RT PROPER + + Version: + %V + 2 +
diff --git a/gui/slick/js/configPostProcessing.js b/gui/slick/js/configPostProcessing.js index 62f921a1..daf99485 100644 --- a/gui/slick/js/configPostProcessing.js +++ b/gui/slick/js/configPostProcessing.js @@ -11,7 +11,7 @@ $(document).ready(function () { function israr_supported() { var pattern = $('#naming_pattern').val(); - $.get(sbRoot + '/config/postProcessing/isRarSupported', + $.get(sbRoot + '/config/postProcessing/isRarSupported', function (data) { if (data == "supported") { } else { @@ -21,11 +21,11 @@ $(document).ready(function () { }); $('#unpack').qtip('toggle', true); $('#unpack').css('background-color', '#FFFFDD'); - + } }); } - + function fill_examples() { var pattern = $('#naming_pattern').val(); var multi = $('#naming_multi_ep :selected').val(); @@ -207,7 +207,7 @@ $(document).ready(function () { var multi = $('#naming_anime_multi_ep :selected').val(); var anime_type = $('input[name="naming_anime"]:checked').val(); - $.get(sbRoot + '/config/postProcessing/testNaming', {pattern: pattern, anime_type: anime_type}, + $.get(sbRoot + '/config/postProcessing/testNaming', {pattern: pattern, anime: 'True', anime_type: anime_type}, function (data) { if (data) { $('#naming_example_anime').text(data + '.ext'); @@ -217,7 +217,7 @@ $(document).ready(function () { } }); - $.get(sbRoot + '/config/postProcessing/testNaming', {pattern: pattern, multi: multi, anime_type: anime_type}, + $.get(sbRoot + '/config/postProcessing/testNaming', {pattern: pattern, multi: multi, anime: 'True', anime_type: anime_type}, function (data) { if (data) { $('#naming_example_multi_anime').text(data + '.ext'); @@ -227,7 +227,7 @@ $(document).ready(function () { } }); - $.get(sbRoot + '/config/postProcessing/isNamingValid', {pattern: pattern, multi: multi, anime_type: anime_type}, + $.get(sbRoot + '/config/postProcessing/isNamingValid', {pattern: pattern, multi: multi, anime: 'True', anime_type: anime_type}, function (data) { if (data == "invalid") { $('#naming_anime_pattern').qtip('option', { diff --git a/sickbeard/naming.py b/sickbeard/naming.py index 55d72b82..49d2ed8e 100644 --- a/sickbeard/naming.py +++ b/sickbeard/naming.py @@ -97,13 +97,14 @@ class TVEpisode(tv.TVEpisode): self._status = Quality.compositeStatus(common.DOWNLOADED, common.Quality.SDTV) self._release_name = 'Show.Name.S02E03.HDTV.XviD-RLSGROUP' self._is_proper = True + self._version = 2 def check_force_season_folders(pattern=None, multi=None, anime_type=None): """ Checks if the name can still be parsed if you strip off the folders to determine if we need to force season folders to be enabled or not. - + Returns true if season folders need to be forced on or false otherwise. """ if pattern == None: @@ -123,7 +124,7 @@ def check_force_season_folders(pattern=None, multi=None, anime_type=None): def check_valid_naming(pattern=None, multi=None, anime_type=None): """ Checks if the name is can be parsed back to its original form for both single and multi episodes. - + Returns true if the naming is valid, false if not. """ if pattern == None: @@ -145,7 +146,7 @@ def check_valid_naming(pattern=None, multi=None, anime_type=None): def check_valid_abd_naming(pattern=None): """ Checks if the name is can be parsed back to its original form for an air-by-date format. - + Returns true if the naming is valid, false if not. """ if pattern == None: @@ -213,13 +214,16 @@ def validate_name(pattern, multi=None, anime_type=None, file_only=False, abd=Fal return True -def generate_sample_ep(multi=None, abd=False, sports=False, anime_type=None): +def generate_sample_ep(multi=None, abd=False, sports=False, anime=False, anime_type=None): # make a fake episode object ep = TVEpisode(2, 3, 3, "Ep Name") ep._status = Quality.compositeStatus(DOWNLOADED, Quality.HDTV) ep._airdate = datetime.date(2011, 3, 9) + if anime: + ep.show.anime = 1 + if abd: ep._release_name = 'Show.Name.2011.03.09.HDTV.XviD-RLSGROUP' ep.show.air_by_date = 1 @@ -263,7 +267,7 @@ def generate_sample_ep(multi=None, abd=False, sports=False, anime_type=None): return ep -def test_name(pattern, multi=None, abd=False, sports=False, anime_type=None): - ep = generate_sample_ep(multi, abd, sports, anime_type) +def test_name(pattern, multi=None, abd=False, sports=False, anime=False, anime_type=None): + ep = generate_sample_ep(multi, abd, sports, anime, anime_type) return {'name': ep.formatted_filename(pattern, multi, anime_type), 'dir': ep.formatted_dir(pattern, multi)} \ No newline at end of file diff --git a/sickbeard/tv.py b/sickbeard/tv.py index f73d7fd1..b3096f9c 100644 --- a/sickbeard/tv.py +++ b/sickbeard/tv.py @@ -2217,6 +2217,7 @@ class TVEpisode(object): '%0M': '%02d' % self.airdate.month, '%0D': '%02d' % self.airdate.day, '%RT': "PROPER" if self.is_proper else "", + '%V': 'v%s' % self.version if self.show.is_anime and self.version > 1 else '', } def _format_string(self, pattern, replace_map): diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 4fee4524..61d71985 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -4122,7 +4122,7 @@ class ConfigPostProcessing(Config): self.redirect('/config/postProcessing/') - def testNaming(self, pattern=None, multi=None, abd=False, sports=False, anime_type=None): + def testNaming(self, pattern=None, multi=None, abd=False, sports=False, anime=False, anime_type=None): if multi is not None: multi = int(multi) @@ -4130,13 +4130,13 @@ class ConfigPostProcessing(Config): if anime_type is not None: anime_type = int(anime_type) - result = naming.test_name(pattern, multi, abd, sports, anime_type) + result = naming.test_name(pattern, multi, abd, sports, anime, anime_type) result = ek.ek(os.path.join, result['dir'], result['name']) return result - def isNamingValid(self, pattern=None, multi=None, abd=False, sports=False, anime_type=None): + def isNamingValid(self, pattern=None, multi=None, abd=False, sports=False, anime=False, anime_type=None): if pattern is None: return 'invalid'