Skip to content

Commit a6e6bcd

Browse files
committed
2 parents 109c05d + ad17f8b commit a6e6bcd

File tree

10 files changed

+13
-94
lines changed

10 files changed

+13
-94
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
<div align="center">
22

3-
<picture>
4-
<source media="(prefers-color-scheme: dark)" srcset="https://d.kstore.space/download/7507/logo_dark.svg">
5-
<source media="(prefers-color-scheme: light)" srcset="https://d.kstore.space/download/7507/logo_light.svg">
6-
<img alt="logo" src="https://d.kstore.space/download/7507/logo_light.svg" height=400>
7-
</picture>
3+
![](https://7507.kstore.space/logo-full.svg?password=44d43eb4b2becd5f936b1c8a3c97df9d-1714584375234)
84

95
# OpenBMCLAPI for Python
106

config/config.yml.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
advanced:
22
auto_update: false
3+
copy_from_other_storage: true
34
debug: false
45
download_threads: 64
56
file_check_mode: size

core/cluster.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from core import certificate, dashboard, unit
2525
from core import scheduler
2626
import pyzstd as zstd
27-
from core.timings import logTqdm, logTqdmType
2827
import core.utils as utils
2928
import core.stats as stats
3029
import core.web as web
@@ -280,7 +279,7 @@ async def download(self, miss: list[BMCLAPIFile]):
280279
unit_divisor=1024,
281280
total=sum((file.size for file in miss)),
282281
unit_scale=True,
283-
) as pbar, logTqdm(pbar, logTqdmType.BYTES):
282+
) as pbar:
284283
await dashboard.set_status_by_tqdm("files.downloading", pbar)
285284
for file in miss:
286285
await self.queues.put(file)
@@ -344,7 +343,7 @@ async def __call__(
344343
total=len(files) * len(storages.get_storages()),
345344
unit=locale.t("cluster.tqdm.unit.file"),
346345
unit_scale=True,
347-
) as pbar, logTqdm(pbar):
346+
) as pbar:
348347
self.pbar = pbar
349348
self.files = files
350349
await dashboard.set_status_by_tqdm("files.checking", pbar)
@@ -379,7 +378,7 @@ async def __call__(
379378
):
380379
missing_files_by_storage[storage].add((file, index_storage))
381380
total_missing_bytes += file.size
382-
if total_missing_bytes != 0 and len(g_storage) >= 2 and FROM_OTHER_STORAGE_COPY:
381+
if total_missing_bytes != 0 and len(g_storage) >= 2 and COPY_FROM_OTHER_STORAGE:
383382
with tqdm(
384383
total=total_missing_bytes,
385384
desc=locale.t(
@@ -388,7 +387,7 @@ async def __call__(
388387
unit="B",
389388
unit_divisor=1024,
390389
unit_scale=True,
391-
) as pbar, logTqdm(pbar, logTqdmType.BYTES):
390+
) as pbar:
392391
await dashboard.set_status_by_tqdm("files.copying", pbar)
393392
removes: defaultdict[Storage, set[tuple[BMCLAPIFile, int]]] = (
394393
defaultdict(set)
@@ -452,7 +451,7 @@ async def __call__(
452451
desc=locale.t("cluster.tqdm.desc.delete_old_files"),
453452
unit=locale.t("cluster.tqdm.unit.file"),
454453
unit_scale=True,
455-
) as pbar, logTqdm(pbar):
454+
) as pbar:
456455
await dashboard.set_status_by_tqdm("files.delete_old", pbar)
457456
for storage, filelist in more_files.items():
458457
removed = await storage.removes(filelist)
@@ -789,7 +788,7 @@ def stop(tqdm: Optional[tqdm] = None):
789788
with tqdm(
790789
total=len(dirs),
791790
desc=f"[WebDav List Files <endpoint: '{self._download_endpoint()}'>]",
792-
) as pbar, logTqdm(pbar):
791+
) as pbar:
793792
await dashboard.set_status_by_tqdm("storage.webdav", pbar)
794793
r = await self._execute(self.session.list(self._download_endpoint()))
795794
if r is asyncio.CancelledError:

core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"advanced.debug": False,
3939
"advanced.language": "zh_cn",
4040
"advanced.auto_update": False,
41-
"advanced.from_other_storage_copy": True,
41+
"advanced.copy_from_other_storage": True,
4242
"dashboard.username": "admin",
4343
"dashboard.websocket": True,
4444
"dashboard.password": "".join(

core/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
MAX_INSTANCES: int = 9999
123123
AUTO_DOWNLOAD_RELEASE: bool = Config.get("update.auto_download")
124124
CERTIFICATE: 'Certificate' = None
125-
FROM_OTHER_STORAGE_COPY: bool = Config.get("advanced.from_other_storage_copy")
125+
COPY_FROM_OTHER_STORAGE: bool = Config.get("advanced.copy_from_another_storage")
126126

127127
@dataclass
128128
class StorageParse:

core/stats.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import pyzstd as zstd
99
from tqdm import tqdm
1010

11-
from core.timings import timing
1211
from core.utils import (
1312
DataInputStream,
1413
DataOutputStream,

core/timings.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

core/update.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
from core import dashboard, logger, scheduler
77
from core.const import AUTO_DOWNLOAD_RELEASE, IO_BUFFER, VERSION
8-
from core.timings import logTqdm, logTqdmType
98

109

1110
github_api = "https://api.github.com"
@@ -55,7 +54,7 @@ async def download():
5554
async with session.get(download_url) as resp:
5655
length = int(resp.headers.get("Content-Length") or 0)
5756
filename = f"{fetched_version}.zip"
58-
with tqdm(total=length, desc="Download Release", unit="b", unit_divisor=1024, unit_scale=True) as pbar, logTqdm(pbar, logTqdmType.BYTES), open(f"./releases/{filename}", "wb") as w:
57+
with tqdm(total=length, desc="Download Release", unit="b", unit_divisor=1024, unit_scale=True) as pbar, open(f"./releases/{filename}", "wb") as w:
5958
while (data := await resp.content.read(IO_BUFFER)):
6059
pbar.update(len(data))
6160
w.write(data)

i18n/zh_cn.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,5 @@
7878
"core.info.shutting_down_web_service": "正在关闭 Web 服务……",
7979
"stats.error.broken_stats": "统计信息已损坏……",
8080
"system.info.loading": "正在初始化系统信息统计……",
81-
"timings.info.finished": "任务 $desc 已完成,耗时 $time($count / $total)"
81+
"timings.info.finished": "任务已完成,耗时$time。"
8282
}

installer/installer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if [ "$(id -u)" -ne 0 ]; then
55
echo -e "\e[31mERROR: Not root user\e[0m"
66
exit 1
77
fi
8-
MIRROR_PREFIX="https://mirror.ghproxy.com/"
8+
MIRROR_PREFIX="https://ghproxy.bugungu.top/"
99
echo "MIRROR_PREFIX=${MIRROR_PREFIX}"
1010

1111
REPO='TTB-Network/python-openbmclapi'

0 commit comments

Comments
 (0)