collective / wildcard.media

13 stars 12 forks source link

Missing convert from byte to str #73

Closed 1letter closed 3 years ago

1letter commented 3 years ago

the checks in the loop use str type for compare but line is type byte object. a convert is needed

class AVProbeProcess(BaseSubProcess): """ """ if os.name == 'nt': bin_name = 'avprobe.exe' else: bin_name = 'avprobe'

def info(self, filepath):
    cmd = [self.binary, filepath]
    result = {}
    lines = self._run_command(cmd, or_error=True)
    for line in lines.splitlines():
        if ':' not in line:
            continue
        name, data = line.split(':', 1)
        data = data.strip()
        if not data:
            continue
        name = name.strip().lower()
        if ' ' in name:
            continue
        result[name] = data
    return result