Add 'A' and 'An' to 'The' prefix
This was bothering me for a long time now ;) We do put The at the end but not A nor An. Fixed now :)
This commit is contained in:
1 parent
26f5e8aa4b
commit
0eac041a26
3 files changed
+11
-6
No files matched your search
@@ -99,7 +99,7 @@ from couchpotato.core.helpers.encoding import simplifyString"""
|
|||||||
|
|
||||||
|
|
||||||
class TitleIndex(TreeBasedIndex):
|
class TitleIndex(TreeBasedIndex):
|
||||||
_version = 2
|
_version = 3
|
||||||
|
|
||||||
custom_header = """from CodernityDB.tree_index import TreeBasedIndex
|
custom_header = """from CodernityDB.tree_index import TreeBasedIndex
|
||||||
from string import ascii_letters
|
from string import ascii_letters
|
||||||
@@ -123,7 +123,7 @@ from couchpotato.core.helpers.encoding import toUnicode, simplifyString"""
|
|||||||
nr_prefix = '' if title and len(title) > 0 and title[0] in ascii_letters else '#'
|
nr_prefix = '' if title and len(title) > 0 and title[0] in ascii_letters else '#'
|
||||||
title = simplifyString(title)
|
title = simplifyString(title)
|
||||||
|
|
||||||
for prefix in ['the ']:
|
for prefix in ['the ', 'an ', 'a ']:
|
||||||
if prefix == title[:len(prefix)]:
|
if prefix == title[:len(prefix)]:
|
||||||
title = title[len(prefix):]
|
title = title[len(prefix):]
|
||||||
break
|
break
|
||||||
@@ -132,7 +132,7 @@ from couchpotato.core.helpers.encoding import toUnicode, simplifyString"""
|
|||||||
|
|
||||||
|
|
||||||
class StartsWithIndex(TreeBasedIndex):
|
class StartsWithIndex(TreeBasedIndex):
|
||||||
_version = 2
|
_version = 3
|
||||||
|
|
||||||
custom_header = """from CodernityDB.tree_index import TreeBasedIndex
|
custom_header = """from CodernityDB.tree_index import TreeBasedIndex
|
||||||
from string import ascii_letters
|
from string import ascii_letters
|
||||||
@@ -153,7 +153,7 @@ from couchpotato.core.helpers.encoding import toUnicode, simplifyString"""
|
|||||||
title = toUnicode(title)
|
title = toUnicode(title)
|
||||||
title = simplifyString(title)
|
title = simplifyString(title)
|
||||||
|
|
||||||
for prefix in ['the ']:
|
for prefix in ['the ', 'an ', 'a ']:
|
||||||
if prefix == title[:len(prefix)]:
|
if prefix == title[:len(prefix)]:
|
||||||
title = title[len(prefix):]
|
title = title[len(prefix):]
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -250,6 +250,10 @@ var Movie = new Class({
|
|||||||
getUnprefixedTitle: function(t){
|
getUnprefixedTitle: function(t){
|
||||||
if(t.substr(0, 4).toLowerCase() == 'the ')
|
if(t.substr(0, 4).toLowerCase() == 'the ')
|
||||||
t = t.substr(4) + ', The';
|
t = t.substr(4) + ', The';
|
||||||
|
if(t.substr(0, 3).toLowerCase() == 'an ')
|
||||||
|
t = t.substr(3) + ', An';
|
||||||
|
if(t.substr(0, 2).toLowerCase() == 'a ')
|
||||||
|
t = t.substr(2) + ', A';
|
||||||
return t;
|
return t;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -290,8 +290,9 @@ class Renamer(Plugin):
|
|||||||
|
|
||||||
# Put 'The' at the end
|
# Put 'The' at the end
|
||||||
name_the = movie_name
|
name_the = movie_name
|
||||||
if movie_name[:4].lower() == 'the ':
|
for prefix in ['the ', 'an ', 'a ']:
|
||||||
name_the = movie_name[4:] + ', The'
|
if prefix == movie_name[:len(prefix)].lower():
|
||||||
|
name_the = movie_name[len(prefix):] + ', ' + prefix.strip().capitalize()
|
||||||
|
|
||||||
replacements = {
|
replacements = {
|
||||||
'ext': 'mkv',
|
'ext': 'mkv',
|
||||||
|
|||||||
Reference in new issue
Block a user