Plex-Meta-Manager icon indicating copy to clipboard operation
Plex-Meta-Manager copied to clipboard

[Defaults]: Regex for AAC could be tweaked

Open Spazholio opened this issue 1 year ago • 1 comments

Link to File

defaults/overlays/audio_codec.yml

Version Number

1.19.0-nightly66 (Docker)

What branch are you on?

nightly

Describe the Bug

Currently, the regex for AAC files is as follows:

- key: aac
  value: '(?i)\b(aac|stereo|2\.0)\b'

However, this is matching against some commentary tracks that I have encoded in Opus format:

<Stream id="371337" streamType="2" selected="1" default="1" codec="opus" index="1" channels="6" bitrate="361" language="English" languageTag="en" languageCode="eng" audioChannelLayout="5.1" requiredBandwidths="366,366,366,366,366,366,366,366" samplingRate="48000" title="Surround" displayTitle="English (OPUS 5.1)" extendedDisplayTitle="Surround (English OPUS 5.1)">
</Stream>
<Stream id="371338" streamType="2" codec="opus" index="2" channels="2" bitrate="164" language="English" languageTag="en" languageCode="eng" audioChannelLayout="stereo" requiredBandwidths="165,165,165,165,165,165,165,165" samplingRate="48000" title="Commentary" displayTitle="English (OPUS Stereo)" extendedDisplayTitle="Commentary (English OPUS Stereo)">
</Stream>

Not sure that PMM should be analyzing anything other than the first/default audio track, but that's another issue I'll open.

Since plenty of other audio formats can be in stereo and indeed have the word "stereo" or even "2.0" in them, I would suggest changing the regex to:

- key: aac
  value: '(?i)\baac.?(stereo|2\.0)\b'

This will capture anything that contains "aac" AND either "Stereo" or "2.0". Personally, I would do away with the "Stereo" and "2.0" bits, but that's just me and it was likely put in there for a reason.

Spazholio avatar Jun 13 '23 15:06 Spazholio

Now that I've done a little more investigating, it appears as though the codec of a given stream is available via the PlexAPI. Would it make more sense to use that value rather than using regexes?

Spazholio avatar Jun 13 '23 18:06 Spazholio

Generally speaking, the PMM Defaults files follow the TRaSH naming conventions (https://trash-guides.info/), so any changes would come from there.

I will make the suggestion that we take the task of re-checking and aligning to make sure we're up-to-date with their conventions.

YozoraXCII avatar Mar 23 '24 11:03 YozoraXCII

Generally speaking, the PMM Defaults files follow the TRaSH naming conventions (https://trash-guides.info/), so any changes would come from there.

I will make the suggestion that we take the task of re-checking and aligning to make sure we're up-to-date with their conventions.

Redacted my comment, but saw now you already replied.

Since my second suggestion in my redacted comment was kinda invalid, since the \b in the regex already does by checking its not in a word. It just have to remove the stereo and 2.0 check. But thats explains, Since after reading your comment i checked and the regex for AAC in TRaSH is now:

  },
  "name": "AAC",
  "includeCustomFormatWhenRenaming": false,
  "specifications": [{
          "name": "AAC",
          "implementation": "ReleaseTitleSpecification",
          "negate": false,
          "required": true,
          "fields": {
              "value": "\\bAAC(\\b|\\d)"
          }
      },

So seems they have tweaked it, so i guess re-checking of all would do good to sync up again incase other tweakings also be found.


Originally comment of mine: You're right. It's matching now to 'aac' or 'stereo' or '2.0', you also got for example aac 5.1 or 7.1 or other audio setups. or even mono could exist.

My suggestion would be: the following regex (?i)\baac.?(stereo|[0-9]\.[0-9]|mono)\b

I know HE-AAC (high efficency AAC) gets listed as HE-AAC i wonder if the for example AAC-LD/AAC-LC also gets listed. Otherways the regex needs further tweaking. or like you said only trigger on 'aac' but mayby they didnt wanted that since its such a short word that it might end up in some notes of the audio description.

or working towards something more like universal? (?i)(?<![a-z])aac(?![a-z]) which will not accept the word aac if its in a word somehow, if theres before or after direct a letter after or before AAC

jz1 avatar Mar 23 '24 11:03 jz1