#590: 'Fixes Show Name/Season SS/Ep. EE - Title' pattern

This commit is contained in:
Rato
2019-02-23 18:39:50 +01:00
parent cdea6741f5
commit 4174267548
2 changed files with 20 additions and 2 deletions
+13 -2
View File
@@ -629,10 +629,11 @@ class RemoveWeak(Rule):
Remove weak-episode matches which appears after video, source, and audio matches.
"""
priority = 16
consequence = RemoveMatch
consequence = RemoveMatch, AppendMatch
def when(self, matches, context):
to_remove = []
to_append = []
for filepart in matches.markers.named('path'):
weaks = matches.range(filepart.start, filepart.end, predicate=lambda m: 'weak-episode' in m.tags)
if weaks:
@@ -641,8 +642,18 @@ class RemoveWeak(Rule):
'audio_channels', 'audio_profile'), index=0)
if previous and not matches.holes(
previous.end, weaks[0].start, predicate=lambda m: m.raw.strip(seps)):
if previous.raw.lower() == 'ep':
episode = copy.copy(weaks[0])
episode.name = 'episode'
episode.value = int(weaks[0].value)
episode.start = previous.start
episode.private = False
episode.tags = []
to_append.append(episode)
to_remove.extend(weaks)
return to_remove
return to_remove, to_append
class RemoveWeakIfSxxExx(Rule):
+7
View File
@@ -4617,3 +4617,10 @@
video_codec: H.264
release_group: KILLERS
type: episode
? /mnt/NAS/NoSubsTVShows/Babylon 5/Season 01/Ep. 02 - Soul Hunter
: title: Babylon 5
season: 1
episode: 2
episode_title: Soul Hunter
type: episode