forked from az4521/TachiyomiAZ
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Barebones setup (only AniList works) * Show tracker selection dialog when entry has more than one tracker * MangaUpdates implementation * Add logging and toast on error. * MyAnimeList implementation * Kitsu implementation * Fix MAL authors and artists * Decode AL description * Throw NotImplementedError instead of returning null * Use logcat from LogcatExtensions * Replace strings with MR strings * Missed a string * Delete unused Author class. * Add Bangumi & Shikimori support for info edit (#2) This adds the necessary API calls and DTOs to allow for editing an entry's data to the data from a tracker, specifically adding support for Bangumi and Shikimori. * Exclude enhanced trackers from tracker select dialog * MdList implementation * Remember getTracks and trackerManager Co-authored-by: jobobby04 <[email protected]> --------- Co-authored-by: MajorTanya <[email protected]> Co-authored-by: jobobby04 <[email protected]>
- Loading branch information
1 parent
34e9d9f
commit fd120c5
Showing
28 changed files
with
783 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/src/main/java/eu/kanade/tachiyomi/data/track/anilist/dto/ALMangaMetadata.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package eu.kanade.tachiyomi.data.track.anilist.dto | ||
|
||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
|
||
@Serializable | ||
data class ALMangaMetadata( | ||
val data: ALMangaMetadataData, | ||
) | ||
|
||
@Serializable | ||
data class ALMangaMetadataData( | ||
@SerialName("Media") | ||
val media: ALMangaMetadataMedia, | ||
) | ||
|
||
@Serializable | ||
data class ALMangaMetadataMedia( | ||
val id: Long, | ||
val title: ALItemTitle, | ||
val coverImage: ItemCover, | ||
val description: String?, | ||
val staff: ALStaff, | ||
) | ||
|
||
@Serializable | ||
data class ALStaff( | ||
val edges: List<ALStaffEdge>, | ||
) | ||
|
||
@Serializable | ||
data class ALStaffEdge( | ||
val role: String, | ||
val node: ALStaffNode, | ||
) | ||
|
||
@Serializable | ||
data class ALStaffNode( | ||
val name: ALItemTitle, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
app/src/main/java/eu/kanade/tachiyomi/data/track/bangumi/dto/BGMSubject.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package eu.kanade.tachiyomi.data.track.bangumi.dto | ||
|
||
import kotlinx.serialization.DeserializationStrategy | ||
import kotlinx.serialization.SerialName | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.SerializationException | ||
import kotlinx.serialization.json.JsonArray | ||
import kotlinx.serialization.json.JsonContentPolymorphicSerializer | ||
import kotlinx.serialization.json.JsonElement | ||
import kotlinx.serialization.json.JsonObject | ||
import kotlinx.serialization.json.JsonPrimitive | ||
|
||
@Serializable | ||
data class BGMSubject( | ||
val images: BGMSearchItemCovers?, | ||
val summary: String, | ||
val name: String, | ||
@SerialName("name_cn") | ||
val nameCn: String, | ||
val infobox: List<Infobox>, | ||
val id: Long, | ||
) | ||
|
||
// infobox deserializer and related classes courtesy of | ||
// https://github.com/Snd-R/komf/blob/4c260a3dcd326a5e1d74ac9662eec8124ab7e461/komf-core/src/commonMain/kotlin/snd/komf/providers/bangumi/model/BangumiSubject.kt#L53-L89 | ||
object InfoBoxSerializer : JsonContentPolymorphicSerializer<Infobox>(Infobox::class) { | ||
override fun selectDeserializer(element: JsonElement): DeserializationStrategy<Infobox> { | ||
if (element !is JsonObject) throw SerializationException("Expected JsonObject go ${element::class}") | ||
val value = element["value"] | ||
|
||
return when (value) { | ||
is JsonArray -> Infobox.MultipleValues.serializer() | ||
is JsonPrimitive -> Infobox.SingleValue.serializer() | ||
else -> throw SerializationException("Unexpected element type ${element::class}") | ||
} | ||
} | ||
} | ||
|
||
@Serializable(with = InfoBoxSerializer::class) | ||
sealed interface Infobox { | ||
val key: String | ||
|
||
@Serializable | ||
class SingleValue( | ||
override val key: String, | ||
val value: String, | ||
) : Infobox | ||
|
||
@Serializable | ||
class MultipleValues( | ||
override val key: String, | ||
val value: List<InfoboxNestedValue>, | ||
) : Infobox | ||
} | ||
|
||
@Serializable | ||
data class InfoboxNestedValue( | ||
@SerialName("k") | ||
val key: String? = null, | ||
@SerialName("v") | ||
val value: String, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.