mirror of
https://github.com/tachiyomiorg/tachiyomi-extensions-inspector.git
synced 2024-11-01 06:55:06 +01:00
chapter image fix for bato.to
This commit is contained in:
parent
1802271358
commit
a567701639
@ -126,6 +126,13 @@ fun getChapter(chapterIndex: Int, mangaId: Int): ChapterDataClass {
|
||||
it[this.chapter] = chapterId
|
||||
}
|
||||
}
|
||||
} else {
|
||||
transaction {
|
||||
PageTable.update({ (PageTable.chapter eq chapterId) and (PageTable.index eq page.index) }) {
|
||||
it[url] = page.url
|
||||
it[imageUrl] = page.imageUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ fun getExtensionIcon(apkName: String): Pair<InputStream, String> {
|
||||
|
||||
val saveDir = "${applicationDirs.extensionsRoot}/icon"
|
||||
|
||||
return getCachedResponse(saveDir, apkName) {
|
||||
return getCachedImageResponse(saveDir, apkName) {
|
||||
network.client.newCall(
|
||||
GET(iconUrl)
|
||||
).execute()
|
||||
|
@ -93,7 +93,7 @@ fun getThumbnail(mangaId: Int): Pair<InputStream, String> {
|
||||
val saveDir = applicationDirs.thumbnailsRoot
|
||||
val fileName = mangaId.toString()
|
||||
|
||||
return getCachedResponse(saveDir, fileName) {
|
||||
return getCachedImageResponse(saveDir, fileName) {
|
||||
val sourceId = mangaEntry[MangaTable.sourceReference]
|
||||
val source = getHttpSource(sourceId)
|
||||
var thumbnailUrl = mangaEntry[MangaTable.thumbnail_url]
|
||||
|
@ -58,7 +58,7 @@ fun getPageImage(mangaId: Int, chapterIndex: Int, index: Int): Pair<InputStream,
|
||||
File(saveDir).mkdirs()
|
||||
val fileName = index.toString()
|
||||
|
||||
return getCachedResponse(saveDir, fileName) {
|
||||
return getCachedImageResponse(saveDir, fileName) {
|
||||
source.fetchImage(tachiPage).toBlocking().first()
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ private fun BufferedSource.saveTo(stream: OutputStream) {
|
||||
}
|
||||
}
|
||||
|
||||
fun getCachedResponse(saveDir: String, fileName: String, fetcher: () -> Response): Pair<InputStream, String> {
|
||||
fun getCachedImageResponse(saveDir: String, fileName: String, fetcher: () -> Response): Pair<InputStream, String> {
|
||||
val cachedFile = findFileNameStartingWith(saveDir, fileName)
|
||||
val filePath = "$saveDir/$fileName"
|
||||
if (cachedFile != null) {
|
Loading…
Reference in New Issue
Block a user