Remove 1.x source models (#7781)

This commit is contained in:
stevenyomi
2022-08-19 02:07:13 +08:00
committed by GitHub
parent 4228bbb88e
commit e36e9d9d5c
17 changed files with 92 additions and 225 deletions
@@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.network.ProgressListener
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import rx.subjects.Subject
import tachiyomi.source.model.PageUrl
@Serializable
open class Page(
@@ -65,16 +64,3 @@ open class Page(
const val ERROR = 4
}
}
fun Page.toPageUrl(): PageUrl {
return PageUrl(
url = this.imageUrl ?: this.url,
)
}
fun PageUrl.toPage(index: Int): Page {
return Page(
index = index,
imageUrl = this.url,
)
}
@@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.source.model
import data.Chapters
import tachiyomi.source.model.ChapterInfo
import java.io.Serializable
interface SChapter : Serializable {
@@ -38,24 +37,3 @@ interface SChapter : Serializable {
}
}
}
fun SChapter.toChapterInfo(): ChapterInfo {
return ChapterInfo(
dateUpload = this.date_upload,
key = this.url,
name = this.name,
number = this.chapter_number,
scanlator = this.scanlator ?: "",
)
}
fun ChapterInfo.toSChapter(): SChapter {
val chapter = this
return SChapter.create().apply {
url = chapter.key
name = chapter.name
date_upload = chapter.dateUpload
chapter_number = chapter.number
scanlator = chapter.scanlator
}
}
@@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.source.model
import data.Mangas
import tachiyomi.source.model.MangaInfo
import java.io.Serializable
interface SManga : Serializable {
@@ -85,6 +84,18 @@ interface SManga : Serializable {
}
}
fun copy() = create().also {
it.url = url
it.title = title
it.artist = artist
it.author = author
it.description = description
it.genre = genre
it.status = status
it.thumbnail_url = thumbnail_url
it.initialized = initialized
}
companion object {
const val UNKNOWN = 0
const val ONGOING = 1
@@ -99,30 +110,3 @@ interface SManga : Serializable {
}
}
}
fun SManga.toMangaInfo(): MangaInfo {
return MangaInfo(
key = this.url,
title = this.title,
artist = this.artist ?: "",
author = this.author ?: "",
description = this.description ?: "",
genres = this.getGenres() ?: emptyList(),
status = this.status,
cover = this.thumbnail_url ?: "",
)
}
fun MangaInfo.toSManga(): SManga {
val mangaInfo = this
return SManga.create().apply {
url = mangaInfo.key
title = mangaInfo.title
artist = mangaInfo.artist
author = mangaInfo.author
description = mangaInfo.description
genre = mangaInfo.genres.joinToString(", ")
status = mangaInfo.status
thumbnail_url = mangaInfo.cover
}
}