From ac65fd620d5f9361b2c3b1d2a4c56b251e04c5de Mon Sep 17 00:00:00 2001 From: Ktouls <75007654+Ktouls@users.noreply.github.com> Date: Thu, 15 Jan 2026 12:24:43 +0800 Subject: [PATCH] Update HttpReadAloudService.kt --- .../main/java/io/legado/app/service/HttpReadAloudService.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt index 4d23602a1..ee1af9d44 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -196,6 +196,7 @@ class HttpReadAloudService : BaseReadAloudService(), val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1) .splitToSequence("\n") .filter { it.isNotEmpty() } + .take(AppConfig.audioPreDownloadNum) // <--- 修改:读取配置 .toList() contentList.forEach { content -> currentCoroutineContext().ensureActive() @@ -264,6 +265,7 @@ class HttpReadAloudService : BaseReadAloudService(), val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1) .splitToSequence("\n") .filter { it.isNotEmpty() } + .take(AppConfig.audioPreDownloadNum) // <--- 修改:读取配置 .toList() contentList.forEach { content -> currentCoroutineContext().ensureActive() @@ -434,7 +436,7 @@ class HttpReadAloudService : BaseReadAloudService(), FileUtils.listDirsAndFiles(ttsFolderPath)?.forEach { val isSilentSound = it.length() == 2160L if ((!it.name.startsWith(titleMd5) - && System.currentTimeMillis() - it.lastModified() > 1800000) + && System.currentTimeMillis() - it.lastModified() > AppConfig.audioCacheCleanTime) // <--- 修改:读取配置 || isSilentSound ) { FileUtils.delete(it.absolutePath)