Add version to anime renaming pattern

This commit is contained in:
Adam 2015-10-27 22:49:48 +08:00
parent 4c54e6e356
commit 5eb1b47300
6 changed files with 28 additions and 17 deletions

View file

@ -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

View file

@ -17,9 +17,9 @@
<script type="text/javascript" src="$sbRoot/js/configPostProcessing.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/config.js?v=$sbPID"></script>
#if $varExists('header')
#if $varExists('header')
<h1 class="header">$header</h1>
#else
#else
<h1 class="title">$title</h1>
#end if
@ -1073,6 +1073,11 @@
<td>%RT</td>
<td>PROPER</td>
</tr>
<tr class="even">
<td class="align-right"><b>Version:</b></td>
<td>%V</td>
<td>2</td>
</tr>
</tbody>
</table>
<br />

View file

@ -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', {

View file

@ -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)}

View file

@ -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):

View file

@ -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'