Added max concurrent downloads setting

Fixed issue where navigating to a subscription video would make the player behave like a playlist for the whole sub
This commit is contained in:
Isaac Abadi
2021-09-15 09:44:31 -06:00
parent dbefb66021
commit 775a1766d8
8 changed files with 18 additions and 7 deletions

View File

@@ -779,7 +779,9 @@ async function autoUpdateYoutubeDL() {
})
.catch(err => {
logger.error(`Failed to check ${default_downloader} version for an update.`)
logger.error(err)
logger.error(err);
resolve(false);
return false;
});
});
}

View File

@@ -13,6 +13,7 @@
"safe_download_override": false,
"include_thumbnail": true,
"include_metadata": true,
"max_concurrent_downloads": 5,
"download_rate_limit": ""
},
"Extra": {

View File

@@ -188,6 +188,7 @@ const DEFAULT_CONFIG = {
"safe_download_override": false,
"include_thumbnail": true,
"include_metadata": true,
"max_concurrent_downloads": 5,
"download_rate_limit": ""
},
"Extra": {

View File

@@ -42,6 +42,10 @@ exports.CONFIG_ITEMS = {
'key': 'ytdl_include_metadata',
'path': 'YoutubeDLMaterial.Downloader.include_metadata'
},
'ytdl_max_concurrent_downloads': {
'key': 'ytdl_max_concurrent_downloads',
'path': 'YoutubeDLMaterial.Downloader.max_concurrent_downloads'
},
'ytdl_download_rate_limit': {
'key': 'ytdl_download_rate_limit',
'path': 'YoutubeDLMaterial.Downloader.download_rate_limit'

View File

@@ -156,7 +156,8 @@ async function checkDownloads() {
const waiting_downloads = downloads.filter(download => !download['paused'] && download['finished_step'] && !download['finished']);
for (let i = 0; i < waiting_downloads.length; i++) {
const waiting_download = waiting_downloads[i];
if (running_downloads_count >= 5/*config_api.getConfigItem('ytdl_max_concurrent_downloads')*/) break;
const max_concurrent_downloads = config_api.getConfigItem('ytdl_max_concurrent_downloads');
if (max_concurrent_downloads < 0 || running_downloads_count >= max_concurrent_downloads) break;
if (waiting_download['finished_step'] && !waiting_download['finished']) {
// move to next step