Commit 9fe68a63 authored by Anika Treffehn's avatar Anika Treffehn
Browse files

fixed bug when no cod_opts are given and simplified function

parent f631c76c
Loading
Loading
Loading
Loading
Loading
+15 −22
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@
import logging
import os.path
import platform
import re
from itertools import repeat
from pathlib import Path
from shutil import copyfile
@@ -273,28 +272,22 @@ class EVS(Processing):

        # in case of LFE 9.6 kbps NB processing strip any "-max_band XX" from cmd.extend and amend by "-max_band NB"
        if proc_chan_lfe_9k6bps_nb is True:
            cod_opts = []
            # search for -max_band XXX
            regex = re.compile(r"-max_band.*", re.I)
            last_was_max_band = False
            for i in self.cod_opts:
                # the additional arguments are expected in form of a list, where "-max_band" are "SWB" are two entries
                # then when we have detected "-max_band" in the previous run, we have to skip i again
                if last_was_max_band is True:
                    last_was_max_band = False
                    continue
                if regex.match(i):
                    last_was_max_band = True
            if self.cod_opts:
                cod_opts = self.cod_opts
                # for finding index of max_band entry use lower case version
                cod_opts_lower = [x.lower() for x in self.cod_opts]
                if "-max_band" in cod_opts_lower:
                    idx_max_band = cod_opts_lower.index("-max_band")
                    # use original version and not lower case version due to possible paths in there
                    cod_opts[idx_max_band+1] = "NB"
            else:
                    cod_opts.append(i)
                    last_was_max_band = False
            # add -max_band NB
            cod_opts.append("-max_band")
            cod_opts.append("NB")
                cod_opts = ["-max_band", "NB"]
        else:
            if self.cod_opts:
                cod_opts = self.cod_opts
            else:
                cod_opts = []

        if self.cod_opts:
        cmd.extend(cod_opts)

        cmd.extend(