Update HttpReadAloudService.kt
This commit is contained in:
@@ -196,6 +196,7 @@ class HttpReadAloudService : BaseReadAloudService(),
|
|||||||
val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1)
|
val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1)
|
||||||
.splitToSequence("\n")
|
.splitToSequence("\n")
|
||||||
.filter { it.isNotEmpty() }
|
.filter { it.isNotEmpty() }
|
||||||
|
.take(AppConfig.audioPreDownloadNum) // <--- 修改:读取配置
|
||||||
.toList()
|
.toList()
|
||||||
contentList.forEach { content ->
|
contentList.forEach { content ->
|
||||||
currentCoroutineContext().ensureActive()
|
currentCoroutineContext().ensureActive()
|
||||||
@@ -264,6 +265,7 @@ class HttpReadAloudService : BaseReadAloudService(),
|
|||||||
val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1)
|
val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1)
|
||||||
.splitToSequence("\n")
|
.splitToSequence("\n")
|
||||||
.filter { it.isNotEmpty() }
|
.filter { it.isNotEmpty() }
|
||||||
|
.take(AppConfig.audioPreDownloadNum) // <--- 修改:读取配置
|
||||||
.toList()
|
.toList()
|
||||||
contentList.forEach { content ->
|
contentList.forEach { content ->
|
||||||
currentCoroutineContext().ensureActive()
|
currentCoroutineContext().ensureActive()
|
||||||
@@ -434,7 +436,7 @@ class HttpReadAloudService : BaseReadAloudService(),
|
|||||||
FileUtils.listDirsAndFiles(ttsFolderPath)?.forEach {
|
FileUtils.listDirsAndFiles(ttsFolderPath)?.forEach {
|
||||||
val isSilentSound = it.length() == 2160L
|
val isSilentSound = it.length() == 2160L
|
||||||
if ((!it.name.startsWith(titleMd5)
|
if ((!it.name.startsWith(titleMd5)
|
||||||
&& System.currentTimeMillis() - it.lastModified() > 1800000)
|
&& System.currentTimeMillis() - it.lastModified() > AppConfig.audioCacheCleanTime) // <--- 修改:读取配置
|
||||||
|| isSilentSound
|
|| isSilentSound
|
||||||
) {
|
) {
|
||||||
FileUtils.delete(it.absolutePath)
|
FileUtils.delete(it.absolutePath)
|
||||||
|
|||||||
Reference in New Issue
Block a user