diff --git a/guessit/rules/properties/audio_codec.py b/guessit/rules/properties/audio_codec.py index ed22185..dff9f67 100644 --- a/guessit/rules/properties/audio_codec.py +++ b/guessit/rules/properties/audio_codec.py @@ -114,3 +114,21 @@ class Ac3Rule(AudioProfileRule): AUDIO_CODEC.rules(DtsRule, AacRule, Ac3Rule, AudioValidatorRule) + + +class HqConflictRule(RemoveMatchRule): + """ + Solve conflict between HQ from other property and from audioProfile. + """ + + priority = 250 # Must run after AudioProfileRule + + def when(self, matches, context): + hq_audio = matches.named('audioProfile', lambda match: match.value == 'HQ') + hq_audio_spans = [match.span for match in hq_audio] + hq_other = matches.named('other', lambda match: match.span in hq_audio_spans) + + if hq_other: + return hq_other + +AUDIO_CODEC.rules(HqConflictRule) diff --git a/guessit/test/movies.yml b/guessit/test/movies.yml index c3231fb..e1b6674 100644 --- a/guessit/test/movies.yml +++ b/guessit/test/movies.yml @@ -518,4 +518,54 @@ format: BluRay videoCodec: XviD language: Spanish - title: Ejecutiva En Apuros \ No newline at end of file + title: Ejecutiva En Apuros + +? Die.Schluempfe.2.German.DL.1080p.BluRay.x264-EXQUiSiTE.mkv +: title: Die Schluempfe 2 + format: BluRay + language: + - Multiple languages + - German + videoCodec: h264 + releaseGroup: EXQUiSiTE + screenSize: 1080p + +? Rocky 1976 French SubForced BRRip x264 AC3-FUNKY.mkv +: title: Rocky + year: 1976 + subtitleLanguage: French + format: BluRay + videoCodec: h264 + audioCodec: AC3 + releaseGroup: FUNKY + +? REDLINE (BD 1080p H264 10bit FLAC) [3xR].mkv +: title: REDLINE + format: BluRay + videoCodec: h264 + videoProfile: 10bit + audioCodec: FLAC + screenSize: 1080p + +? The.Lizzie.McGuire.Movie.(2003).HR.DVDRiP.avi +: title: The Lizzie McGuire Movie + year: 2003 + format: DVD + other: HR + +? Hua.Mulan.BRRIP.MP4.x264.720p-HR.avi +: title: Hua Mulan + videoCodec: h264 + format: BluRay + screenSize: 720p + other: HR + +? Dr.Seuss.The.Lorax.2012.DVDRip.LiNE.XviD.AC3.HQ.Hive-CM8.mp4 +: videoCodec: XviD + title: Dr Seuss The Lorax + format: DVD + other: LiNE + year: 2012 + audioCodec: AC3 + audioProfile: HQ + releaseGroup: Hive-CM8 \ No newline at end of file diff --git a/guessit/test/rules/other.yml b/guessit/test/rules/other.yml index 57f07d7..ec0d3bc 100644 --- a/guessit/test/rules/other.yml +++ b/guessit/test/rules/other.yml @@ -128,3 +128,9 @@ ? +The complete movie : title: The complete movie + +? +AC3-HQ +: audioProfile: HQ + +? Other-HQ +: other: HQ