* @param {Number} hours - 更新小时数
(hours)
| 190 | * @param {Number} hours - 更新小时数 |
| 191 | */ |
| 192 | async function update(hours) { |
| 193 | // 处理忽略列表 |
| 194 | if (ignoreCategory != null) { |
| 195 | if (ignoreCategory.indexOf(",") !== -1) { |
| 196 | const ignoreCategorySplit = ignoreCategory.split(",") |
| 197 | for (const categoryString of ignoreCategorySplit) { |
| 198 | if (categoryString != "") { |
| 199 | if (!ignoreCategorySet.has(categoryString)) { |
| 200 | ignoreCategorySet.add(categoryString) |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | } else if (ignoreCategory.indexOf(",") !== -1) { |
| 205 | const ignoreCategorySplit = ignoreCategory.split(",") |
| 206 | for (const categoryString of ignoreCategorySplit) { |
| 207 | if (categoryString != "") { |
| 208 | if (!ignoreCategorySet.has(categoryString)) { |
| 209 | ignoreCategorySet.add(categoryString) |
| 210 | } |
| 211 | } |
| 212 | } |
| 213 | } else { |
| 214 | ignoreCategorySet.add(ignoreCategory) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | if (!(hours % 720)) { |
| 219 | // 每720小时(一个月)刷新token |
| 220 | if (userId && token) { |
| 221 | if (mrefreshToken) { |
| 222 | await refreshToken(userId, token) ? printGreen("token刷新成功") : printRed("token刷新失败") |
| 223 | } else { |
| 224 | printGreen(`跳过token刷新`) |
| 225 | } |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | // 未设置TV |
| 230 | if (ignoreCategorySet.has("TV")) { |
| 231 | printYellow(`TV更新已屏蔽`) |
| 232 | } else { |
| 233 | await updateTV(hours) |
| 234 | } |
| 235 | // 未设置PE |
| 236 | if (ignoreCategorySet.has("PE")) { |
| 237 | printYellow(`PE更新已屏蔽`) |
| 238 | } else { |
| 239 | await updatePE(hours) |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | export default update |
no test coverage detected