mirror of
https://github.com/aniyomiorg/aniyomi.git
synced 2024-11-26 14:53:41 +03:00
Suwayomi Tracker: sync changes with Tachidesk v0.6.6 (#8902)
* Suwayomi Tracker: sync changes with Tachidesk v0.6.6 * replace var with val
This commit is contained in:
parent
8c494f314c
commit
c54d77333f
3 changed files with 32 additions and 25 deletions
|
@ -88,7 +88,12 @@ class Suwayomi(private val context: Context, id: Long) : TrackService(id), Enhan
|
||||||
|
|
||||||
override fun getAcceptedSources(): List<String> = listOf("eu.kanade.tachiyomi.extension.all.tachidesk.Tachidesk")
|
override fun getAcceptedSources(): List<String> = listOf("eu.kanade.tachiyomi.extension.all.tachidesk.Tachidesk")
|
||||||
|
|
||||||
override suspend fun match(manga: DomainManga): TrackSearch = api.getTrackSearch(manga.url)
|
override suspend fun match(manga: DomainManga): TrackSearch? =
|
||||||
|
try {
|
||||||
|
api.getTrackSearch(manga.url)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
|
||||||
override fun isTrackFrom(track: DomainTrack, manga: DomainManga, source: Source?): Boolean = source?.let { accept(it) } == true
|
override fun isTrackFrom(track: DomainTrack, manga: DomainManga, source: Source?): Boolean = source?.let { accept(it) } == true
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,6 @@ class TachideskApi {
|
||||||
.dns(Dns.SYSTEM) // don't use DNS over HTTPS as it breaks IP addressing
|
.dns(Dns.SYSTEM) // don't use DNS over HTTPS as it breaks IP addressing
|
||||||
.build()
|
.build()
|
||||||
fun headersBuilder(): Headers.Builder = Headers.Builder().apply {
|
fun headersBuilder(): Headers.Builder = Headers.Builder().apply {
|
||||||
add("User-Agent", network.defaultUserAgent)
|
|
||||||
if (basePassword.isNotEmpty() && baseLogin.isNotEmpty()) {
|
if (basePassword.isNotEmpty() && baseLogin.isNotEmpty()) {
|
||||||
val credentials = Credentials.basic(baseLogin, basePassword)
|
val credentials = Credentials.basic(baseLogin, basePassword)
|
||||||
add("Authorization", credentials)
|
add("Authorization", credentials)
|
||||||
|
@ -56,7 +55,7 @@ class TachideskApi {
|
||||||
TrackSearch.create(TrackManager.SUWAYOMI).apply {
|
TrackSearch.create(TrackManager.SUWAYOMI).apply {
|
||||||
title = manga.title
|
title = manga.title
|
||||||
cover_url = "$url/thumbnail"
|
cover_url = "$url/thumbnail"
|
||||||
summary = manga.description
|
summary = manga.description.orEmpty()
|
||||||
tracking_url = url
|
tracking_url = url
|
||||||
total_chapters = manga.chapterCount.toInt()
|
total_chapters = manga.chapterCount.toInt()
|
||||||
publishing_status = manga.status
|
publishing_status = manga.status
|
||||||
|
|
|
@ -5,21 +5,21 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SourceDataClass(
|
data class SourceDataClass(
|
||||||
val id: String,
|
val id: String,
|
||||||
val name: String?,
|
val name: String,
|
||||||
val lang: String?,
|
val lang: String,
|
||||||
val iconUrl: String?,
|
val iconUrl: String,
|
||||||
|
|
||||||
/** The Source provides a latest listing */
|
/** The Source provides a latest listing */
|
||||||
val supportsLatest: Boolean?,
|
val supportsLatest: Boolean,
|
||||||
|
|
||||||
/** The Source implements [ConfigurableSource] */
|
/** The Source implements [ConfigurableSource] */
|
||||||
val isConfigurable: Boolean?,
|
val isConfigurable: Boolean,
|
||||||
|
|
||||||
/** The Source class has a @Nsfw annotation */
|
/** The Source class has a @Nsfw annotation */
|
||||||
val isNsfw: Boolean?,
|
val isNsfw: Boolean,
|
||||||
|
|
||||||
/** A nicer version of [name] */
|
/** A nicer version of [name] */
|
||||||
val displayName: String?,
|
val displayName: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -29,33 +29,33 @@ data class MangaDataClass(
|
||||||
|
|
||||||
val url: String,
|
val url: String,
|
||||||
val title: String,
|
val title: String,
|
||||||
val thumbnailUrl: String,
|
val thumbnailUrl: String?,
|
||||||
|
|
||||||
val initialized: Boolean,
|
val initialized: Boolean,
|
||||||
|
|
||||||
val artist: String,
|
val artist: String?,
|
||||||
val author: String,
|
val author: String?,
|
||||||
val description: String,
|
val description: String?,
|
||||||
val genre: List<String>,
|
val genre: List<String>,
|
||||||
val status: String,
|
val status: String,
|
||||||
val inLibrary: Boolean,
|
val inLibrary: Boolean,
|
||||||
val inLibraryAt: Long,
|
val inLibraryAt: Long,
|
||||||
val source: SourceDataClass,
|
val source: SourceDataClass?,
|
||||||
|
|
||||||
val meta: Map<String, String> = emptyMap(),
|
val meta: Map<String, String>,
|
||||||
|
|
||||||
val realUrl: String,
|
val realUrl: String?,
|
||||||
var lastFetchedAt: Long,
|
val lastFetchedAt: Long?,
|
||||||
var chaptersLastFetchedAt: Long,
|
val chaptersLastFetchedAt: Long?,
|
||||||
|
|
||||||
val freshData: Boolean,
|
val freshData: Boolean,
|
||||||
val unreadCount: Long,
|
val unreadCount: Long?,
|
||||||
val downloadCount: Long,
|
val downloadCount: Long?,
|
||||||
val chapterCount: Long,
|
val chapterCount: Long, // actually is nullable server side, but should be set at this time
|
||||||
val lastChapterRead: ChapterDataClass?,
|
val lastChapterRead: ChapterDataClass?,
|
||||||
|
|
||||||
val age: Long,
|
val age: Long?,
|
||||||
val chaptersAge: Long,
|
val chaptersAge: Long?,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -93,5 +93,8 @@ data class ChapterDataClass(
|
||||||
val pageCount: Int,
|
val pageCount: Int,
|
||||||
|
|
||||||
/** total chapter count, used to calculate if there's a next and prev chapter */
|
/** total chapter count, used to calculate if there's a next and prev chapter */
|
||||||
val chapterCount: Int,
|
val chapterCount: Int?,
|
||||||
|
|
||||||
|
/** used to store client specific values */
|
||||||
|
val meta: Map<String, String>,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue