This repository has been archived on 2026-10-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
snowy-yang
be4dd0646a
refactor: /download 同步分支拆解(120 行 / 圈 19 → 78 行 / 圈 14)
为什么:单曲下载提交入口的 format=json 同步分支内嵌了完整事务
(取信息 → 下载 → 组响应 → 结算/退款,40 行),与参数校验、后台任务
登记混在一个函数里;可选参数解析 5 行两模式共用却内联两处。
拆出:
- _parse_download_options:两模式共用的可选参数解析(lyric_format
非法静默回退 lrc 的历史口径保留)
- _sync_download_json:同步下载事务整体——任一步失败退预扣(账本
守恒),只有成功才 settle(1, 'delivered'),docstring 写明语义
先写测试后动代码:新增 tests/test_download_sync.py 5 例,在未改动
实现上跑绿(修正 1 例预期:默认 filename_format=artist_song 产出
「歌手 - 歌名.mp3」),覆盖此前零测试的 json 同步分支——成功结算
余额恰 -1、取信息失败 404 退款、下载失败/异常退款、空 ID 专属文案。
门禁:ruff 全过 · pyright 0/0 · pytest 375 passed(370→375)。
2026-09-27 11:11:56 +08:00
..
2026-09-26 00:17:56 +08:00
2026-09-26 12:37:48 +08:00
2026-09-26 18:54:17 +08:00
2026-09-26 15:03:47 +08:00
2026-09-26 12:37:48 +08:00
2026-09-27 10:13:36 +08:00
2026-09-26 12:37:48 +08:00
2026-09-27 11:11:56 +08:00
2026-09-26 12:37:48 +08:00
2026-09-27 07:41:16 +08:00
2026-09-26 15:03:47 +08:00
2026-09-27 10:05:20 +08:00
2026-09-26 12:37:48 +08:00
2026-09-26 12:37:48 +08:00
2026-09-26 12:37:48 +08:00
2026-09-26 18:54:04 +08:00
2026-09-26 15:03:47 +08:00