Skip to content

Commit

Permalink
Fix HDD release group detected as DolbyDigital
Browse files Browse the repository at this point in the history
Close #317
  • Loading branch information
Toilal committed Sep 18, 2016
1 parent c48edbd commit 232ef2b
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
19 changes: 18 additions & 1 deletion guessit/rules/properties/audio_codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,24 @@ def audio_codec():
:rtype: Rebulk
"""
rebulk = Rebulk().regex_defaults(flags=re.IGNORECASE, abbreviations=[dash]).string_defaults(ignore_case=True)
rebulk.defaults(name="audio_codec")

def audio_codec_priority(match1, match2):
"""
Gives priority to audio_codec
:param match1:
:type match1:
:param match2:
:type match2:
:return:
:rtype:
"""
if match1.name == 'audio_codec' and match2.name in ['audio_profile', 'audio_channels']:
return match2
if match1.name == ['audio_profile', 'audio_channels'] and match2.name == 'audio_codec':

This comment has been minimized.

Copy link
@ratoaq2

ratoaq2 Sep 18, 2016

Member

Shouldn't be in instead of == ?

This comment has been minimized.

Copy link
@Toilal

Toilal via email Sep 18, 2016

Author Member
return match1
return '__default__'

rebulk.defaults(name="audio_codec", conflict_solver=audio_codec_priority)

rebulk.regex("MP3", "LAME", r"LAME(?:\d)+-?(?:\d)+", value="MP3")
rebulk.regex("Dolby", "DolbyDigital", "Dolby-Digital", "DD", value="DolbyDigital")
Expand Down
14 changes: 13 additions & 1 deletion guessit/test/episodes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2033,4 +2033,16 @@
subtitle_language: it
title: Fear the Walking Dead
type: episode
video_codec: XviD
video_codec: XviD

? Game.Of.Thrones.S06E04.720p.PROPER.HDTV.x264-HDD
: episode: 4
format: HDTV
other: Proper
proper_count: 1
release_group: HDD
screen_size: 720p
season: 6
title: Game Of Thrones
type: episode
video_codec: h264

0 comments on commit 232ef2b

Please sign in to comment.