mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
refactoring
This commit is contained in:
parent
12422fa1ff
commit
b5d6731497
@ -34,7 +34,7 @@ from .logreader import LogReader
|
|||||||
from .ugpio import UserGpio
|
from .ugpio import UserGpio
|
||||||
from .streamer import Streamer
|
from .streamer import Streamer
|
||||||
from .snapshoter import Snapshoter
|
from .snapshoter import Snapshoter
|
||||||
from .tesseract import TesseractOcr
|
from .ocr import Ocr
|
||||||
from .server import KvmdServer
|
from .server import KvmdServer
|
||||||
|
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ def main(argv: (list[str] | None)=None) -> None:
|
|||||||
info_manager=InfoManager(global_config),
|
info_manager=InfoManager(global_config),
|
||||||
log_reader=(LogReader() if config.log_reader.enabled else None),
|
log_reader=(LogReader() if config.log_reader.enabled else None),
|
||||||
user_gpio=UserGpio(config.gpio, global_config.otg),
|
user_gpio=UserGpio(config.gpio, global_config.otg),
|
||||||
ocr=TesseractOcr(**config.ocr._unpack()),
|
ocr=Ocr(**config.ocr._unpack()),
|
||||||
|
|
||||||
hid=hid,
|
hid=hid,
|
||||||
atx=get_atx_class(config.atx.type)(**config.atx._unpack(ignore=["type"])),
|
atx=get_atx_class(config.atx.type)(**config.atx._unpack(ignore=["type"])),
|
||||||
|
|||||||
@ -36,12 +36,12 @@ from ....validators.kvm import valid_stream_quality
|
|||||||
|
|
||||||
from ..streamer import Streamer
|
from ..streamer import Streamer
|
||||||
|
|
||||||
from ..tesseract import TesseractOcr
|
from ..ocr import Ocr
|
||||||
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
class StreamerApi:
|
class StreamerApi:
|
||||||
def __init__(self, streamer: Streamer, ocr: TesseractOcr) -> None:
|
def __init__(self, streamer: Streamer, ocr: Ocr) -> None:
|
||||||
self.__streamer = streamer
|
self.__streamer = streamer
|
||||||
self.__ocr = ocr
|
self.__ocr = ocr
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ _LANG_SUFFIX = ".traineddata"
|
|||||||
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
class TesseractOcr:
|
class Ocr:
|
||||||
def __init__(self, data_dir_path: str, default_langs: list[str]) -> None:
|
def __init__(self, data_dir_path: str, default_langs: list[str]) -> None:
|
||||||
self.__data_dir_path = data_dir_path
|
self.__data_dir_path = data_dir_path
|
||||||
self.__default_langs = default_langs
|
self.__default_langs = default_langs
|
||||||
@ -69,7 +69,7 @@ from .logreader import LogReader
|
|||||||
from .ugpio import UserGpio
|
from .ugpio import UserGpio
|
||||||
from .streamer import Streamer
|
from .streamer import Streamer
|
||||||
from .snapshoter import Snapshoter
|
from .snapshoter import Snapshoter
|
||||||
from .tesseract import TesseractOcr
|
from .ocr import Ocr
|
||||||
|
|
||||||
from .api.auth import AuthApi
|
from .api.auth import AuthApi
|
||||||
from .api.auth import check_request_auth
|
from .api.auth import check_request_auth
|
||||||
@ -130,7 +130,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
|
|||||||
info_manager: InfoManager,
|
info_manager: InfoManager,
|
||||||
log_reader: (LogReader | None),
|
log_reader: (LogReader | None),
|
||||||
user_gpio: UserGpio,
|
user_gpio: UserGpio,
|
||||||
ocr: TesseractOcr,
|
ocr: Ocr,
|
||||||
|
|
||||||
hid: BaseHid,
|
hid: BaseHid,
|
||||||
atx: BaseAtx,
|
atx: BaseAtx,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user