Updated
This commit is contained in:
parent
5eb94df884
commit
72e73c2c20
@ -54,10 +54,15 @@ class DownloadAndStoreCoverTask(@Autowired override var coordinator: Coordinator
|
|||||||
client.getOutFile()
|
client.getOutFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val coversInDifferentFormats = outDir.listFiles { it -> it.isFile && it.extension.lowercase() in client.contentTypeToExtension().values } ?: emptyArray()
|
||||||
|
|
||||||
|
|
||||||
var message: String? = null
|
var message: String? = null
|
||||||
val result = if (outFile?.exists() == true) {
|
val result = if (outFile?.exists() == true) {
|
||||||
message = "${outFile.name} already exists"
|
message = "${outFile.name} already exists"
|
||||||
outFile
|
outFile
|
||||||
|
} else if (coversInDifferentFormats.isNotEmpty()) {
|
||||||
|
coversInDifferentFormats.random()
|
||||||
} else if (outFile != null) {
|
} else if (outFile != null) {
|
||||||
runBlocking {
|
runBlocking {
|
||||||
client.download(outFile)
|
client.download(outFile)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user