mirror of
https://github.com/twinksoftware/Gearslip.git
synced 2026-11-11 00:12:24 +01:00
voice: opening a screen mid-download no longer deletes the download in progress
This commit is contained in:
1 parent
3042e01e75
commit
8b269f4734
1 file changed
+5
-2
@@ -112,9 +112,12 @@ object SpeechModels {
|
|||||||
?: if (isReady(context, Model.PARAKEET_LARGE) && !isReady(context, Model.CANARY)) Model.PARAKEET_LARGE.id else Model.CANARY.id
|
?: if (isReady(context, Model.PARAKEET_LARGE) && !isReady(context, Model.CANARY)) Model.PARAKEET_LARGE.id else Model.CANARY.id
|
||||||
_final.value = Model.entries.firstOrNull { it.id == finalId && it.role == Role.FINAL }
|
_final.value = Model.entries.firstOrNull { it.id == finalId && it.role == Role.FINAL }
|
||||||
Model.entries.forEach { m -> if (isReady(context, m)) states.getValue(m).value = State.Ready }
|
Model.entries.forEach { m -> if (isReady(context, m)) states.getValue(m).value = State.Ready }
|
||||||
// Models an older build offered and this one doesn't: hundreds of MB nobody can use.
|
// Models an older build offered and this one doesn't: hundreds of MB nobody can use. A
|
||||||
|
// known model's ".partial" folder is a download that may be running right now; [download]
|
||||||
|
// clears its own leftovers when it starts.
|
||||||
val known = Model.entries.map { it.id }.toSet()
|
val known = Model.entries.map { it.id }.toSet()
|
||||||
File(context.filesDir, "speech").listFiles()?.filter { it.isDirectory && it.name !in known }?.forEach {
|
File(context.filesDir, "speech").listFiles()
|
||||||
|
?.filter { it.isDirectory && it.name.removeSuffix(".partial") !in known }?.forEach {
|
||||||
GearslipLog.i("speech: removing ${it.name}, no longer offered")
|
GearslipLog.i("speech: removing ${it.name}, no longer offered")
|
||||||
it.deleteRecursively()
|
it.deleteRecursively()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user