File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 11# -*- coding: utf-8 -*-
2+ import os
3+ from pathlib import Path
24from pgsrip import pgsrip , Mkv , Options
35from 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+
520video = r"F:/Uncompressed Videos/Blade/Blade (1998) [imdbid-tt0120611]/Blade_t00.mkv"
621media = Mkv (video )
722options = Options (languages = {Language ("eng" )}, overwrite = True , one_per_lang = True )
823
24+ print ("Starting OCR conversion..." )
925pgsrip .rip (media , options )
26+ print ("Done!" )
You can’t perform that action at this time.
0 commit comments