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:
Aria Moradi 2023-01-14 07:01:04 +03:30 committed by GitHub
parent 8c494f314c
commit c54d77333f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 25 deletions

View File

@ -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 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

View File

@ -29,7 +29,6 @@ class TachideskApi {
.dns(Dns.SYSTEM) // don't use DNS over HTTPS as it breaks IP addressing
.build()
fun headersBuilder(): Headers.Builder = Headers.Builder().apply {
add("User-Agent", network.defaultUserAgent)
if (basePassword.isNotEmpty() && baseLogin.isNotEmpty()) {
val credentials = Credentials.basic(baseLogin, basePassword)
add("Authorization", credentials)
@ -56,7 +55,7 @@ class TachideskApi {
TrackSearch.create(TrackManager.SUWAYOMI).apply {
title = manga.title
cover_url = "$url/thumbnail"
summary = manga.description
summary = manga.description.orEmpty()
tracking_url = url
total_chapters = manga.chapterCount.toInt()
publishing_status = manga.status

View File

@ -5,21 +5,21 @@ import kotlinx.serialization.Serializable
@Serializable
data class SourceDataClass(
val id: String,
val name: String?,
val lang: String?,
val iconUrl: String?,
val name: String,
val lang: String,
val iconUrl: String,
/** The Source provides a latest listing */
val supportsLatest: Boolean?,
val supportsLatest: Boolean,
/** The Source implements [ConfigurableSource] */
val isConfigurable: Boolean?,
val isConfigurable: Boolean,
/** The Source class has a @Nsfw annotation */
val isNsfw: Boolean?,
val isNsfw: Boolean,
/** A nicer version of [name] */
val displayName: String?,
val displayName: String,
)
@Serializable
@ -29,33 +29,33 @@ data class MangaDataClass(
val url: String,
val title: String,
val thumbnailUrl: String,
val thumbnailUrl: String?,
val initialized: Boolean,
val artist: String,
val author: String,
val description: String,
val artist: String?,
val author: String?,
val description: String?,
val genre: List<String>,
val status: String,
val inLibrary: Boolean,
val inLibraryAt: Long,
val source: SourceDataClass,
val source: SourceDataClass?,
val meta: Map<String, String> = emptyMap(),
val meta: Map<String, String>,
val realUrl: String,
var lastFetchedAt: Long,
var chaptersLastFetchedAt: Long,
val realUrl: String?,
val lastFetchedAt: Long?,
val chaptersLastFetchedAt: Long?,
val freshData: Boolean,
val unreadCount: Long,
val downloadCount: Long,
val chapterCount: Long,
val unreadCount: Long?,
val downloadCount: Long?,
val chapterCount: Long, // actually is nullable server side, but should be set at this time
val lastChapterRead: ChapterDataClass?,
val age: Long,
val chaptersAge: Long,
val age: Long?,
val chaptersAge: Long?,
)
@Serializable
@ -93,5 +93,8 @@ data class ChapterDataClass(
val pageCount: Int,
/** 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>,
)