mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-27 22:04:08 +02:00
Speed up duplicate docFile calls by using localFile reference
This commit is contained in:
@@ -328,14 +328,6 @@ class FolderScanner(var ctx: Context) {
|
|||||||
val itemPart =
|
val itemPart =
|
||||||
downloadItem.downloadItemParts.find { itemPart -> itemPart.filename == docFile.name }
|
downloadItem.downloadItemParts.find { itemPart -> itemPart.filename == docFile.name }
|
||||||
|
|
||||||
// val fileUri = docFile.uri.toString()
|
|
||||||
// val fileBasePath = docFile.getBasePath(ctx)
|
|
||||||
// val fileAbsolutePath = docFile.getAbsolutePath(ctx)
|
|
||||||
// val fileMimeType = docFile.mimeType
|
|
||||||
// val fileLength = docFile.length()
|
|
||||||
// val fileName = docFile.name
|
|
||||||
// val fileExtension = docFile.extension
|
|
||||||
|
|
||||||
// Build local file object
|
// Build local file object
|
||||||
val localFileId = DeviceManager.getBase64Id(docFile.id)
|
val localFileId = DeviceManager.getBase64Id(docFile.id)
|
||||||
val localFile =
|
val localFile =
|
||||||
@@ -354,7 +346,7 @@ class FolderScanner(var ctx: Context) {
|
|||||||
) { // for books every download item should be a file found
|
) { // for books every download item should be a file found
|
||||||
Log.e(
|
Log.e(
|
||||||
tag,
|
tag,
|
||||||
"scanDownloadItem: Item part not found for doc file ${docFile.name} | ${docFile.getAbsolutePath(ctx)} | ${docFile.uri}"
|
"scanDownloadItem: Item part not found for doc file ${localFile.filename} | ${localFile.absolutePath} | ${localFile.contentUrl}"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else if (itemPart.audioTrack != null) { // Is audio track
|
} else if (itemPart.audioTrack != null) { // Is audio track
|
||||||
@@ -369,11 +361,11 @@ class FolderScanner(var ctx: Context) {
|
|||||||
// Create new audio track
|
// Create new audio track
|
||||||
val trackFileMetadata =
|
val trackFileMetadata =
|
||||||
FileMetadata(
|
FileMetadata(
|
||||||
docFile.name ?: "",
|
localFile.filename ?: "",
|
||||||
docFile.extension ?: "",
|
docFile.extension ?: "",
|
||||||
docFile.getAbsolutePath(ctx),
|
localFile.absolutePath,
|
||||||
docFile.getBasePath(ctx),
|
localFile.basePath,
|
||||||
docFile.length()
|
localFile.size
|
||||||
)
|
)
|
||||||
val track =
|
val track =
|
||||||
AudioTrack(
|
AudioTrack(
|
||||||
@@ -407,7 +399,7 @@ class FolderScanner(var ctx: Context) {
|
|||||||
}
|
}
|
||||||
} else if (itemPart.ebookFile != null) { // Ebook
|
} else if (itemPart.ebookFile != null) { // Ebook
|
||||||
foundEBookFile = true
|
foundEBookFile = true
|
||||||
Log.d(tag, "scanDownloadItem: Ebook file found with mimetype=${docFile.mimeType}")
|
Log.d(tag, "scanDownloadItem: Ebook file found with mimetype=${localFile.mimeType}")
|
||||||
|
|
||||||
localLibraryItem.localFiles.add(localFile)
|
localLibraryItem.localFiles.add(localFile)
|
||||||
val ebookFile =
|
val ebookFile =
|
||||||
|
|||||||
Reference in New Issue
Block a user