52 lines
2.3 KiB
C
52 lines
2.3 KiB
C
/* verify_fixes.c — 真机复验三修复中“数据层”两项(合并进一次运行,少请求)。
|
|
* 用与 App 相同的 core 函数:
|
|
* ① 小歌单(18206253175) detail→song_detail:期望 idn>0 且 song_detail rc=0 bn>0(修空的 c 转义)
|
|
* ② 大歌单(581857874) detail→song_detail 首批:期望 idn=256(不再 -11 FULL)且 song rc=0 bn=64
|
|
* 真实请求数:2 (small detail+song) + 2 (big detail+song) = 4。
|
|
*/
|
|
#include "ncm.h"
|
|
#include "ncm_api.h"
|
|
#include "ncm_common.h"
|
|
#include "ncm_http.h"
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
static ncm_ctx_t ncm_ctx;
|
|
|
|
static void run_chain(const char *pid, const char *label, int expect, int cap)
|
|
{
|
|
int64_t ids[256]; int idn = 0;
|
|
long t0 = (long)ncm_now_ms();
|
|
int rc = ncm_api_playlist_detail(ncm_ctx.device_id, ncm_ctx.cookie, pid,
|
|
NULL, 0, NULL, 0, ids, cap, &idn);
|
|
long dt = (long)ncm_now_ms() - t0;
|
|
printf("[%s] detail rc=%d elapsed_ms=%ld idn=%d ids[0]=%lld\n", label, rc, dt, idn, idn>0?(long long)ids[0]:-1);
|
|
ncm_song_t songs[256]; int outn = 0;
|
|
for (int off = 0; off < idn; off += 64) {
|
|
int batch = idn - off; if (batch > 64) batch = 64;
|
|
int bn = 0;
|
|
t0 = (long)ncm_now_ms();
|
|
rc = ncm_api_song_detail(ncm_ctx.device_id, ncm_ctx.cookie, &ids[off], batch, &songs[off], 256-off, &bn);
|
|
printf(" [%s] song off=%d batch=%d rc=%d elapsed_ms=%ld bn=%d\n", label, off, batch, rc, (long)ncm_now_ms()-t0, bn);
|
|
if (rc != NCM_OK) break;
|
|
outn += bn;
|
|
if (bn < batch) break;
|
|
}
|
|
printf(" [%s] RESULT song_count=%d (expect~%d)\n", label, outn, expect);
|
|
if (outn > 0) printf(" [%s] [0] %s / %s\n", label, songs[0].name, songs[0].art_name);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
const char *data_dir = argc > 1 ? argv[1] : "/usr/data/mnt/sd_0/MeowData/dev.player.ncm/data";
|
|
const char *cacert = argc > 2 ? argv[2] : "/usr/data/mnt/sd_0/MeowAPPs/dev.player.ncm/cacert.pem";
|
|
ncm_ctx_init(&ncm_ctx, data_dir);
|
|
printf("device_id=%s cookie_len=%zu\n", ncm_ctx.device_id, strlen(ncm_ctx.cookie));
|
|
ncm_http_set_verify_default(1, cacert);
|
|
|
|
run_chain("18206253175", "small(Docu/1)", 1, 256);
|
|
run_chain("581857874", "big(5191)", 256, 256);
|
|
printf("VERIFY DONE\n");
|
|
return 0;
|
|
}
|