mirror of
https://github.com/null2264/yokai.git
synced 2025-06-21 10:44:42 +00:00
refactor(source/local): Simplify getCoverFile code
Also make cover filename case-insensitive
This commit is contained in:
parent
448a582019
commit
67b881dc3f
1 changed files with 3 additions and 3 deletions
|
@ -105,9 +105,9 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
* Returns valid cover file inside [parent] directory.
|
||||
*/
|
||||
private fun getCoverFile(parent: UniFile?): UniFile? {
|
||||
return parent?.listFiles()?.find { it.nameWithoutExtension == "cover" }?.takeIf {
|
||||
it.isFile && ImageUtil.isImage(it.name.orEmpty()) { it.openInputStream() }
|
||||
}
|
||||
return parent?.listFiles()
|
||||
?.filter { it.isFile && it.nameWithoutExtension.equals("cover", ignoreCase = true) }
|
||||
?.firstOrNull { ImageUtil.isImage(it.name.orEmpty()) { it.openInputStream() } }
|
||||
}
|
||||
|
||||
private fun getBaseDirectory(): UniFile? {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue