mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-01-08 00:08:14 +01:00
34 lines
704 B
JavaScript
34 lines
704 B
JavaScript
|
const FileMetadata = require('../metadata/FileMetadata')
|
||
|
|
||
|
class EBookFile {
|
||
|
constructor(file) {
|
||
|
this.ino = null
|
||
|
this.metadata = null
|
||
|
this.ebookFormat = null
|
||
|
this.addedAt = null
|
||
|
this.lastUpdate = null
|
||
|
|
||
|
if (file) {
|
||
|
this.construct(file)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
construct(file) {
|
||
|
this.ino = file.ino
|
||
|
this.metadata = new FileMetadata(file)
|
||
|
this.ebookFormat = file.ebookFormat
|
||
|
this.addedAt = file.addedAt
|
||
|
this.lastUpdate = file.lastUpdate
|
||
|
}
|
||
|
|
||
|
toJSON() {
|
||
|
return {
|
||
|
ino: this.ino,
|
||
|
metadata: this.metadata.toJSON(),
|
||
|
ebookFormat: this.ebookFormat,
|
||
|
addedAt: this.addedAt,
|
||
|
lastUpdate: this.lastUpdate
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
module.exports = EBookFile
|