mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-11 19:11:29 +03:00
Added preliminary support for updating YoutubeDL-Material
Config items that are not found use and set the default value Fixed potential error while updated youtube-dl binaries
This commit is contained in:
@@ -68,10 +68,16 @@ function setConfigFile(config) {
|
||||
function getConfigItem(key) {
|
||||
let config_json = getConfigFile();
|
||||
if (!CONFIG_ITEMS[key]) {
|
||||
console.log('cannot find config with key ' + key);
|
||||
console.log(`ERROR: Config item with key '${key}' is not recognized.`);
|
||||
return null;
|
||||
}
|
||||
let path = CONFIG_ITEMS[key]['path'];
|
||||
const val = Object.byString(config_json, path);
|
||||
if (val === undefined && Object.byString(DEFAULT_CONFIG, path)) {
|
||||
console.log(`WARNING: Cannot find config with key '${key}'. Creating one with the default value...`);
|
||||
setConfigItem(key, Object.byString(DEFAULT_CONFIG, path));
|
||||
return Object.byString(DEFAULT_CONFIG, path);
|
||||
}
|
||||
return Object.byString(config_json, path);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user