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) |     lseek(outfd, 0, SEEK_SET) | ||||||
|     set_inheritable(infd, True) |     set_inheritable(infd, True) | ||||||
|     set_inheritable(outfd, True) |     set_inheritable(outfd, True) | ||||||
|  |     env = {**os.environ, 'LANG': 'C'} | ||||||
|     warnings = [] |     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') |         pb = tqdm(TextIOWrapper(mkvmerge.stdout, encoding="utf-8"), total=100, unit='%', desc='Extraction') | ||||||
|         for line in pb: |         for line in pb: | ||||||
|             if line.startswith('Progression :'): |             if line.startswith('Progress :'): | ||||||
|                 p = re.compile('^Progression : (?P<progress>[0-9]{1,3})%$') |                 p = re.compile('^Progress : (?P<progress>[0-9]{1,3})%$') | ||||||
|                 m = p.match(line) |                 m = p.match(line) | ||||||
|                 if m == None: |                 if m == None: | ||||||
|                     logger.error('Impossible to parse progress') |                     logger.error('Impossible to parse progress') | ||||||
|                 pb.update(int(m['progress'])-pb.n) |                 pb.update(int(m['progress'])-pb.n) | ||||||
|             elif line.startswith('Avertissement'): |             elif line.startswith('Warning'): | ||||||
|                 warnings.append(line) |                 warnings.append(line) | ||||||
|         pb.update(100-pb.n) |         pb.update(100-pb.n) | ||||||
|         pb.refresh() |         pb.refresh() | ||||||
| @@ -1079,17 +1080,18 @@ def mergeMKVs(inputs, outputName): | |||||||
|          |          | ||||||
|     # We merge all files. |     # We merge all files. | ||||||
|     warnings = [] |     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') |         pb = tqdm(TextIOWrapper(mkvmerge.stdout, encoding="utf-8"), total=100, unit='%', desc='Merging') | ||||||
|         for line in pb: |         for line in pb: | ||||||
|             if line.startswith('Progression :'): |             if line.startswith('Progress :'): | ||||||
|                 p = re.compile('^Progression : (?P<progress>[0-9]{1,3})%$') |                 p = re.compile('^Progress : (?P<progress>[0-9]{1,3})%$') | ||||||
|                 m = p.match(line) |                 m = p.match(line) | ||||||
|                 if m == None: |                 if m == None: | ||||||
|                     logger.error('Impossible to parse progress') |                     logger.error('Impossible to parse progress') | ||||||
|                 pb.n = int(m['progress']) |                 pb.n = int(m['progress']) | ||||||
|                 pb.update() |                 pb.update() | ||||||
|             elif line.startswith('Avertissement'): |             elif line.startswith('Warning'): | ||||||
|                 warnings.append(line) |                 warnings.append(line) | ||||||
|                  |                  | ||||||
|         status = mkvmerge.wait() |         status = mkvmerge.wait() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user