From c816962699ec2ae5e338b72cac04ca446089ba25 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 24 Feb 2022 08:32:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/service/HttpReadAloudService.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 3b2dbd588..358216bc6 100644 --- a/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/HttpReadAloudService.kt @@ -35,7 +35,7 @@ class HttpReadAloudService : BaseReadAloudService(), private val mediaPlayer = MediaPlayer() private val ttsFolderPath: String by lazy { - externalCacheDir!!.absolutePath + File.separator + "httpTTS" + File.separator + cacheDir.absolutePath + File.separator + "httpTTS" + File.separator } private val cacheFiles = hashSetOf() private var task: Coroutine<*>? = null @@ -261,6 +261,9 @@ class HttpReadAloudService : BaseReadAloudService(), private fun createSpeakFileAsMd5IfNotExist(name: String): File = FileUtils.createFileIfNotExist("${ttsFolderPath}$name.mp3") + /** + * 移除缓存文件 + */ private fun removeCacheFile() { val cacheRegex = Regex(""".+\.mp3$""") val reg = """^${MD5Utils.md5Encode16(textChapter!!.title)}_[a-z0-9]{16}\.mp3$""".toRegex() @@ -270,7 +273,7 @@ class HttpReadAloudService : BaseReadAloudService(), FileUtils.deleteFile(it.absolutePath) } } else { - if (Date().time - it.lastModified() > 30000) { + if (Date().time - it.lastModified() > 600000) { FileUtils.deleteFile(it.absolutePath) } }