Adding inode to files and audiobooks to support renaming, setting up watcher and removing chokidar

This commit is contained in:
advplyr 2021-08-25 17:36:54 -05:00
parent 0c1a29adbf
commit cb40e063da
17 changed files with 558 additions and 234 deletions

48
server/AudiobookFile.js Normal file
View file

@ -0,0 +1,48 @@
class AudiobookFile {
constructor(data) {
this.ino = null
this.filetype = null
this.filename = null
this.ext = null
this.path = null
this.fullPath = null
this.addedAt = null
if (data) {
this.construct(data)
}
}
toJSON() {
return {
ino: this.ino || null,
filetype: this.filetype,
filename: this.filename,
ext: this.ext,
path: this.path,
fullPath: this.fullPath,
addedAt: this.addedAt
}
}
construct(data) {
this.ino = data.ino || null
this.filetype = data.filetype
this.filename = data.filename
this.ext = data.ext
this.path = data.path
this.fullPath = data.fullPath
this.addedAt = data.addedAt
}
setData(data) {
this.ino = data.ino || null
this.filetype = data.filetype
this.filename = data.filename
this.ext = data.ext
this.path = data.path
this.fullPath = data.fullPath
this.addedAt = Date.now()
}
}
module.exports = AudiobookFile