feat(ncm): 缓存分目录(songs//covers/)+ 陈旧 mp3 缓存修复
任务1 缓存分目录(用户定案):\n- ncm_cache_init mkdir songs/ 与 covers/ 子目录 + 一次性迁移\n (根混放 song_*/cov*/cover_current.jpg 挪进两子目录,幂等,legacy_migrated 计数)\n- ncm_cache_path 按 id 前缀路由(cov*→covers/,其余→songs/)\n- LRU(evict/total_bytes/7天 .part 回收)只扫 songs/;clear 清 songs/+covers/ 的 song_*\n- cover.c save_cover_raw 落 covers/cover_current.jpg\n\n任务2 陈旧 mp3 缓存修复(真机实锤:hires 档键下存 mp3,播放命中旧档):\n- song_local_file 缓存命中且用户档>EXHIGH(无损+)且实体是 .mp3 = 静默降级产物\n → 迁移重命名到 exhigh 键 song_<id>_exhigh.mp3(选极高仍可用;目标已存在删旧)\n → 本档视为未命中走下载(311 flac 门禁拿真无损/正确降级)\n\n验证:cache_evict_sim case10(目录迁移一次成型)+P1-9;player_flow_sim P13(迁移+miss)\n+P1-12 零回归;stream/window/search/degrade/cover_chain/test_ncm_core(host+qemu) 全 PASS;\nbuild_ncm.sh -Wall -Wextra 0 warning。0 真实请求。新 ncm md5 a90ba8c3 (text1028458/bss1364484)。
This commit is contained in:
1 parent
986e3814bc
commit
de18cef02c
11 files changed
+299
-64
No files matched your search
@@ -108,13 +108,13 @@ static void test_cache(void) {
|
||||
printf("== cache ==\n");
|
||||
ncm_cache_t c;
|
||||
char dir[] = "/tmp/ncm_cache_test";
|
||||
ncm_cache_init(&c, dir);
|
||||
/* 清空目录 */
|
||||
/* 清空目录(须在 init 前:init 会建 songs/covers 子目录,rm -rf 会一并删掉) */
|
||||
{
|
||||
char cmd[128];
|
||||
snprintf(cmd, sizeof cmd, "rm -rf %s; mkdir -p %s", dir, dir);
|
||||
if (system(cmd) != 0) { /* best-effort */ }
|
||||
}
|
||||
ncm_cache_init(&c, dir); /* 建根 + songs/ + covers/ + 一次性迁移 */
|
||||
/* miss */
|
||||
char path[NCM_CACHE_DIR_MAX + 32];
|
||||
int mrc = ncm_cache_lookup(&c, "1", "mp3", path, sizeof path);
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user