Make mkvmerge speaks english for its outputs so that the code is neutral with respect to locally installed languages.
This commit is contained in:
18
removeads.py
18
removeads.py
@@ -773,17 +773,18 @@ def extractMKVPart(mkvmerge, inputFile, outputFile, begin, end):
|
||||
lseek(outfd, 0, SEEK_SET)
|
||||
set_inheritable(infd, True)
|
||||
set_inheritable(outfd, True)
|
||||
env = {**os.environ, 'LANG': 'C'}
|
||||
warnings = []
|
||||
with Popen([mkvmerge, '-o', '/proc/self/fd/%d' % outfd, '--split', 'parts:%s-%s' % (begin, end), '/proc/self/fd/%d' % infd], stdout=PIPE, close_fds=False) as mkvmerge:
|
||||
with Popen([mkvmerge, '-o', '/proc/self/fd/%d' % outfd, '--split', 'parts:%s-%s' % (begin, end), '/proc/self/fd/%d' % infd], stdout=PIPE, close_fds=False, env=env) as mkvmerge:
|
||||
pb = tqdm(TextIOWrapper(mkvmerge.stdout, encoding="utf-8"), total=100, unit='%', desc='Extraction')
|
||||
for line in pb:
|
||||
if line.startswith('Progression :'):
|
||||
p = re.compile('^Progression : (?P<progress>[0-9]{1,3})%$')
|
||||
if line.startswith('Progress :'):
|
||||
p = re.compile('^Progress : (?P<progress>[0-9]{1,3})%$')
|
||||
m = p.match(line)
|
||||
if m == None:
|
||||
logger.error('Impossible to parse progress')
|
||||
pb.update(int(m['progress'])-pb.n)
|
||||
elif line.startswith('Avertissement'):
|
||||
elif line.startswith('Warning'):
|
||||
warnings.append(line)
|
||||
pb.update(100-pb.n)
|
||||
pb.refresh()
|
||||
@@ -1079,17 +1080,18 @@ def mergeMKVs(inputs, outputName):
|
||||
|
||||
# We merge all files.
|
||||
warnings = []
|
||||
with Popen(mergeParams, stdout=PIPE, close_fds=False) as mkvmerge:
|
||||
env = {**os.environ, 'LANG': 'C'}
|
||||
with Popen(mergeParams, stdout=PIPE, close_fds=False, env=env) as mkvmerge:
|
||||
pb = tqdm(TextIOWrapper(mkvmerge.stdout, encoding="utf-8"), total=100, unit='%', desc='Merging')
|
||||
for line in pb:
|
||||
if line.startswith('Progression :'):
|
||||
p = re.compile('^Progression : (?P<progress>[0-9]{1,3})%$')
|
||||
if line.startswith('Progress :'):
|
||||
p = re.compile('^Progress : (?P<progress>[0-9]{1,3})%$')
|
||||
m = p.match(line)
|
||||
if m == None:
|
||||
logger.error('Impossible to parse progress')
|
||||
pb.n = int(m['progress'])
|
||||
pb.update()
|
||||
elif line.startswith('Avertissement'):
|
||||
elif line.startswith('Warning'):
|
||||
warnings.append(line)
|
||||
|
||||
status = mkvmerge.wait()
|
||||
|
||||
Reference in New Issue
Block a user