Skip to content

The only downloader you need. 下载器的集大成者。

refactor(android): Python 和 Kotlin 两侧统一叫 Bridge

XiaoYouChR48c8044dbaee
diff --git a/features/bili_pack/android.py b/features/bili_pack/android.py
index dd36f69b..6331fa4e 100644
--- a/features/bili_pack/android.py
+++ b/features/bili_pack/android.py
@@ -49,7 +49,7 @@ def init(pack) -> dict:
return {"accountState": _account.accountChanged, "qrState": _account.qrStateChanged}
-# ---- task/draft serialization (called by engine.py internally) ----
+# ---- task/draft serialization (called by bridge.py internally) ----
def taskFields(task) -> dict:
return {
@@ -125,7 +125,7 @@ def draftFields(task) -> dict:
}
-# ---- draft mutations (called by engine.py setDraft dispatcher) ----
+# ---- draft mutations (called by bridge.py setDraft dispatcher) ----
def setControl(task, controlId: str, value: str):
if controlId == "video":
diff --git a/tests/conftest.py b/tests/conftest.py
index 380610c0..c1d5544f 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -6,12 +6,12 @@ import sys
import pytest
from aiohttp import web
-from tests.helpers import loadEngine
+from tests.helpers import loadBridge
@pytest.fixture(scope="module")
def bridge():
- return loadEngine()
+ return loadBridge()
@pytest.fixture
diff --git a/tests/helpers.py b/tests/helpers.py
index ba8b12d6..f1635ea8 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -7,7 +7,7 @@ from types import ModuleType
from aiohttp import web
-ENGINE_PATH = Path(__file__).parents[1] / "android/app/src/main/python/engine.py"
+BRIDGE_PATH = Path(__file__).parents[1] / "android/app/src/main/python/bridge.py"
class StubFlows:
@@ -21,12 +21,12 @@ class StubFlows:
pass
-def loadEngine():
+def loadBridge():
stub = ModuleType("app.platform.file_watcher")
stub.InotifyFileWatcher = object
sys.modules["app.platform.file_watcher"] = stub
- spec = importlib.util.spec_from_file_location("android_engine", ENGINE_PATH)
+ spec = importlib.util.spec_from_file_location("android_bridge", BRIDGE_PATH)
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
diff --git a/tests/test_android_speed_meter.py b/tests/test_android_speed_meter.py
index d8780911..731739be 100644
--- a/tests/test_android_speed_meter.py
+++ b/tests/test_android_speed_meter.py
@@ -1,4 +1,4 @@
-"""engine.py 何时让 SpeedMeter 走表:它驱动 taskProgress 推送,做种时也要走。"""
+"""bridge.py 何时让 SpeedMeter 走表:它驱动 taskProgress 推送,做种时也要走。"""
from tests.test_task_service import finishRun, makeSeedTask, makeTask, service # noqa: F401