Fixed issue where testing the connecting string would fail if local DB was being used

Fixed issue where blacklisting video in with archiving would not work

Cleaned up unused functions in app.js
This commit is contained in:
Isaac Abadi
2021-08-01 14:38:34 -06:00
parent c8f219d5b0
commit b03b4d173b
2 changed files with 14 additions and 77 deletions

View File

@@ -75,7 +75,7 @@ exports.initialize = (input_db, input_users_db, input_logger) => {
}
exports.connectToDB = async (retries = 5, no_fallback = false, custom_connection_string = null) => {
if (using_local_db) return;
if (using_local_db && !custom_connection_string) return;
const success = await exports._connectToDB(custom_connection_string);
if (success) return true;
@@ -1018,4 +1018,16 @@ const applyFilterLocalDB = (db_path, filter_obj, operation) => {
return filtered;
});
return return_val;
}
}
// archive helper functions
async function writeToBlacklist(type, line) {
const archivePath = path.join(__dirname, 'appdata', 'archives');
let blacklistPath = path.join(archivePath, (type === 'audio') ? 'blacklist_audio.txt' : 'blacklist_video.txt');
// adds newline to the beginning of the line
line.replace('\n', '');
line.replace('\r', '');
line = '\n' + line;
await fs.appendFile(blacklistPath, line);
}