fix: 空渠道检测改用JSONObject.has + 移除gitignore误排除manifest

This commit is contained in:
LukeMackin
2026-07-19 23:10:03 +08:00
parent ffd05e3e17
commit a96560966c
33 changed files with 891 additions and 6 deletions

51
ocr_script.py Normal file
View File

@@ -0,0 +1,51 @@
"""
OCR script to extract text from screen.png
"""
import sys
import os
image_path = r"D:\Yuzu-GCA\screen.png"
# Try pytesseract first
try:
import pytesseract
from PIL import Image
img = Image.open(image_path)
text = pytesseract.image_to_string(img, lang='eng+chi_sim')
print("=== pytesseract OCR result ===")
print(text)
sys.exit(0)
except ImportError:
print("pytesseract not available, trying alternative...")
# Try Windows OCR via winrt
try:
import asyncio
from winsdk.windows.media.ocr import OcrEngine
from winsdk.windows.graphics.imaging import BitmapDecoder
from winsdk.windows.storage.streams import RandomAccessStreamReference
from winsdk.windows.globalization import Language
async def ocr_windows():
# Get the default OCR engine for Chinese
engine = OcrEngine.try_create_from_user_profile_languages()
if not engine:
# Fallback to English
engine = OcrEngine.try_create_from_language(Language("en"))
# Open the image file
file_stream = await RandomAccessStreamReference.create_from_file(image_path).open_read_async()
decoder = await BitmapDecoder.create_async(file_stream)
bitmap = await decoder.get_software_bitmap_async()
result = await engine.recognize_async(bitmap)
print("=== Windows OCR result ===")
for line in result.lines:
print(line.text)
asyncio.run(ocr_windows())
sys.exit(0)
except ImportError:
print("winsdk not available either")
print("No OCR engine available. Please install pytesseract or Windows SDK.")