MCPcopy Create free account
hub / github.com/develop202/migu_video / updatePlaybackDataByMigu

Function updatePlaybackDataByMigu

utils/playback.js:14–39  ·  view source on GitHub ↗
(program, filePath, timeout = 6000, githubAnd8 = 0)

Source from the content-addressed store, hash-verified

12}
13
14async function updatePlaybackDataByMigu(program, filePath, timeout = 6000, githubAnd8 = 0) {
15 // 今日节目数据
16 const playbackData = await getPlaybackData(program.pID, timeout, githubAnd8)
17 if (!playbackData) {
18 return false
19 }
20 // 写入频道信息
21 appendFileSync(filePath,
22 ` <channel id="${program.name}">\n` +
23 ` <display-name lang="zh">${program.name}</display-name>\n` +
24 ` </channel>\n`
25 )
26
27 // 写入节目信息
28 for (let i = 0; i < playbackData.length; i++) {
29 // 特殊字符转义
30 const contName = playbackData[i].contName.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;").replaceAll("'", "&apos;");
31
32 appendFileSync(filePath,
33 ` <programme channel="${program.name}" start="${getDateTimeString(new Date(playbackData[i].startTime + githubAnd8))} +0800" stop="${getDateTimeString(new Date(playbackData[i].endTime + githubAnd8))} +0800">\n` +
34 ` <title lang="zh">${contName}</title>\n` +
35 ` </programme>\n`
36 )
37 }
38 return true
39}
40
41async function updatePlaybackDataByCntv(program, filePath, timeout = 6000, githubAnd8 = 0) {
42 // 今日节目数据

Callers 1

updatePlaybackDataFunction · 0.85

Calls 3

appendFileSyncFunction · 0.90
getDateTimeStringFunction · 0.90
getPlaybackDataFunction · 0.85

Tested by

no test coverage detected