Skip to content

Commit d967c82

Browse files
committed
Update test script with tesseract/mkvextract paths
1 parent 61e9735 commit d967c82

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test_pgsrip.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
# -*- coding: utf-8 -*-
2+
import os
3+
from pathlib import Path
24
from pgsrip import pgsrip, Mkv, Options
35
from babelfish import Language
46

7+
# Set up environment for tesseract and mkvextract
8+
# Update these paths to match your system
9+
tesseract_path = r"C:\Program Files\Tesseract-OCR\tesseract.exe"
10+
mkvtoolnix_path = r"C:\Program Files\MKVToolNix"
11+
12+
if Path(tesseract_path).exists():
13+
tesseract_dir = str(Path(tesseract_path).parent)
14+
os.environ["PATH"] = f"{tesseract_dir}{os.pathsep}{os.environ.get('PATH', '')}"
15+
os.environ["TESSERACT_CMD"] = tesseract_path
16+
17+
if Path(mkvtoolnix_path).exists():
18+
os.environ["PATH"] = f"{mkvtoolnix_path}{os.pathsep}{os.environ.get('PATH', '')}"
19+
520
video = r"F:/Uncompressed Videos/Blade/Blade (1998) [imdbid-tt0120611]/Blade_t00.mkv"
621
media = Mkv(video)
722
options = Options(languages={Language("eng")}, overwrite=True, one_per_lang=True)
823

24+
print("Starting OCR conversion...")
925
pgsrip.rip(media, options)
26+
print("Done!")

0 commit comments

Comments
 (0)