Add:Check metadata.abs file modified date to rescan

This commit is contained in:
advplyr 2022-02-27 18:58:23 -06:00
parent 42604331ff
commit 74a68a4557
4 changed files with 20 additions and 8 deletions

View file

@ -39,7 +39,7 @@ function generate(audiobook, outputPath) {
}
return fs.writeFile(outputPath, fileString).then(() => {
return filePerms(outputPath, 0o774, global.Uid, global.Gid).then(() => true)
return filePerms(outputPath, 0o774, global.Uid, global.Gid, true).then((data) => true)
}).catch((error) => {
Logger.error(`[absMetaFileGenerator] Failed to save abs file`, error)
return false

View file

@ -50,7 +50,7 @@ const chmodr = (p, mode, uid, gid, cb) => {
// any error other than ENOTDIR means it's not readable, or
// doesn't exist. give up.
if (er && er.code !== 'ENOTDIR') return cb(er)
if (er) {
if (er) { // Is a file
return fs.chmod(p, mode).then(() => {
fs.chown(p, uid, gid, cb)
})
@ -77,9 +77,9 @@ const chmodr = (p, mode, uid, gid, cb) => {
})
}
module.exports = (path, mode, uid, gid) => {
module.exports = (path, mode, uid, gid, silent = false) => {
return new Promise((resolve) => {
Logger.debug(`[FilePerms] Setting permission "${mode}" for uid ${uid} and gid ${gid} | "${path}"`)
if (!silent) Logger.debug(`[FilePerms] Setting permission "${mode}" for uid ${uid} and gid ${gid} | "${path}"`)
chmodr(path, mode, uid, gid, resolve)
})
}