mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-04 07:51:28 +03:00
Fixed youtube-dl test
This commit is contained in:
@@ -631,10 +631,11 @@ describe('youtube-dl', async function() {
|
|||||||
await youtubedl_api.checkForYoutubeDLUpdate();
|
await youtubedl_api.checkForYoutubeDLUpdate();
|
||||||
});
|
});
|
||||||
it('Check latest version', async function() {
|
it('Check latest version', async function() {
|
||||||
const latest_version = await youtubedl_api.checkForYoutubeDLUpdate();
|
const original_fork = config_api.getConfigItem('ytdl_default_downloader');
|
||||||
|
const latest_version = await youtubedl_api.getLatestUpdateVersion(original_fork);
|
||||||
const default_details_bin = fs.readJSONSync(CONSTS.DETAILS_BIN_PATH);
|
const default_details_bin = fs.readJSONSync(CONSTS.DETAILS_BIN_PATH);
|
||||||
assert(default_details_bin['version'] === CONSTS.OUTDATED_YOUTUBEDL_VERSION);
|
assert(default_details_bin[original_fork]['version'] === CONSTS.OUTDATED_YOUTUBEDL_VERSION);
|
||||||
assert(latest_version > default_details_bin['version']);
|
assert(latest_version > default_details_bin[original_fork]['version']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Update youtube-dl', async function() {
|
it('Update youtube-dl', async function() {
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ exports.checkForYoutubeDLUpdate = async () => {
|
|||||||
const current_version = current_app_details['version'];
|
const current_version = current_app_details['version'];
|
||||||
const current_fork = current_app_details['downloader'];
|
const current_fork = current_app_details['downloader'];
|
||||||
|
|
||||||
const latest_version = await getLatestUpdateVersion(selected_fork);
|
const latest_version = await exports.getLatestUpdateVersion(selected_fork);
|
||||||
// if the binary does not exist, or default_downloader doesn't match existing fork, or if the fork has been updated, redownload
|
// if the binary does not exist, or default_downloader doesn't match existing fork, or if the fork has been updated, redownload
|
||||||
// TODO: don't redownload if fork already exists
|
// TODO: don't redownload if fork already exists
|
||||||
if (!fs.existsSync(output_file_path) || current_fork !== selected_fork || !current_version || current_version !== latest_version) {
|
if (!fs.existsSync(output_file_path) || current_fork !== selected_fork || !current_version || current_version !== latest_version) {
|
||||||
@@ -124,7 +124,7 @@ async function downloadLatestYoutubeDLBinaryGeneric(youtubedl_fork, new_version,
|
|||||||
updateDetailsJSON(new_version, youtubedl_fork, output_path);
|
updateDetailsJSON(new_version, youtubedl_fork, output_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
const getLatestUpdateVersion = async (youtubedl_fork) => {
|
exports.getLatestUpdateVersion = async (youtubedl_fork) => {
|
||||||
const tags_url = exports.youtubedl_forks[youtubedl_fork]['tags_url'];
|
const tags_url = exports.youtubedl_forks[youtubedl_fork]['tags_url'];
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
fetch(tags_url, {method: 'Get'})
|
fetch(tags_url, {method: 'Get'})
|
||||||
|
|||||||
Reference in New Issue
Block a user