mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-12-22 03:39:37 +00:00
Added deviceId in addition to inode to uniquely identify files
This commit is contained in:
parent
d8f07eb956
commit
3a4aacb7bf
17 changed files with 1445 additions and 227 deletions
|
|
@ -3,6 +3,7 @@ const FileMetadata = require('../metadata/FileMetadata')
|
|||
class EBookFile {
|
||||
constructor(file) {
|
||||
this.ino = null
|
||||
this.deviceId = null
|
||||
this.metadata = null
|
||||
this.ebookFormat = null
|
||||
this.addedAt = null
|
||||
|
|
@ -15,6 +16,7 @@ class EBookFile {
|
|||
|
||||
construct(file) {
|
||||
this.ino = file.ino
|
||||
this.deviceId = file.dev
|
||||
this.metadata = new FileMetadata(file.metadata)
|
||||
this.ebookFormat = file.ebookFormat || this.metadata.format
|
||||
this.addedAt = file.addedAt
|
||||
|
|
@ -24,6 +26,7 @@ class EBookFile {
|
|||
toJSON() {
|
||||
return {
|
||||
ino: this.ino,
|
||||
deviceId: this.deviceId,
|
||||
metadata: this.metadata.toJSON(),
|
||||
ebookFormat: this.ebookFormat,
|
||||
addedAt: this.addedAt,
|
||||
|
|
@ -37,6 +40,7 @@ class EBookFile {
|
|||
|
||||
setData(libraryFile) {
|
||||
this.ino = libraryFile.ino
|
||||
this.deviceId = libraryFile.deviceId
|
||||
this.metadata = libraryFile.metadata.clone()
|
||||
this.ebookFormat = libraryFile.metadata.format
|
||||
this.addedAt = Date.now()
|
||||
|
|
@ -58,4 +62,4 @@ class EBookFile {
|
|||
return hasUpdated
|
||||
}
|
||||
}
|
||||
module.exports = EBookFile
|
||||
module.exports = EBookFile
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue