feat(ncm): 首页顶栏「已缓存」入口 + 已缓存列表页(歌名/歌手/实际档位/大小,点播/单曲删除/清空)
入口:首页 topbar 新增动作 3(MEOW_ICON_DOWNLOAD 位图,原「回播放页」顺延动作 4)→ push ACT_CACHE;左缘返回弹回首页(app.c 路由补齐 tap/swipe/touch/tick)。 列表页 app/ui/cache.c(对齐 queue.c 惯例:圆角卡/红 mini-vinyl/按压红条/当前播放行高亮): - 行 = 歌名 / 歌手 · 实际档位 · 大小;空态/页脚(N 首 · 合计 X MB)。 - 点行 = 点播(NCM_QUEUE_CACHE 队列,上/下一首在缓存列表内循环);行右「删除」=单曲删除; 顶栏「清空」=确认框 + ncm_cache_clear(与设置页「清理缓存」同语义)。 - 数据全在 worker:cache_reload → appstate_cache_list_load → ncm_cache_scan(读目录 + 文件内 tag + 音频头探测)→ 快照;UI 线程零磁盘 IO。快照上限 512 条(最近访问优先, ≈116KB bss),更多条目按 mtime 保留最近的。 core: - ncm_cache_scan / ncm_cache_remove(songs/ 池,song_<id>_<请求档>.<实际格式> 解析, 跳过 .tmp/.part 与非数字 id;按 mtime 降序;历史双点名删除兜底)。 - ncm_api_level_from_key(缓存键后缀 ↔ 档位枚举,与 ncm_api_level_key 互逆)。 - **档位显示实际档而非请求档**:真机存在 song_171650_hires.mp3(无损请求被降级链落到 exhigh mp3),故 scan 用 ncm_audio_probe_file 读实际容器参数后只降不升地推断 (FLAC 16bit→无损 / 24bit→Hi-Res+,MP3 ≤128k→标准 / >128k→极高)。 播放:player_manager 对 NCM_QUEUE_CACHE 用条目真实键(id+请求档+实际扩展名)直读缓存 文件,不按用户当前档键重下;song_local_file/play_is_same_song/queue 页均支持第三种队列。 宿主 mock(NCM_PAGE=cache)造 3 条缓存 + 嵌入 tag + 同步扫描。
This commit is contained in:
1 parent
184ebd0ac9
commit
f392ee5c48
16 files changed
+829
-18
No files matched your search
@@ -24,7 +24,7 @@ volatile int g_net_ready = 0;
|
||||
int g_host_mock = 0;
|
||||
|
||||
static meow_view *g_login_view, *g_home_view, *g_pl_view, *g_plr_view, *g_set_view,
|
||||
*g_search_view, *g_queue_view;
|
||||
*g_search_view, *g_queue_view, *g_cache_view;
|
||||
|
||||
static void on_sigterm(int s) { (void)s; meow_ui_request_exit(); }
|
||||
|
||||
@@ -93,6 +93,7 @@ static void app_on_tap(int x, int y)
|
||||
if (settings_is_active()) { settings_on_tap(x, y); return; }
|
||||
if (playlist_is_active()) { playlist_on_tap(x, y); return; }
|
||||
if (queue_is_active()) { queue_on_tap(x, y); return; }
|
||||
if (cache_is_active()) { cache_on_tap(x, y); return; }
|
||||
if (search_is_active()) { search_on_tap(x, y); return; }
|
||||
home_on_tap(x, y);
|
||||
}
|
||||
@@ -107,6 +108,7 @@ static void app_on_swipe(int dir, int dx, int dy)
|
||||
if (settings_is_active()) { meow_view_page_pop(); return; }
|
||||
if (playlist_is_active()) { meow_view_page_pop(); return; }
|
||||
if (queue_is_active()) { meow_view_page_pop(); return; }
|
||||
if (cache_is_active()) { meow_view_page_pop(); return; }
|
||||
if (search_is_active()) { meow_view_page_pop(); return; }
|
||||
if (home_is_active()) {
|
||||
/* 任务2:home 根页左滑不再退出进程 → 请求 launcher 退到桌面/后台(进程+媒体会话保留)。
|
||||
@@ -124,6 +126,7 @@ static void app_on_swipe(int dir, int dx, int dy)
|
||||
if (home_is_active()) { home_swipe(dir, dy); return; }
|
||||
if (playlist_is_active()) { playlist_swipe(dir, dy); return; }
|
||||
if (queue_is_active()) { queue_swipe(dir, dy); return; }
|
||||
if (cache_is_active()) { cache_swipe(dir, dy); return; }
|
||||
if (search_is_active()) { search_swipe(dir, dy); return; }
|
||||
if (player_is_active()) { player_on_swipe(dir, dy); return; }
|
||||
}
|
||||
@@ -134,6 +137,7 @@ static void app_on_touch_down(int x, int y)
|
||||
else if (home_is_active()) home_touch_down(x, y);
|
||||
else if (playlist_is_active()) playlist_touch_down(x, y);
|
||||
else if (queue_is_active()) queue_touch_down(x, y);
|
||||
else if (cache_is_active()) cache_touch_down(x, y);
|
||||
else if (settings_is_active()) settings_touch_down(x, y);
|
||||
else if (search_is_active()) search_touch_down(x, y);
|
||||
}
|
||||
@@ -144,6 +148,7 @@ static void app_on_touch_move(int x, int y)
|
||||
else if (home_is_active()) home_touch_move(x, y);
|
||||
else if (playlist_is_active()) playlist_touch_move(x, y);
|
||||
else if (queue_is_active()) queue_touch_move(x, y);
|
||||
else if (cache_is_active()) cache_touch_move(x, y);
|
||||
else if (settings_is_active()) settings_touch_move(x, y);
|
||||
else if (search_is_active()) search_touch_move(x, y);
|
||||
}
|
||||
@@ -194,6 +199,7 @@ static void app_on_tick(void)
|
||||
if (player_is_active()) { player_tick(now); return; }
|
||||
if (search_is_active()) { search_tick(now); return; }
|
||||
if (queue_is_active()) { queue_tick(now); return; }
|
||||
if (cache_is_active()) { cache_tick(now); return; }
|
||||
if (home_is_active()) { home_tick(now); }
|
||||
if (playlist_is_active()) { playlist_tick(now); }
|
||||
chrome_tick();
|
||||
@@ -233,6 +239,7 @@ int main(void)
|
||||
g_set_view = settings_view_create();
|
||||
g_search_view = search_view_create();
|
||||
g_queue_view = queue_view_create(); /* §NEW 当前播放队列页 */
|
||||
g_cache_view = cache_view_create(); /* M5 已缓存列表页 */
|
||||
mini_bar_init(); /* mini 播放栏:登记跨 Activity 绘制物(进 root 页前,首帧即参与重画) */
|
||||
|
||||
/* 进入根页:已登录→home,否则→login */
|
||||
@@ -256,6 +263,7 @@ int main(void)
|
||||
meow_view_free(g_login_view);
|
||||
meow_view_free(g_search_view);
|
||||
meow_view_free(g_queue_view);
|
||||
meow_view_free(g_cache_view);
|
||||
meow_ui_shutdown();
|
||||
meow_log(MEOW_LOG_INFO, "exit");
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user