If a file is tagged in Kodi as Dolby TrueHD an additional check will be performed to see if its filename contains ".Atmos." (or similar). If so the audio format will be Dolby Atmos rather than Dolby TrueHD.
Similarly if a file is tagged in Kodi as DTS-HD Master Audio an additional check will be performed to see if its filename contains ".DTS.X." (or similar). If so the audio format will be DTS-X rathor than DTS-HD Master Audio.
In each case a regex is used to prevent false positives. When Kodi can detect and tag Atmos/DTS-X this code path can be safely removed without change in functionality.
If a file is tagged in Kodi as Dolby TrueHD an additional check will be performed to see if its filename contains ".Atmos." (or similar). If so the audio format will be Dolby Atmos rather than Dolby TrueHD.
Similarly if a file is tagged in Kodi as DTS-HD Master Audio an additional check will be performed to see if its filename contains ".DTS.X." (or similar). If so the audio format will be DTS-X rathor than DTS-HD Master Audio.
In each case a regex is used to prevent false positives. When Kodi can detect and tag Atmos/DTS-X this code path can be safely removed without change in functionality.
See the discussion here for the pros and cons: http://cinemavision.tv/forums/topic/414-how-does-cinemavision-recognize-atmosdtsx-content-for-audio-bumpers/
I wasn't sure about the style, it didn't seem to be following PEP8 so I just winged it.