Fix: book id length & check duplicate ids, Change: library to lazy load book cards

This commit is contained in:
advplyr 2021-11-15 20:09:42 -06:00
parent ca6f2c01f6
commit 72f9732b67
18 changed files with 466 additions and 86 deletions

View file

@ -5,6 +5,7 @@ const archiver = require('archiver')
const workerThreads = require('worker_threads')
const Logger = require('./Logger')
const Download = require('./objects/Download')
const { getId } = require('./utils/index')
const { writeConcatFile, writeMetadataFile } = require('./utils/ffmpegHelpers')
const { getFileSize } = require('./utils/fileUtils')
const TAG = 'DownloadManager'
@ -61,7 +62,7 @@ class DownloadManager {
}
async prepareDownload(client, audiobook, options = {}) {
var downloadId = (Math.trunc(Math.random() * 1000) + Date.now()).toString(36)
var downloadId = getId('dl')
var dlpath = Path.join(this.downloadDirPath, downloadId)
Logger.info(`Start Download for ${audiobook.id} - DownloadId: ${downloadId} - ${dlpath}`)