(program, filePath, timeout = 6000, githubAnd8 = 0)
| 12 | } |
| 13 | |
| 14 | async 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("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """).replaceAll("'", "'"); |
| 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 | |
| 41 | async function updatePlaybackDataByCntv(program, filePath, timeout = 6000, githubAnd8 = 0) { |
| 42 | // 今日节目数据 |
no test coverage detected