mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-05 17:43:37 +00:00
Fix removal of non-release groups such that anime qualities are not trimmed from name
This commit is contained in:
parent
1dc6ea3cef
commit
1392d65254
5 changed files with 30 additions and 18 deletions
|
@ -85,6 +85,7 @@
|
|||
* Enable Alpha Ratio again now that the secure login page over https is fixed
|
||||
* Add ability to parse command line output from unix unrar version 4 and below
|
||||
* Fix show search box on non-poster show list views
|
||||
* Fix removal of non-release groups such that anime qualities are not trimmed from name
|
||||
|
||||
|
||||
### 0.10.0 (2015-08-06 11:05:00 UTC)
|
||||
|
|
|
@ -94,18 +94,18 @@ def remove_extension(name):
|
|||
return name
|
||||
|
||||
|
||||
def remove_non_release_groups(name):
|
||||
def remove_non_release_groups(name, anime=False):
|
||||
"""
|
||||
Remove non release groups from name
|
||||
"""
|
||||
|
||||
if name:
|
||||
rc = [re.compile(r'(?i)' + v) for v in
|
||||
'([\s\.\-_\[\{\(]*(no-rar|nzbgeek|ripsalot|rp|siklopentan)[\s\.\-_\]\}\)]*)$',
|
||||
'(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*(www\.\w+.\w+)[\s\.\-_]*[\]\}\)][\s\.\-_]*)$',
|
||||
'(?<=\w)([\s\.\-_]*[\[\{\(]\s*(rar(bg|tv)|((e[tz]|v)tv))[\s\.\-_]*[\]\}\)][\s\.\-_]*)$',
|
||||
'(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*[\w\s\.\-\_]+[\s\.\-_]*[\]\}\)][\s\.\-_]*)$'
|
||||
]
|
||||
rc = [re.compile(r'(?i)' + v) for v in [
|
||||
'([\s\.\-_\[\{\(]*(no-rar|nzbgeek|ripsalot|rp|siklopentan)[\s\.\-_\]\}\)]*)$',
|
||||
'(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*(www\.\w+.\w+)[\s\.\-_]*[\]\}\)][\s\.\-_]*)$',
|
||||
'(?<=\w)([\s\.\-_]*[\[\{\(]\s*(rar(bg|tv)|((e[tz]|v)tv))[\s\.\-_]*[\]\}\)][\s\.\-_]*)$'] +
|
||||
(['(?<=\w)([\s\.\-_]*[\[\{\(][\s\.\-_]*[\w\s\.\-\_]+[\s\.\-_]*[\]\}\)][\s\.\-_]*)$'], [])[anime]
|
||||
]
|
||||
rename = name
|
||||
while rename:
|
||||
for regex in rc:
|
||||
|
|
|
@ -222,8 +222,15 @@ def _downloadPropers(properList):
|
|||
|
||||
else:
|
||||
|
||||
# get the show object
|
||||
showObj = helpers.findCertainShow(sickbeard.showList, curProper.indexerid)
|
||||
if showObj == None:
|
||||
logger.log(u'Unable to find the show with indexerid ' + str(
|
||||
curProper.indexerid) + ' so unable to download the proper', logger.ERROR)
|
||||
continue
|
||||
|
||||
# make sure that none of the existing history downloads are the same proper we're trying to download
|
||||
clean_proper_name = _genericName(helpers.remove_non_release_groups(curProper.name))
|
||||
clean_proper_name = _genericName(helpers.remove_non_release_groups(curProper.name, showObj.anime))
|
||||
isSame = False
|
||||
for curResult in historyResults:
|
||||
# if the result exists in history already we need to skip it
|
||||
|
@ -234,12 +241,8 @@ def _downloadPropers(properList):
|
|||
logger.log(u'This proper is already in history, skipping it', logger.DEBUG)
|
||||
continue
|
||||
|
||||
# get the episode object
|
||||
showObj = helpers.findCertainShow(sickbeard.showList, curProper.indexerid)
|
||||
if showObj == None:
|
||||
logger.log(u'Unable to find the show with indexerid ' + str(
|
||||
curProper.indexerid) + ' so unable to download the proper', logger.ERROR)
|
||||
continue
|
||||
|
||||
|
||||
epObj = showObj.getEpisode(curProper.season, curProper.episode)
|
||||
|
||||
# make the result object
|
||||
|
|
|
@ -2156,14 +2156,14 @@ class TVEpisode(object):
|
|||
def us(name):
|
||||
return re.sub('[ -]', '_', name)
|
||||
|
||||
def release_name(name):
|
||||
def release_name(show, name):
|
||||
if name:
|
||||
name = helpers.remove_non_release_groups(helpers.remove_extension(name))
|
||||
name = helpers.remove_non_release_groups(helpers.remove_extension(name), show.anime)
|
||||
return name
|
||||
|
||||
def release_group(show, name):
|
||||
if name:
|
||||
name = helpers.remove_non_release_groups(helpers.remove_extension(name))
|
||||
name = helpers.remove_non_release_groups(helpers.remove_extension(name), show.anime)
|
||||
else:
|
||||
return ""
|
||||
|
||||
|
@ -2205,7 +2205,7 @@ class TVEpisode(object):
|
|||
'%0XE': '%02d' % self.scene_episode,
|
||||
'%AB': '%(#)03d' % {'#': self.absolute_number},
|
||||
'%XAB': '%(#)03d' % {'#': self.scene_absolute_number},
|
||||
'%RN': release_name(self.release_name),
|
||||
'%RN': release_name(self.show, self.release_name),
|
||||
'%RG': release_group(self.show, self.release_name),
|
||||
'%AD': str(self.airdate).replace('-', ' '),
|
||||
'%A.D': str(self.airdate).replace('-', '.'),
|
||||
|
|
|
@ -29,6 +29,14 @@ class HelpersTests(unittest.TestCase):
|
|||
self.assertEqual(helpers.sizeof_fmt(2 ** 20), '1.0 MB')
|
||||
self.assertEqual(helpers.sizeof_fmt(1234567), '1.2 MB')
|
||||
|
||||
def test_remove_non_release_groups(self):
|
||||
test_names = {
|
||||
('[HorribleSubs] Hidan no Aria AA - 08 [1080p]', True): '[HorribleSubs] Hidan no Aria AA - 08 [1080p]',
|
||||
('The.Last.Man.On.Earth.S02E08.No.Bull.1080p.WEB-DL.DD5.1.H264-BTN[rartv]', False): 'The.Last.Man.On.Earth.S02E08.No.Bull.1080p.WEB-DL.DD5.1.H264-BTN',
|
||||
}
|
||||
for test_name, test_result in test_names.items():
|
||||
self.assertEqual(test_result, helpers.remove_non_release_groups(test_name[0], test_name[1]))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
suite = unittest.TestLoader().loadTestsFromTestCase(HelpersTests)
|
||||
|
|
Loading…
Reference in a new issue