mirror of
https://github.com/moparisthebest/SickRage
synced 2024-11-18 07:15:13 -05:00
Merge pull request #1223 from TagForce/Releasegroup
Changed Releasegroup handling in Renamer
This commit is contained in:
commit
66bf8bfc4f
@ -2154,6 +2154,26 @@ class TVEpisode(object):
|
|||||||
else:
|
else:
|
||||||
show_name = self.show.name
|
show_name = self.show.name
|
||||||
|
|
||||||
|
#try to get the release group
|
||||||
|
rel_grp = {};
|
||||||
|
rel_grp["SiCKRAGE"] = 'SiCKRAGE';
|
||||||
|
if hasattr(self, 'location'): #from the location name
|
||||||
|
rel_grp['location'] = release_group(self.show, self.location);
|
||||||
|
if (rel_grp['location'] == ''): del rel_grp['location']
|
||||||
|
if hasattr(self, '_release_group'): #from the release group field in db
|
||||||
|
rel_grp['database'] = self._release_group;
|
||||||
|
if (rel_grp['database'] == ''): del rel_grp['database']
|
||||||
|
if hasattr(self, 'release_name'): #from the release name field in db
|
||||||
|
rel_grp['release_name'] = release_group(self.show, self.release_name);
|
||||||
|
if (rel_grp['release_name'] == ''): del rel_grp['release_name']
|
||||||
|
|
||||||
|
# use release_group, release_name, location in that order
|
||||||
|
if ('database' in rel_grp): relgrp = 'database'
|
||||||
|
elif ('release_name' in rel_grp): relgrp = 'release_name'
|
||||||
|
elif ('location' in rel_grp): relgrp = 'location'
|
||||||
|
else: relgrp = 'SiCKRAGE'
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'%SN': show_name,
|
'%SN': show_name,
|
||||||
'%S.N': dot(show_name),
|
'%S.N': dot(show_name),
|
||||||
@ -2175,7 +2195,7 @@ class TVEpisode(object):
|
|||||||
'%AB': '%(#)03d' % {'#': self.absolute_number},
|
'%AB': '%(#)03d' % {'#': self.absolute_number},
|
||||||
'%XAB': '%(#)03d' % {'#': self.scene_absolute_number},
|
'%XAB': '%(#)03d' % {'#': self.scene_absolute_number},
|
||||||
'%RN': release_name(self.release_name),
|
'%RN': release_name(self.release_name),
|
||||||
'%RG': release_group(self.show, self.release_name),
|
'%RG': rel_grp[relgrp],
|
||||||
'%AD': str(self.airdate).replace('-', ' '),
|
'%AD': str(self.airdate).replace('-', ' '),
|
||||||
'%A.D': str(self.airdate).replace('-', '.'),
|
'%A.D': str(self.airdate).replace('-', '.'),
|
||||||
'%A_D': us(str(self.airdate)),
|
'%A_D': us(str(self.airdate)),
|
||||||
@ -2224,20 +2244,29 @@ class TVEpisode(object):
|
|||||||
|
|
||||||
result_name = pattern
|
result_name = pattern
|
||||||
|
|
||||||
# if there's no release group then replace it with a reasonable facsimile
|
# if there's no release group in the db, let the user know we replaced it
|
||||||
if not replace_map['%RN']:
|
if (not hasattr(self, '_release_group') and (not replace_map['%RG'] == 'SiCKRAGE')):
|
||||||
if self.show.air_by_date or self.show.sports:
|
logger.log(u"Episode has no release group, replacing it with '" + replace_map['%RG'] + "'", logger.DEBUG);
|
||||||
result_name = result_name.replace('%RN', '%S.N.%A.D.%E.N-SiCKRAGE')
|
self._release_group = replace_map['%RG'] #if release_group is not in the db, put it there
|
||||||
result_name = result_name.replace('%rn', '%s.n.%A.D.%e.n-sickrage')
|
elif ((self._release_group == '') and (not replace_map['%RG'] == 'SiCKRAGE')):
|
||||||
elif anime_type != 3:
|
logger.log(u"Episode has no release group, replacing it with '" + replace_map['%RG'] + "'", logger.DEBUG);
|
||||||
result_name = result_name.replace('%RN', '%S.N.%AB.%E.N-SiCKRAGE')
|
self._release_group = replace_map['%RG'] #if release_group is not in the db, put it there
|
||||||
result_name = result_name.replace('%rn', '%s.n.%ab.%e.n-sickrage')
|
|
||||||
else:
|
# if there's no release name then replace it with a reasonable facsimile
|
||||||
result_name = result_name.replace('%RN', '%S.N.S%0SE%0E.%E.N-SiCKRAGE')
|
if not replace_map['%RN']:
|
||||||
result_name = result_name.replace('%rn', '%s.n.s%0se%0e.%e.n-sickrage')
|
|
||||||
|
if self.show.air_by_date or self.show.sports:
|
||||||
|
result_name = result_name.replace('%RN', '%S.N.%A.D.%E.N-' + replace_map['%RG'])
|
||||||
|
result_name = result_name.replace('%rn', '%s.n.%A.D.%e.n-' + replace_map['%RG'].lower())
|
||||||
|
|
||||||
|
elif anime_type != 3:
|
||||||
|
result_name = result_name.replace('%RN', '%S.N.%AB.%E.N-' + replace_map['%RG'])
|
||||||
|
result_name = result_name.replace('%rn', '%s.n.%ab.%e.n-' + replace_map['%RG'].lower())
|
||||||
|
|
||||||
|
else:
|
||||||
|
result_name = result_name.replace('%RN', '%S.N.S%0SE%0E.%E.N-' + replace_map['%RG'])
|
||||||
|
result_name = result_name.replace('%rn', '%s.n.s%0se%0e.%e.n-' + replace_map['%RG'].lower())
|
||||||
|
|
||||||
result_name = result_name.replace('%RG', 'SICKRAGE')
|
|
||||||
result_name = result_name.replace('%rg', 'sickrage')
|
|
||||||
logger.log(u"Episode has no release name, replacing it with a generic one: " + result_name, logger.DEBUG)
|
logger.log(u"Episode has no release name, replacing it with a generic one: " + result_name, logger.DEBUG)
|
||||||
|
|
||||||
if not replace_map['%RT']:
|
if not replace_map['%RT']:
|
||||||
|
Loading…
Reference in New Issue
Block a user