(hours: number = 24)
| 1762 | const depsInstalled = await DependencyManager.checkAndInstallDependencies(); |
| 1763 | if (!depsInstalled) { |
| 1764 | console.error("[music] 依赖安装失败"); |
| 1765 | } |
| 1766 | |
| 1767 | // 检查 yt-dlp |
| 1768 | const ytdlpAvailable = await DependencyManager.checkYtDlp(); |
| 1769 | if (!ytdlpAvailable) { |
| 1770 | console.warn("[music] yt-dlp 未安装,请手动安装: sudo pip install --upgrade --force-reinstall yt-dlp --break-system-packages"); |
| 1771 | } else { |
| 1772 | // 尝试自动更新yt-dlp到最新版本 |
| 1773 | try { |
| 1774 | console.log("[music] 正在检查yt-dlp更新..."); |
| 1775 | const { stdout } = await execFileAsync('yt-dlp', ['-U']); |
| 1776 | if (stdout.includes("up to date")) { |
| 1777 | console.log("[music] yt-dlp已是最新版本"); |
| 1778 | } else if (stdout.includes("Updated")) { |
| 1779 | console.log("[music] yt-dlp已更新到最新版本"); |
| 1780 | } |
| 1781 | } catch (error) { |
| 1782 | console.log("[music] 无法自动更新yt-dlp,请手动更新: yt-dlp -U"); |
| 1783 | } |
| 1784 | } |
| 1785 |
no test coverage detected