Просмотр исходного кода

HttpReadAloudService: 优化缓存策略

1. 缓存清理时间从10分钟改为30分钟
2. 非流式播放时预缓存下一整章音频(移除10句限制)
Ktouls 10 месяцев назад
Родитель
Сommit
846a7379d8
1 измененных файлов с 1 добавлено и 2 удалено
  1. 1 2
      app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

+ 1 - 2
app/src/main/java/io/legado/app/service/HttpReadAloudService.kt

@@ -265,7 +265,6 @@ class HttpReadAloudService : BaseReadAloudService(),
         val contentList = textChapter.getNeedReadAloud(0, readAloudByPage, 0, 1)
             .splitToSequence("\n")
             .filter { it.isNotEmpty() }
-            .take(10)
             .toList()
         contentList.forEach { content ->
             currentCoroutineContext().ensureActive()
@@ -436,7 +435,7 @@ class HttpReadAloudService : BaseReadAloudService(),
         FileUtils.listDirsAndFiles(ttsFolderPath)?.forEach {
             val isSilentSound = it.length() == 2160L
             if ((!it.name.startsWith(titleMd5)
-                        && System.currentTimeMillis() - it.lastModified() > 600000)
+                        && System.currentTimeMillis() - it.lastModified() > 1800000)
                 || isSilentSound
             ) {
                 FileUtils.delete(it.absolutePath)