The only downloader you need. 下载器的集大成者。
TypeScript asyncasynciobittorentbtcross-platformdownload-managerdownloaderfluent-designftphttp3magnetpyqtpyside6pythonqtquicreactsoftwarestreaming
feat(android): 上传 Compose UI 模块
XiaoYouChR10e18fdbd026
diff --git a/.python-version b/.python-versiondeleted file mode 100644index 24ee5b1b..00000000--- a/.python-version+++ /dev/null@@ -1 +0,0 @@-3.13diff --git a/features/bittorrent_pack/android.py b/features/bittorrent_pack/android.pyindex c2cba22b..ccdf5bb7 100644--- a/features/bittorrent_pack/android.py+++ b/features/bittorrent_pack/android.py@@ -1,12 +1,30 @@"""Android View adapter for BittorrentPack."""+from app.i18n import N++UI_CLASS = "com.xychr.ghostdownloader.packs.BitTorrentUi"++STATE_TEXT = {+ "checking_files": N("TaskState", "校验已有文件"),+ "checking_resume_data": N("TaskState", "检查续传状态"),+ "downloading_metadata": N("TaskState", "获取元数据"),+ "allocating": N("TaskState", "分配文件中"),+ "queued_for_checking": N("TaskState", "等待校验"),+ "seeding": N("TaskState", "做种中"),+ "paused_seeding": N("TaskState", "暂停做种"),+}def taskFields(task) -> dict:return {- "upload": task.uploadRate,- "peers": {"active": task.peerCount, "total": task.totalPeerCount},- "isSeeding": task.isSeeding,- "seedingSeconds": task.seedingTimeSeconds,- "shareRatio": task.shareRatioPercent,- "stateText": task.stateText,+ "progressMode": "hidden" if task.isSeeding else "determinate",+ "statusText": STATE_TEXT.get(task.stateText, ""),+ "secondarySpeed": task.uploadRate,+ "canStop": task.isSeeding,+ "canPause": not task.isSeeding,+ "packFields": {+ "peers": {"active": task.peerCount, "total": task.totalPeerCount},+ "shareRatio": task.shareRatioPercent,+ "seedingSeconds": task.seedingTimeSeconds,+ "uploadSpeed": task.uploadRate,+ },}diff --git a/features/ed2k_pack/android.py b/features/ed2k_pack/android.pyindex 26ee2729..618bd5e1 100644--- a/features/ed2k_pack/android.py+++ b/features/ed2k_pack/android.py@@ -1,14 +1,21 @@"""Android View adapter for ED2kPack."""+from app.i18n import N++UI_CLASS = "com.xychr.ghostdownloader.packs.Ed2kUi"def taskFields(task) -> dict:active = task.activePeerCountreturn {- "upload": task.uploadRate,- "peers": None if active is None else {- "active": active, "total": max(active, task.totalPeerCount),+ "progressMode": "hidden" if task.isSharing else "determinate",+ "statusText": N("TaskState", "共享中") if task.isSharing else "",+ "secondarySpeed": task.uploadRate,+ "canPause": not task.isSharing,+ "packFields": {+ "peers": None if active is None else {+ "active": active, "total": max(active, task.totalPeerCount),+ },+ "seedingSeconds": task.sharingTimeSeconds,+ "uploadSpeed": task.uploadRate,},- "isSeeding": task.isSharing,- "seedingSeconds": task.sharingTimeSeconds,- "stateText": "sharing" if task.isSharing else "",}diff --git a/scripts/sync_i18n_res.py b/scripts/sync_i18n_res.pyindex 10f55ec9..5bcda918 100644--- a/scripts/sync_i18n_res.py+++ b/scripts/sync_i18n_res.py@@ -23,17 +23,17 @@ I18N_DIR = ASSETS_DIR / "i18n"QRC_PATH = ASSETS_DIR / "resources.qrc"RESOURCES_RCC = ASSETS_DIR / "resources.rcc"-ENGINE_CONTEXTS = ["TaskErrors", "BinaryRuntime"]+ENGINE_CONTEXTS = ["TaskErrors", "BinaryRuntime", "TaskState"]COMPOSE_RES_DIR = REPO / "compose" / "app" / "src" / "main" / "res"COMPOSE_I18N_KT = (- REPO / "compose" / "app" / "src" / "main" / "java" / "io" / "github"- / "xiaoyouchr" / "ghostdownloader" / "i18n" / "EngineStrings.kt"+ REPO / "compose" / "app" / "src" / "main" / "java" / "com" / "xychr"+ / "ghostdownloader" / "i18n" / "EngineStrings.kt")ANDROID_STRINGS_FILE = "strings_engine.xml"ANDROID_LOCALE_FOLDERS = {- "en_US": "values",- "zh_CN": "values-zh-rCN",+ "zh_CN": "values",+ "en_US": "values-en","zh_TW": "values-zh-rTW","zh_HK": "values-zh-rHK","ja_JP": "values-ja",@@ -116,7 +116,9 @@ def readCatalog(locale: str) -> dict[str, tuple[str, str]]:node = message.find("translation")if locale == "zh_CN":text = source- elif node is None or node.get("type") == "unfinished":+ elif node is None or node.get("type"):+ # 只收 finished(无 type 属性)。vanished / obsolete 是源文案已删除,+ # 留着会变成默认语言没有的孤儿 string,lint 的 ExtraTranslation 报错continueelse:text = (node.text or "").strip()@@ -140,8 +142,6 @@ def buildAndroidStrings() -> None:for locale, folder in ANDROID_LOCALE_FOLDERS.items():entries = readCatalog(locale)- if locale == "en_US":- entries = {name: entries.get(name, source[name]) for name in source}if not entries:continuetarget = COMPOSE_RES_DIR / folder@@ -161,9 +161,9 @@ def buildAndroidStrings() -> None:COMPOSE_I18N_KT.parent.mkdir(parents=True, exist_ok=True)ktLines = ["// Generated by scripts/sync_i18n_res.py",- "package io.github.xiaoyouchr.ghostdownloader.i18n",+ "package com.xychr.ghostdownloader.i18n","",- "import io.github.xiaoyouchr.ghostdownloader.R",+ "import com.xychr.ghostdownloader.R","","internal val engineStrings: Map<String, Int> = mapOf(",]