mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-14 19:34:57 +02:00
Start of new data model
This commit is contained in:
parent
2b7f53b0a7
commit
65793f7109
18 changed files with 672 additions and 8 deletions
41
server/objects/metadata/FileMetadata.js
Normal file
41
server/objects/metadata/FileMetadata.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
class FileMetadata {
|
||||
constructor(metadata) {
|
||||
this.filename = null
|
||||
this.ext = null
|
||||
this.path = null
|
||||
this.relPath = null
|
||||
this.size = null
|
||||
this.mtimeMs = null
|
||||
this.ctimeMs = null
|
||||
this.birthtimeMs = null
|
||||
|
||||
if (metadata) {
|
||||
this.construct(metadata)
|
||||
}
|
||||
}
|
||||
|
||||
construct(metadata) {
|
||||
this.filename = metadata.filename
|
||||
this.ext = metadata.ext
|
||||
this.path = metadata.path
|
||||
this.relPath = metadata.relPath
|
||||
this.size = metadata.size
|
||||
this.mtimeMs = metadata.mtimeMs
|
||||
this.ctimeMs = metadata.ctimeMs
|
||||
this.birthtimeMs = metadata.birthtimeMs
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
filename: this.filename,
|
||||
ext: this.ext,
|
||||
path: this.path,
|
||||
relPath: this.relPath,
|
||||
size: this.size,
|
||||
mtimeMs: this.mtimeMs,
|
||||
ctimeMs: this.ctimeMs,
|
||||
birthtimeMs: this.birthtimeMs
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = FileMetadata
|
Loading…
Add table
Add a link
Reference in a new issue