Allow to change chapter fields before inserting to database. Update Kotlin to 1.0.5
This commit is contained in:
parent
d183aca810
commit
f98095e6cb
@ -200,7 +200,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '1.0.4'
|
ext.kotlin_version = '1.0.5'
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
@ -461,8 +461,14 @@ abstract class OnlineSource() : Source {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Overridable method to allow custom parsing.
|
/**
|
||||||
open fun parseChapterNumber(chapter: Chapter) {
|
* Called before inserting a new chapter into database. Use it if you need to override chapter
|
||||||
|
* fields, like the title or the chapter number. Do not change anything to [manga].
|
||||||
|
*
|
||||||
|
* @param chapter the chapter to be added.
|
||||||
|
* @param manga the manga of the chapter.
|
||||||
|
*/
|
||||||
|
open fun prepareNewChapter(chapter: Chapter, manga: Manga) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class Mintmanga(override val id: Int) : ParsedOnlineSource() {
|
|||||||
} ?: 0
|
} ?: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun parseChapterNumber(chapter: Chapter) {
|
override fun prepareNewChapter(chapter: Chapter, manga: Manga) {
|
||||||
chapter.chapter_number = -2f
|
chapter.chapter_number = -2f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ class Readmanga(override val id: Int) : ParsedOnlineSource() {
|
|||||||
} ?: 0
|
} ?: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun parseChapterNumber(chapter: Chapter) {
|
override fun prepareNewChapter(chapter: Chapter, manga: Manga) {
|
||||||
chapter.chapter_number = -2f
|
chapter.chapter_number = -2f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ fun syncChaptersWithSource(db: DatabaseHelper,
|
|||||||
// Recognize number for new chapters.
|
// Recognize number for new chapters.
|
||||||
toAdd.forEach {
|
toAdd.forEach {
|
||||||
if (source is OnlineSource) {
|
if (source is OnlineSource) {
|
||||||
source.parseChapterNumber(it)
|
source.prepareNewChapter(it, manga)
|
||||||
}
|
}
|
||||||
ChapterRecognition.parseChapterNumber(it, manga)
|
ChapterRecognition.parseChapterNumber(it, manga)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user