1
1
mirror of https://github.com/neosubhamoy/pytubepp-helper.git synced 2026-02-04 11:22:22 +05:30

(feat): now pytubepp helper can install required packages via install buttons using winget and pip

This commit is contained in:
2024-08-29 13:13:32 +05:30
Unverified
parent 1368f07bfe
commit 6bf52dd27e
9 changed files with 196 additions and 26 deletions

View File

@@ -59,7 +59,10 @@ export function extract_version(output: string): string | null {
/ffmpeg version (\d+\.\d+)/, // Pattern for ffmpeg
/Python (\d+\.\d+\.\d+)/, // Pattern for Python
/pytubefix (\d+\.\d+\.\d+)/, // Pattern for pytubefix
/pytubepp (\d+\.\d+\.\d+)/ // Pattern for pytubepp
/pytubepp (\d+\.\d+\.\d+)/, // Pattern for pytubepp
/v(\d+\.\d+\.\d+)/, // Pattern for winget
/pip (\d+\.\d+)/, // Pattern for pip
];
for (const pattern of versionPatterns) {
const match = output.match(pattern);
@@ -94,4 +97,16 @@ export async function sendStreamInfo(url: string) {
};
fetchData();
}
}
export function compareVersions (v1: string, v2: string) {
const parts1 = v1.split('.').map(Number);
const parts2 = v2.split('.').map(Number);
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
const part1 = parts1[i] || 0;
const part2 = parts2[i] || 0;
if (part1 > part2) return 1;
if (part1 < part2) return -1;
}
return 0;
};