Remove 1.x source models (#7781)
(cherry picked from commit e36e9d9d5c)
# Conflicts:
# app/src/main/java/eu/kanade/domain/manga/interactor/UpdateManga.kt
# app/src/main/java/eu/kanade/domain/manga/model/Manga.kt
# app/src/main/java/eu/kanade/tachiyomi/data/database/models/Manga.kt
# app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt
# app/src/main/java/eu/kanade/tachiyomi/source/LocalSource.kt
# app/src/main/java/eu/kanade/tachiyomi/source/Source.kt
# app/src/main/java/eu/kanade/tachiyomi/source/SourceManager.kt
# app/src/main/java/eu/kanade/tachiyomi/source/model/SManga.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/SearchPresenter.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt
This commit is contained in:
@@ -9,11 +9,9 @@ import eu.kanade.domain.manga.interactor.GetManga
|
||||
import eu.kanade.domain.manga.interactor.InsertManga
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.manga.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.toSChapter
|
||||
import eu.kanade.tachiyomi.source.online.UrlImportableSource
|
||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||
import exh.log.xLogStack
|
||||
@@ -135,7 +133,7 @@ class GalleryAdder(
|
||||
}
|
||||
|
||||
// Fetch and copy details
|
||||
val newManga = source.getMangaDetails(manga.toMangaInfo())
|
||||
val newManga = source.getMangaDetails(manga.toSManga())
|
||||
updateManga.awaitUpdateFromSource(manga, newManga, false)
|
||||
manga = getManga.await(manga.id)!!
|
||||
|
||||
@@ -147,10 +145,10 @@ class GalleryAdder(
|
||||
// Fetch and copy chapters
|
||||
try {
|
||||
val chapterList = if (source is EHentai) {
|
||||
source.getChapterList(manga.toMangaInfo(), throttleFunc)
|
||||
source.getChapterList(manga.toSManga(), throttleFunc)
|
||||
} else {
|
||||
source.getChapterList(manga.toMangaInfo())
|
||||
}.map { it.toSChapter() }
|
||||
source.getChapterList(manga.toSManga())
|
||||
}
|
||||
|
||||
if (chapterList.isNotEmpty()) {
|
||||
syncChaptersWithSource.await(chapterList, manga, source)
|
||||
|
||||
@@ -10,7 +10,6 @@ import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
||||
import eu.kanade.domain.manga.interactor.GetSearchMetadata
|
||||
import eu.kanade.domain.manga.interactor.InsertFlatMetadata
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
import eu.kanade.domain.manga.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.online.all.NHentai
|
||||
@@ -79,7 +78,7 @@ object DebugFunctions {
|
||||
EH_SOURCE_ID -> eh
|
||||
EXH_SOURCE_ID -> ex
|
||||
else -> return@forEach
|
||||
}?.getMangaDetails(manga.toMangaInfo()) ?: return@forEach
|
||||
}?.getMangaDetails(manga.toSManga()) ?: return@forEach
|
||||
|
||||
updateManga.awaitUpdateFromSource(manga, networkManga, true)
|
||||
}
|
||||
|
||||
@@ -19,13 +19,11 @@ import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
||||
import eu.kanade.domain.manga.interactor.InsertFlatMetadata
|
||||
import eu.kanade.domain.manga.interactor.UpdateManga
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.manga.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateNotifier
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING
|
||||
import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.toSChapter
|
||||
import eu.kanade.tachiyomi.source.online.all.EHentai
|
||||
import eu.kanade.tachiyomi.util.system.isConnectedToWifi
|
||||
import exh.debug.DebugToggles
|
||||
@@ -203,11 +201,10 @@ class EHentaiUpdateWorker(private val context: Context, workerParams: WorkerPara
|
||||
?: throw GalleryNotUpdatedException(false, IllegalStateException("Missing EH-based source (${manga.source})!"))
|
||||
|
||||
try {
|
||||
val updatedManga = source.getMangaDetails(manga.toMangaInfo())
|
||||
val updatedManga = source.getMangaDetails(manga.toSManga())
|
||||
updateManga.awaitUpdateFromSource(manga, updatedManga, false)
|
||||
|
||||
val newChapters = source.getChapterList(manga.toMangaInfo())
|
||||
.map { it.toSChapter() }
|
||||
val newChapters = source.getChapterList(manga.toSManga())
|
||||
|
||||
val new = syncChaptersWithSource.await(newChapters, manga, source)
|
||||
return new to getChapterByMangaId.await(manga.id)
|
||||
|
||||
@@ -3,6 +3,7 @@ package exh.md.handlers
|
||||
import eu.kanade.domain.manga.interactor.GetFlatMetadataById
|
||||
import eu.kanade.domain.manga.interactor.GetManga
|
||||
import eu.kanade.domain.manga.interactor.InsertFlatMetadata
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import exh.log.xLogE
|
||||
import exh.md.dto.ChapterDataDto
|
||||
@@ -17,8 +18,6 @@ import exh.metadata.metadata.base.RaisedTag
|
||||
import exh.util.capitalize
|
||||
import exh.util.floor
|
||||
import exh.util.nullIfEmpty
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
import java.util.Locale
|
||||
|
||||
@@ -40,13 +39,13 @@ class ApiMangaParser(
|
||||
?: error("Could not find no-args constructor for meta class: ${metaClass.qualifiedName}!")
|
||||
|
||||
suspend fun parseToManga(
|
||||
manga: MangaInfo,
|
||||
manga: SManga,
|
||||
sourceId: Long,
|
||||
input: MangaDto,
|
||||
simpleChapters: List<String>,
|
||||
statistics: StatisticsMangaDto?,
|
||||
): MangaInfo {
|
||||
val mangaId = getManga.await(manga.key, sourceId)?.id
|
||||
): SManga {
|
||||
val mangaId = getManga.await(manga.url, sourceId)?.id
|
||||
val metadata = if (mangaId != null) {
|
||||
val flatMetadata = getFlatMetadataById.await(mangaId)
|
||||
flatMetadata?.raise(metaClass) ?: newMetaInstance()
|
||||
@@ -184,7 +183,7 @@ class ApiMangaParser(
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
|
||||
fun chapterListParse(chapterListResponse: List<ChapterDataDto>, groupMap: Map<String, String>): List<ChapterInfo> {
|
||||
fun chapterListParse(chapterListResponse: List<ChapterDataDto>, groupMap: Map<String, String>): List<SChapter> {
|
||||
val now = System.currentTimeMillis()
|
||||
return chapterListResponse
|
||||
.filterNot { MdUtil.parseDate(it.attributes.publishAt) > now && it.attributes.externalUrl == null }
|
||||
@@ -202,7 +201,7 @@ class ApiMangaParser(
|
||||
private fun mapChapter(
|
||||
networkChapter: ChapterDataDto,
|
||||
groups: Map<String, String>,
|
||||
): ChapterInfo {
|
||||
): SChapter {
|
||||
val attributes = networkChapter.attributes
|
||||
val key = MdUtil.chapterSuffix + networkChapter.id
|
||||
val chapterName = StringBuilder()
|
||||
@@ -265,11 +264,11 @@ class ApiMangaParser(
|
||||
|
||||
// chapter.language = MdLang.fromIsoCode(attributes.translatedLanguage)?.prettyPrint ?: ""
|
||||
|
||||
return ChapterInfo(
|
||||
key = key,
|
||||
return SChapter(
|
||||
url = key,
|
||||
name = name,
|
||||
scanlator = scanlator,
|
||||
dateUpload = dateUpload,
|
||||
date_upload = dateUpload,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import eu.kanade.tachiyomi.network.await
|
||||
import eu.kanade.tachiyomi.network.interceptor.rateLimit
|
||||
import eu.kanade.tachiyomi.network.parseAs
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import exh.log.xLogD
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -20,7 +21,6 @@ import okhttp3.Request
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class BilibiliHandler(currentClient: OkHttpClient) {
|
||||
@@ -44,9 +44,9 @@ class BilibiliHandler(currentClient: OkHttpClient) {
|
||||
val mangaUrl = getMangaUrl(externalUrl)
|
||||
val chapters = getChapterList(mangaUrl)
|
||||
val chapter = chapters
|
||||
.find { it.number == chapterNumber.toFloatOrNull() }
|
||||
.find { it.chapter_number == chapterNumber.toFloatOrNull() }
|
||||
?: throw Exception("Unknown chapter $chapterNumber")
|
||||
chapter.key
|
||||
chapter.url
|
||||
}
|
||||
|
||||
return fetchPageList(chapterUrl)
|
||||
@@ -91,12 +91,12 @@ class BilibiliHandler(currentClient: OkHttpClient) {
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun getChapterList(mangaUrl: String): List<ChapterInfo> {
|
||||
suspend fun getChapterList(mangaUrl: String): List<SChapter> {
|
||||
val response = client.newCall(mangaDetailsApiRequest(mangaUrl)).await()
|
||||
return chapterListParse(response)
|
||||
}
|
||||
|
||||
fun chapterListParse(response: Response): List<ChapterInfo> {
|
||||
fun chapterListParse(response: Response): List<SChapter> {
|
||||
val result = response.parseAs<BilibiliResultDto<BilibiliComicDto>>()
|
||||
|
||||
if (result.code != 0) {
|
||||
@@ -108,10 +108,10 @@ class BilibiliHandler(currentClient: OkHttpClient) {
|
||||
.map { ep -> chapterFromObject(ep, result.data.id) }
|
||||
}
|
||||
|
||||
private fun chapterFromObject(episode: BilibiliEpisodeDto, comicId: Int): ChapterInfo = ChapterInfo(
|
||||
key = "/mc$comicId/${episode.id}",
|
||||
private fun chapterFromObject(episode: BilibiliEpisodeDto, comicId: Int): SChapter = SChapter(
|
||||
url = "/mc$comicId/${episode.id}",
|
||||
name = "Ep. " + episode.order.toString().removeSuffix(".0") + " - " + episode.title,
|
||||
number = episode.order,
|
||||
chapter_number = episode.order,
|
||||
)
|
||||
|
||||
private suspend fun fetchPageList(chapterUrl: String): List<Page> {
|
||||
|
||||
@@ -4,7 +4,6 @@ import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.source.model.MetadataMangasPage
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||
import exh.md.dto.MangaDataDto
|
||||
import exh.md.dto.PersonalRatingDto
|
||||
@@ -57,7 +56,7 @@ class FollowsHandler(
|
||||
MdUtil.createMangaEntry(
|
||||
it,
|
||||
lang,
|
||||
).toSManga() to MangaDexSearchMetadata().apply {
|
||||
) to MangaDexSearchMetadata().apply {
|
||||
followStatus = FollowStatus.fromDex(statuses[it.id]).int
|
||||
}
|
||||
}.sortedWith(comparator)
|
||||
|
||||
@@ -3,9 +3,6 @@ package exh.md.handlers
|
||||
import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.source.model.toSChapter
|
||||
import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import eu.kanade.tachiyomi.util.lang.runAsObservable
|
||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||
import exh.md.dto.ChapterDataDto
|
||||
@@ -19,8 +16,6 @@ import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import rx.Observable
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
class MangaHandler(
|
||||
private val lang: String,
|
||||
@@ -28,9 +23,9 @@ class MangaHandler(
|
||||
private val apiMangaParser: ApiMangaParser,
|
||||
private val followsHandler: FollowsHandler,
|
||||
) {
|
||||
suspend fun getMangaDetails(manga: MangaInfo, sourceId: Long): MangaInfo {
|
||||
suspend fun getMangaDetails(manga: SManga, sourceId: Long): SManga {
|
||||
return coroutineScope {
|
||||
val mangaId = MdUtil.getMangaId(manga.key)
|
||||
val mangaId = MdUtil.getMangaId(manga.url)
|
||||
val response = async(Dispatchers.IO) { service.viewManga(mangaId) }
|
||||
val simpleChapters = async(Dispatchers.IO) { getSimpleChapters(manga) }
|
||||
val statistics = async(Dispatchers.IO) { service.mangasRating(mangaId).statistics[mangaId] }
|
||||
@@ -46,19 +41,19 @@ class MangaHandler(
|
||||
|
||||
fun fetchMangaDetailsObservable(manga: SManga, sourceId: Long): Observable<SManga> {
|
||||
return runAsObservable {
|
||||
getMangaDetails(manga.toMangaInfo(), sourceId).toSManga()
|
||||
getMangaDetails(manga, sourceId)
|
||||
}
|
||||
}
|
||||
|
||||
fun fetchChapterListObservable(manga: SManga, blockedGroups: String, blockedUploaders: String): Observable<List<SChapter>> = runAsObservable {
|
||||
getChapterList(manga.toMangaInfo(), blockedGroups, blockedUploaders).map { it.toSChapter() }
|
||||
getChapterList(manga, blockedGroups, blockedUploaders)
|
||||
}
|
||||
|
||||
suspend fun getChapterList(manga: MangaInfo, blockedGroups: String, blockedUploaders: String): List<ChapterInfo> {
|
||||
suspend fun getChapterList(manga: SManga, blockedGroups: String, blockedUploaders: String): List<SChapter> {
|
||||
return withIOContext {
|
||||
val results = mdListCall {
|
||||
service.viewChapters(
|
||||
MdUtil.getMangaId(manga.key),
|
||||
MdUtil.getMangaId(manga.url),
|
||||
lang,
|
||||
it,
|
||||
blockedGroups,
|
||||
@@ -109,8 +104,8 @@ class MangaHandler(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun getSimpleChapters(manga: MangaInfo): List<String> {
|
||||
return runCatching { service.aggregateChapters(MdUtil.getMangaId(manga.key), lang) }
|
||||
private suspend fun getSimpleChapters(manga: SManga): List<String> {
|
||||
return runCatching { service.aggregateChapters(MdUtil.getMangaId(manga.url), lang) }
|
||||
.onFailure {
|
||||
if (it is CancellationException) throw it
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.mdlist.MdList
|
||||
import eu.kanade.tachiyomi.network.GET
|
||||
import eu.kanade.tachiyomi.network.asObservableSuccess
|
||||
import eu.kanade.tachiyomi.source.Source
|
||||
import eu.kanade.tachiyomi.source.model.Page
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||
import exh.log.xLogD
|
||||
import exh.md.dto.AtHomeDto
|
||||
@@ -14,8 +16,6 @@ import exh.md.utils.MdUtil
|
||||
import okhttp3.Headers
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import tachiyomi.source.Source
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import kotlin.reflect.full.superclasses
|
||||
import kotlin.reflect.jvm.isAccessible
|
||||
|
||||
@@ -31,9 +31,9 @@ class PageHandler(
|
||||
private val mdList: MdList,
|
||||
) {
|
||||
|
||||
suspend fun fetchPageList(chapter: ChapterInfo, isLogged: Boolean, usePort443Only: Boolean, dataSaver: Boolean, mangadex: Source): List<Page> {
|
||||
suspend fun fetchPageList(chapter: SChapter, isLogged: Boolean, usePort443Only: Boolean, dataSaver: Boolean, mangadex: Source): List<Page> {
|
||||
return withIOContext {
|
||||
val chapterResponse = service.viewChapter(MdUtil.getChapterId(chapter.key))
|
||||
val chapterResponse = service.viewChapter(MdUtil.getChapterId(chapter.url))
|
||||
|
||||
if (chapterResponse.data.attributes.externalUrl != null && chapterResponse.data.attributes.pages == 0) {
|
||||
when {
|
||||
@@ -63,9 +63,9 @@ class PageHandler(
|
||||
}
|
||||
|
||||
val atHomeRequestUrl = if (usePort443Only) {
|
||||
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.key)}?forcePort443=true"
|
||||
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.url)}?forcePort443=true"
|
||||
} else {
|
||||
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.key)}"
|
||||
"${MdApi.atHomeServer}/${MdUtil.getChapterId(chapter.url)}"
|
||||
}
|
||||
|
||||
updateExtensionVariable(mangadex, atHomeRequestUrl)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exh.md.handlers
|
||||
|
||||
import eu.kanade.tachiyomi.source.model.MetadataMangasPage
|
||||
import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.util.lang.withIOContext
|
||||
import exh.md.dto.RelationListDto
|
||||
import exh.md.dto.SimilarMangaDto
|
||||
@@ -10,7 +10,6 @@ import exh.md.service.SimilarService
|
||||
import exh.md.utils.MangaDexRelation
|
||||
import exh.md.utils.MdUtil
|
||||
import exh.metadata.metadata.MangaDexSearchMetadata
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
class SimilarHandler(
|
||||
private val lang: String,
|
||||
@@ -18,8 +17,8 @@ class SimilarHandler(
|
||||
private val similarService: SimilarService,
|
||||
) {
|
||||
|
||||
suspend fun getSimilar(manga: MangaInfo): MetadataMangasPage {
|
||||
val similarDto = withIOContext { similarService.getSimilarManga(MdUtil.getMangaId(manga.key)) }
|
||||
suspend fun getSimilar(manga: SManga): MetadataMangasPage {
|
||||
val similarDto = withIOContext { similarService.getSimilarManga(MdUtil.getMangaId(manga.url)) }
|
||||
return similarDtoToMangaListPage(similarDto)
|
||||
}
|
||||
|
||||
@@ -31,14 +30,14 @@ class SimilarHandler(
|
||||
}
|
||||
|
||||
val mangaList = service.viewMangas(ids).data.map {
|
||||
MdUtil.createMangaEntry(it, lang).toSManga()
|
||||
MdUtil.createMangaEntry(it, lang)
|
||||
}
|
||||
|
||||
return MetadataMangasPage(mangaList, false, List(mangaList.size) { MangaDexSearchMetadata().also { it.relation = MangaDexRelation.SIMILAR } })
|
||||
}
|
||||
|
||||
suspend fun getRelated(manga: MangaInfo): MetadataMangasPage {
|
||||
val relatedListDto = withIOContext { service.relatedManga(MdUtil.getMangaId(manga.key)) }
|
||||
suspend fun getRelated(manga: SManga): MetadataMangasPage {
|
||||
val relatedListDto = withIOContext { service.relatedManga(MdUtil.getMangaId(manga.url)) }
|
||||
return relatedDtoToMangaListPage(relatedListDto)
|
||||
}
|
||||
|
||||
@@ -50,7 +49,7 @@ class SimilarHandler(
|
||||
.map { it.id }
|
||||
|
||||
val mangaList = service.viewMangas(ids).data.map {
|
||||
MdUtil.createMangaEntry(it, lang).toSManga()
|
||||
MdUtil.createMangaEntry(it, lang)
|
||||
}
|
||||
|
||||
return MetadataMangasPage(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package exh.md.similar
|
||||
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.manga.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.source.model.MetadataMangasPage
|
||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||
import eu.kanade.tachiyomi.ui.browse.source.browse.NoResultsException
|
||||
@@ -16,8 +15,8 @@ class MangaDexSimilarPager(val manga: Manga, val source: MangaDex) : Pager() {
|
||||
|
||||
override suspend fun requestNextPage() {
|
||||
val mangasPage = coroutineScope {
|
||||
val similarPageDef = async { source.getMangaSimilar(manga.toMangaInfo()) }
|
||||
val relatedPageDef = async { source.getMangaRelated(manga.toMangaInfo()) }
|
||||
val similarPageDef = async { source.getMangaSimilar(manga.toSManga()) }
|
||||
val relatedPageDef = async { source.getMangaRelated(manga.toSManga()) }
|
||||
val similarPage = similarPageDef.await()
|
||||
val relatedPage = relatedPageDef.await()
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package exh.md.utils
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.data.track.mdlist.MdList
|
||||
import eu.kanade.tachiyomi.source.SourceManager
|
||||
import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.all.MangaDex
|
||||
import exh.log.xLogD
|
||||
@@ -24,8 +25,6 @@ import okhttp3.MediaType.Companion.toMediaType
|
||||
import okhttp3.RequestBody
|
||||
import okhttp3.RequestBody.Companion.toRequestBody
|
||||
import org.jsoup.parser.Parser
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -233,7 +232,7 @@ class MdUtil {
|
||||
return scanlators.sorted().joinToString(scanlatorSeparator)
|
||||
}
|
||||
|
||||
fun getMissingChapterCount(chapters: List<ChapterInfo>, mangaStatus: Int): String? {
|
||||
fun getMissingChapterCount(chapters: List<SChapter>, mangaStatus: Int): String? {
|
||||
if (mangaStatus == SManga.COMPLETED) return null
|
||||
|
||||
val remove0ChaptersFromCount = chapters.distinctBy {
|
||||
@@ -242,14 +241,14 @@ class MdUtil {
|
||||
} else {*/
|
||||
it.name
|
||||
/*}*/
|
||||
}.sortedByDescending { it.number }
|
||||
}.sortedByDescending { it.chapter_number }
|
||||
|
||||
remove0ChaptersFromCount.firstOrNull()?.let { chapter ->
|
||||
val chpNumber = chapter.number.floor()
|
||||
val chpNumber = chapter.chapter_number.floor()
|
||||
val allChapters = (1..chpNumber).toMutableSet()
|
||||
|
||||
remove0ChaptersFromCount.forEach {
|
||||
allChapters.remove(it.number.floor())
|
||||
allChapters.remove(it.chapter_number.floor())
|
||||
}
|
||||
|
||||
if (allChapters.isEmpty()) return null
|
||||
@@ -264,11 +263,11 @@ class MdUtil {
|
||||
fun parseDate(dateAsString: String): Long =
|
||||
dateFormatter.parse(dateAsString)?.time ?: 0
|
||||
|
||||
fun createMangaEntry(json: MangaDataDto, lang: String): MangaInfo {
|
||||
return MangaInfo(
|
||||
key = buildMangaUrl(json.id),
|
||||
fun createMangaEntry(json: MangaDataDto, lang: String): SManga {
|
||||
return SManga(
|
||||
url = buildMangaUrl(json.id),
|
||||
title = cleanString(getTitleFromManga(json.attributes, lang)),
|
||||
cover = json.relationships
|
||||
thumbnail_url = json.relationships
|
||||
.firstOrNull { relationshipDto -> relationshipDto.type == MdConstants.Types.coverArt }
|
||||
?.attributes
|
||||
?.fileName
|
||||
|
||||
@@ -4,10 +4,11 @@ import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.MetadataUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.util.Date
|
||||
@@ -42,7 +43,7 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
var aged: Boolean = false
|
||||
var lastUpdateCheck: Long = 0
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = gId?.let { gId ->
|
||||
gToken?.let { gToken ->
|
||||
idAndTokenToUrl(gId, gToken)
|
||||
@@ -61,29 +62,29 @@ class EHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
?.joinToString { it.name }
|
||||
|
||||
// Copy tags -> genres
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
// Try to automatically identify if it is ongoing, we try not to be too lenient here to avoid making mistakes
|
||||
// We default to completed
|
||||
var status = MangaInfo.COMPLETED
|
||||
var status = SManga.COMPLETED
|
||||
title?.let { t ->
|
||||
MetadataUtil.ONGOING_SUFFIX.find {
|
||||
t.endsWith(it, ignoreCase = true)
|
||||
}?.let {
|
||||
status = MangaInfo.ONGOING
|
||||
status = SManga.ONGOING
|
||||
}
|
||||
}
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
url = key ?: manga.url,
|
||||
title = title ?: manga.title,
|
||||
artist = artist ?: manga.artist,
|
||||
description = description,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
status = status,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,11 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import exh.util.nullIfEmpty
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Serializable
|
||||
class EightMusesSearchMetadata : RaisedSearchMetadata() {
|
||||
@@ -15,7 +16,7 @@ class EightMusesSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
var thumbnailUrl: String? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = path.joinToString("/", prefix = "/")
|
||||
|
||||
val title = title
|
||||
@@ -24,16 +25,16 @@ class EightMusesSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
val artist = tags.ofNamespace(ARTIST_NAMESPACE).joinToString { it.name }
|
||||
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key,
|
||||
url = key,
|
||||
title = title ?: manga.title,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
artist = artist,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Serializable
|
||||
class HBrowseSearchMetadata : RaisedSearchMetadata() {
|
||||
@@ -19,28 +20,28 @@ class HBrowseSearchMetadata : RaisedSearchMetadata() {
|
||||
// Length in pages
|
||||
var length: Int? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = hbUrl
|
||||
|
||||
val title = title
|
||||
|
||||
// Guess thumbnail URL if manga does not have thumbnail URL
|
||||
val cover = if (manga.cover.isBlank()) {
|
||||
val cover = if (manga.thumbnail_url.isNullOrBlank()) {
|
||||
guessThumbnailUrl(hbId.toString())
|
||||
} else null
|
||||
|
||||
val artist = tags.ofNamespace(ARTIST_NAMESPACE).joinToString { it.name }
|
||||
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
url = key ?: manga.url,
|
||||
title = title ?: manga.title,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
artist = artist,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,11 +2,12 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.MetadataUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import exh.util.nullIfEmpty
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import java.util.Date
|
||||
|
||||
@Serializable
|
||||
@@ -32,24 +33,24 @@ class HitomiSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
var uploadDate: Long? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val cover = thumbnailUrl
|
||||
|
||||
val title = title
|
||||
|
||||
// Copy tags -> genres
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val artist = artists.joinToString()
|
||||
|
||||
val status = MangaInfo.UNKNOWN
|
||||
val status = SManga.UNKNOWN
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
title = title ?: manga.title,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
artist = artist,
|
||||
status = status,
|
||||
description = description,
|
||||
|
||||
@@ -2,11 +2,12 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.md.utils.MangaDexRelation
|
||||
import exh.md.utils.MdUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Serializable
|
||||
class MangaDexSearchMetadata : RaisedSearchMetadata() {
|
||||
@@ -45,7 +46,7 @@ class MangaDexSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
// var maxChapterNumber: Int? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = mdUuid?.let { MdUtil.buildMangaUrl(it) }
|
||||
|
||||
val title = title
|
||||
@@ -58,18 +59,18 @@ class MangaDexSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
val status = status
|
||||
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = description
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
url = key ?: manga.url,
|
||||
title = title ?: manga.title,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
author = author ?: manga.author,
|
||||
artist = artist ?: manga.artist,
|
||||
status = status ?: manga.status,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description ?: manga.description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@ package exh.metadata.metadata
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.MetadataUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import java.util.Date
|
||||
|
||||
@Serializable
|
||||
@@ -38,7 +38,7 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
var preferredTitle: Int? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = nhId?.let { nhIdToPath(it) }
|
||||
|
||||
val cover = if (mediaId != null) {
|
||||
@@ -59,7 +59,7 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
}
|
||||
|
||||
// Copy tags -> genres
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
// Try to automatically identify if it is ongoing, we try not to be too lenient here to avoid making mistakes
|
||||
// We default to completed
|
||||
@@ -75,11 +75,11 @@ class NHentaiSearchMetadata : RaisedSearchMetadata() {
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
cover = cover ?: manga.cover,
|
||||
url = key ?: manga.url,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
title = title,
|
||||
artist = artist ?: manga.artist,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
status = status,
|
||||
description = description,
|
||||
)
|
||||
|
||||
@@ -3,11 +3,12 @@ package exh.metadata.metadata
|
||||
import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import exh.metadata.metadata.base.RaisedTitle
|
||||
import exh.util.nullIfEmpty
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Serializable
|
||||
class PervEdenSearchMetadata : RaisedSearchMetadata() {
|
||||
@@ -34,7 +35,7 @@ class PervEdenSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
var lang: String? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = url
|
||||
val cover = thumbnailUrl
|
||||
|
||||
@@ -43,23 +44,23 @@ class PervEdenSearchMetadata : RaisedSearchMetadata() {
|
||||
val artist = artist
|
||||
|
||||
val status = when (status) {
|
||||
"Ongoing" -> MangaInfo.ONGOING
|
||||
"Completed", "Suspended" -> MangaInfo.COMPLETED
|
||||
else -> MangaInfo.UNKNOWN
|
||||
"Ongoing" -> SManga.ONGOING
|
||||
"Completed", "Suspended" -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
|
||||
// Copy tags -> genres
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
cover = cover ?: manga.cover,
|
||||
url = key ?: manga.url,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
title = title ?: manga.title,
|
||||
artist = artist ?: manga.artist,
|
||||
status = status,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,9 +2,10 @@ package exh.metadata.metadata
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Serializable
|
||||
class PururinSearchMetadata : RaisedSearchMetadata() {
|
||||
@@ -26,7 +27,7 @@ class PururinSearchMetadata : RaisedSearchMetadata() {
|
||||
var ratingCount: Int? = null
|
||||
var averageRating: Double? = null
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val key = prId?.let { prId ->
|
||||
prShortLink?.let { prShortLink ->
|
||||
"/gallery/$prId/$prShortLink"
|
||||
@@ -39,16 +40,16 @@ class PururinSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
val artist = tags.ofNamespace(TAG_NAMESPACE_ARTIST).joinToString { it.name }
|
||||
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
key = key ?: manga.key,
|
||||
url = key ?: manga.url,
|
||||
title = title ?: manga.title,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
artist = artist,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -4,11 +4,11 @@ import android.content.Context
|
||||
import androidx.core.net.toUri
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.copy
|
||||
import exh.metadata.MetadataUtil
|
||||
import exh.metadata.metadata.base.RaisedSearchMetadata
|
||||
import exh.util.nullIfEmpty
|
||||
import kotlinx.serialization.Serializable
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import java.util.Locale
|
||||
@@ -43,7 +43,7 @@ class TsuminoSearchMetadata : RaisedSearchMetadata() {
|
||||
|
||||
var character: List<String> = emptyList()
|
||||
|
||||
override fun createMangaInfo(manga: MangaInfo): MangaInfo {
|
||||
override fun createMangaInfo(manga: SManga): SManga {
|
||||
val title = title
|
||||
val cover = tmId?.let { BASE_URL.replace("www", "content") + thumbUrlFromId(it.toString()) }
|
||||
|
||||
@@ -52,16 +52,16 @@ class TsuminoSearchMetadata : RaisedSearchMetadata() {
|
||||
val status = SManga.UNKNOWN
|
||||
|
||||
// Copy tags -> genres
|
||||
val genres = tagsToGenreList()
|
||||
val genres = tagsToGenreString()
|
||||
|
||||
val description = "meta"
|
||||
|
||||
return manga.copy(
|
||||
title = title ?: manga.title,
|
||||
cover = cover ?: manga.cover,
|
||||
thumbnail_url = cover ?: manga.thumbnail_url,
|
||||
artist = artist ?: manga.artist,
|
||||
status = status,
|
||||
genres = genres,
|
||||
genre = genres,
|
||||
description = description,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package exh.metadata.metadata.base
|
||||
|
||||
import android.content.Context
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.model.toMangaInfo
|
||||
import eu.kanade.tachiyomi.source.model.toSManga
|
||||
import exh.metadata.metadata.EHentaiSearchMetadata
|
||||
import exh.metadata.metadata.EightMusesSearchMetadata
|
||||
import exh.metadata.metadata.HBrowseSearchMetadata
|
||||
@@ -25,7 +23,6 @@ import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.modules.SerializersModule
|
||||
import kotlinx.serialization.modules.polymorphic
|
||||
import kotlinx.serialization.modules.subclass
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import kotlin.properties.ReadWriteProperty
|
||||
import kotlin.reflect.KProperty
|
||||
|
||||
@@ -64,11 +61,11 @@ abstract class RaisedSearchMetadata {
|
||||
}
|
||||
|
||||
open fun copyTo(manga: SManga) {
|
||||
val infoManga = createMangaInfo(manga.toMangaInfo()).toSManga()
|
||||
val infoManga = createMangaInfo(manga.copy())
|
||||
manga.copyFrom(infoManga)
|
||||
}
|
||||
|
||||
abstract fun createMangaInfo(manga: MangaInfo): MangaInfo
|
||||
abstract fun createMangaInfo(manga: SManga): SManga
|
||||
|
||||
fun tagsToGenreString() = tags.toGenreString()
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@ import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
|
||||
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||
abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
@@ -183,6 +181,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to be updated.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getMangaDetails"))
|
||||
override fun fetchMangaDetails(manga: SManga): Observable<SManga> {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.fetchMangaDetails(manga)
|
||||
@@ -191,7 +190,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
/**
|
||||
* [1.x API] Get the updated details for a manga.
|
||||
*/
|
||||
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo {
|
||||
override suspend fun getMangaDetails(manga: SManga): SManga {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.getMangaDetails(manga)
|
||||
}
|
||||
@@ -213,6 +212,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
*
|
||||
* @param manga the manga to look for chapters.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getChapterList"))
|
||||
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.fetchChapterList(manga)
|
||||
@@ -221,7 +221,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
/**
|
||||
* [1.x API] Get all the available chapters for a manga.
|
||||
*/
|
||||
override suspend fun getChapterList(manga: MangaInfo): List<ChapterInfo> {
|
||||
override suspend fun getChapterList(manga: SManga): List<SChapter> {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.getChapterList(manga)
|
||||
}
|
||||
@@ -231,6 +231,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
*
|
||||
* @param chapter the chapter whose page list has to be fetched.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
|
||||
override fun fetchPageList(chapter: SChapter): Observable<List<Page>> {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.fetchPageList(chapter)
|
||||
@@ -239,7 +240,7 @@ abstract class DelegatedHttpSource(val delegate: HttpSource) : HttpSource() {
|
||||
/**
|
||||
* [1.x API] Get the list of pages a chapter has.
|
||||
*/
|
||||
override suspend fun getPageList(chapter: ChapterInfo): List<tachiyomi.source.model.Page> {
|
||||
override suspend fun getPageList(chapter: SChapter): List<Page> {
|
||||
ensureDelegateCompatible()
|
||||
return delegate.getPageList(chapter)
|
||||
}
|
||||
|
||||
@@ -8,8 +8,6 @@ import eu.kanade.tachiyomi.source.model.SChapter
|
||||
import eu.kanade.tachiyomi.source.model.SManga
|
||||
import eu.kanade.tachiyomi.source.online.HttpSource
|
||||
import okhttp3.Response
|
||||
import tachiyomi.source.model.ChapterInfo
|
||||
import tachiyomi.source.model.MangaInfo
|
||||
import uy.kohesive.injekt.injectLazy
|
||||
|
||||
@Suppress("OverridingDeprecatedMember", "DEPRECATION")
|
||||
@@ -177,12 +175,13 @@ class EnhancedHttpSource(
|
||||
*
|
||||
* @param manga the manga to be updated.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getMangaDetails"))
|
||||
override fun fetchMangaDetails(manga: SManga) = source().fetchMangaDetails(manga)
|
||||
|
||||
/**
|
||||
* [1.x API] Get the updated details for a manga.
|
||||
*/
|
||||
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo = source().getMangaDetails(manga)
|
||||
override suspend fun getMangaDetails(manga: SManga): SManga = source().getMangaDetails(manga)
|
||||
|
||||
/**
|
||||
* Returns the request for the details of a manga. Override only if it's needed to change the
|
||||
@@ -198,24 +197,26 @@ class EnhancedHttpSource(
|
||||
*
|
||||
* @param manga the manga to look for chapters.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getChapterList"))
|
||||
override fun fetchChapterList(manga: SManga) = source().fetchChapterList(manga)
|
||||
|
||||
/**
|
||||
* [1.x API] Get all the available chapters for a manga.
|
||||
*/
|
||||
override suspend fun getChapterList(manga: MangaInfo): List<ChapterInfo> = source().getChapterList(manga)
|
||||
override suspend fun getChapterList(manga: SManga): List<SChapter> = source().getChapterList(manga)
|
||||
|
||||
/**
|
||||
* Returns an observable with the page list for a chapter.
|
||||
*
|
||||
* @param chapter the chapter whose page list has to be fetched.
|
||||
*/
|
||||
@Deprecated("Use the 1.x API instead", replaceWith = ReplaceWith("getPageList"))
|
||||
override fun fetchPageList(chapter: SChapter) = source().fetchPageList(chapter)
|
||||
|
||||
/**
|
||||
* [1.x API] Get the list of pages a chapter has.
|
||||
*/
|
||||
override suspend fun getPageList(chapter: ChapterInfo): List<tachiyomi.source.model.Page> = source().getPageList(chapter)
|
||||
override suspend fun getPageList(chapter: SChapter): List<Page> = source().getPageList(chapter)
|
||||
|
||||
/**
|
||||
* Returns an observable with the page containing the source url of the image. If there's any
|
||||
|
||||
Reference in New Issue
Block a user