Backend can kick off downloads without using deprecated node-youtube-dl library

Downloads can now be cancelled and better "paused"
This commit is contained in:
Isaac Abadi
2023-09-05 00:35:36 -04:00
parent 3fc1110fc1
commit ea43ea7121
9 changed files with 105 additions and 26 deletions

View File

@@ -64,7 +64,7 @@ async function getSubscriptionInfo(sub) {
}
}
const {parsed_output, err} = await youtubedl_api.runYoutubeDL(sub.url, downloadConfig);
const {parsed_output, err} = await youtubedl_api.runYoutubeDLMain(sub.url, downloadConfig);
if (err) {
logger.error(err.stderr);
return false;
@@ -226,7 +226,7 @@ exports.getVideosForSub = async (sub, user_uid = null) => {
// get videos
logger.verbose(`Subscription: getting list of videos to download for ${sub.name} with args: ${downloadConfig.join(',')}`);
const {parsed_output, err} = await youtubedl_api.runYoutubeDL(sub.url, downloadConfig);
const {parsed_output, err} = await youtubedl_api.runYoutubeDLMain(sub.url, downloadConfig);
updateSubscriptionProperty(sub, {downloading: false}, user_uid);
if (!parsed_output) {
logger.error('Subscription check failed!');
@@ -482,7 +482,7 @@ async function checkVideoIfBetterExists(file_obj, sub, user_uid) {
const metric_to_compare = sub.type === 'audio' ? 'abr' : 'height';
if (output[metric_to_compare] > file_obj[metric_to_compare]) {
// download new video as the simulated one is better
const {parsed_output, err} = await youtubedl_api.runYoutubeDL(sub.url, downloadConfig);
const {parsed_output, err} = await youtubedl_api.runYoutubeDLMain(sub.url, downloadConfig);
if (err) {
logger.verbose(`Failed to download better version of video ${file_obj['id']}`);
} else if (parsed_output) {