mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-04-08 06:21:29 +03:00
Added ability to backup remote DB
Added ability to restore DB
This commit is contained in:
@@ -266,13 +266,7 @@ function getCurrentDownloader() {
|
||||
return details_json['downloader'];
|
||||
}
|
||||
|
||||
async function backupLocalDB() {
|
||||
const path_to_backups = path.join('appdata', 'db_backup');
|
||||
fs.ensureDir(path_to_backups);
|
||||
await fs.copyFile('appdata/local_db.json', path.join(path_to_backups, `local_db.json.${Date.now()/1000}.bak`));
|
||||
}
|
||||
|
||||
async function recFindByExt(base,ext,files,result)
|
||||
async function recFindByExt(base, ext, files, result, recursive = true)
|
||||
{
|
||||
files = files || (await fs.readdir(base))
|
||||
result = result || []
|
||||
@@ -281,6 +275,7 @@ async function recFindByExt(base,ext,files,result)
|
||||
var newbase = path.join(base,file)
|
||||
if ( (await fs.stat(newbase)).isDirectory() )
|
||||
{
|
||||
if (!recursive) continue;
|
||||
result = await recFindByExt(newbase,ext,await fs.readdir(newbase),result)
|
||||
}
|
||||
else
|
||||
@@ -396,7 +391,6 @@ module.exports = {
|
||||
getMatchingCategoryFiles: getMatchingCategoryFiles,
|
||||
addUIDsToCategory: addUIDsToCategory,
|
||||
getCurrentDownloader: getCurrentDownloader,
|
||||
backupLocalDB: backupLocalDB,
|
||||
recFindByExt: recFindByExt,
|
||||
removeFileExtension: removeFileExtension,
|
||||
formatDateString: formatDateString,
|
||||
|
||||
Reference in New Issue
Block a user