Skip to content

Commit c208ba3

Browse files
Copilotmeizhong986
andcommitted
Add encoding='utf-8' to all subprocess.run calls with text=True
Co-authored-by: meizhong986 <148393222+meizhong986@users.noreply.github.com>
1 parent defdc8f commit c208ba3

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

whisperjav/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ def process_files_sync(media_files: List[Dict], args: argparse.Namespace, resolv
430430
cmd,
431431
capture_output=True,
432432
text=True,
433+
encoding='utf-8',
433434
timeout=600
434435
)
435436
else:
@@ -439,6 +440,7 @@ def process_files_sync(media_files: List[Dict], args: argparse.Namespace, resolv
439440
stdout=subprocess.PIPE,
440441
stderr=None,
441442
text=True,
443+
encoding='utf-8',
442444
timeout=600
443445
)
444446

@@ -595,6 +597,7 @@ def progress_callback(message: Dict):
595597
cmd,
596598
capture_output=True,
597599
text=True,
600+
encoding='utf-8',
598601
timeout=600
599602
)
600603
else:
@@ -604,6 +607,7 @@ def progress_callback(message: Dict):
604607
stdout=subprocess.PIPE,
605608
stderr=None,
606609
text=True,
610+
encoding='utf-8',
607611
timeout=600
608612
)
609613

whisperjav/modules/audio_extraction.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def extract(self, input_file: Union[str, Path], output_path: Union[str, Path]) -
6161
result = subprocess.run(cmd,
6262
capture_output=True,
6363
text=True,
64-
check=True)
64+
encoding='utf-8', check=True)
6565

6666
# Get duration
6767
duration = self._get_audio_duration(output_path)
@@ -83,7 +83,7 @@ def _get_audio_duration(self, audio_file: Path) -> float:
8383
"-"
8484
]
8585

86-
result = subprocess.run(cmd, capture_output=True, text=True)
86+
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8')
8787

8888
# Parse duration from FFmpeg output
8989
for line in result.stderr.split('\n'):

whisperjav/modules/media_discovery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def _get_ffprobe_info(self, file_path: str) -> Optional[Dict]:
143143
file_path
144144
]
145145

146-
result = subprocess.run(cmd, capture_output=True, text=True, check=True)
146+
result = subprocess.run(cmd, capture_output=True, text=True, encoding='utf-8', check=True)
147147
data = json.loads(result.stdout)
148148

149149
info = {}

whisperjav/utils/preflight_check.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def _check_ffmpeg(self):
247247
['ffmpeg', '-version'],
248248
capture_output=True,
249249
text=True,
250+
encoding='utf-8',
250251
timeout=5
251252
)
252253
version_line = result.stdout.split('\n')[0]

0 commit comments

Comments
 (0)