Initial support for external sources

This commit is contained in:
inorichi
2017-01-08 18:12:19 +01:00
committed by GitHub
parent 77d986f213
commit dd56d7c0bb
60 changed files with 1371 additions and 1126 deletions
@@ -69,7 +69,7 @@ open class MangaGetResolver : DefaultGetResolver<Manga>() {
override fun mapFromCursor(cursor: Cursor): Manga = MangaImpl().apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
source = cursor.getInt(cursor.getColumnIndex(COL_SOURCE))
source = cursor.getLong(cursor.getColumnIndex(COL_SOURCE))
url = cursor.getString(cursor.getColumnIndex(COL_URL))
artist = cursor.getString(cursor.getColumnIndex(COL_ARTIST))
author = cursor.getString(cursor.getColumnIndex(COL_AUTHOR))
@@ -1,17 +1,14 @@
package eu.kanade.tachiyomi.data.database.models
import eu.kanade.tachiyomi.data.source.model.SChapter
import java.io.Serializable
interface Chapter : Serializable {
interface Chapter : SChapter, Serializable {
var id: Long?
var manga_id: Long?
var url: String
var name: String
var read: Boolean
var bookmark: Boolean
@@ -20,10 +17,6 @@ interface Chapter : Serializable {
var date_fetch: Long
var date_upload: Long
var chapter_number: Float
var source_order: Int
val isRecognizedNumber: Boolean
@@ -1,35 +1,17 @@
package eu.kanade.tachiyomi.data.database.models
import java.io.Serializable
import eu.kanade.tachiyomi.data.source.model.SManga
interface Manga : Serializable {
interface Manga : SManga {
var id: Long?
var source: Int
var url: String
var title: String
var artist: String?
var author: String?
var description: String?
var genre: String?
var status: Int
var thumbnail_url: String?
var source: Long
var favorite: Boolean
var last_update: Long
var initialized: Boolean
var viewer: Int
var chapter_flags: Int
@@ -38,27 +20,6 @@ interface Manga : Serializable {
var category: Int
fun copyFrom(other: Manga) {
if (other.author != null)
author = other.author
if (other.artist != null)
artist = other.artist
if (other.description != null)
description = other.description
if (other.genre != null)
genre = other.genre
if (other.thumbnail_url != null)
thumbnail_url = other.thumbnail_url
status = other.status
initialized = true
}
fun setChapterOrder(order: Int) {
setFlags(order, SORT_MASK)
}
@@ -94,11 +55,6 @@ interface Manga : Serializable {
companion object {
const val UNKNOWN = 0
const val ONGOING = 1
const val COMPLETED = 2
const val LICENSED = 3
const val SORT_DESC = 0x00000000
const val SORT_ASC = 0x00000001
const val SORT_MASK = 0x00000001
@@ -126,12 +82,13 @@ interface Manga : Serializable {
const val DISPLAY_NUMBER = 0x00100000
const val DISPLAY_MASK = 0x00100000
fun create(source: Int): Manga = MangaImpl().apply {
fun create(source: Long): Manga = MangaImpl().apply {
this.source = source
}
fun create(pathUrl: String, source: Int = 0): Manga = MangaImpl().apply {
fun create(pathUrl: String, title: String, source: Long = 0): Manga = MangaImpl().apply {
url = pathUrl
this.title = title
this.source = source
}
}
@@ -4,7 +4,7 @@ class MangaImpl : Manga {
override var id: Long? = null
override var source: Int = 0
override var source: Long = 0
override lateinit var url: String
@@ -40,7 +40,7 @@ interface MangaQueries : DbProvider {
.build())
.prepare()
fun getManga(url: String, sourceId: Int) = db.get()
fun getManga(url: String, sourceId: Long) = db.get()
.`object`(Manga::class.java)
.withQuery(Query.builder()
.table(MangaTable.TABLE)