-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
210 additions
and
7 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
31 changes: 31 additions & 0 deletions
31
src/main/kotlin/com/truedev/kinoposk/api/model/deserializer/StringToEpisodes.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,31 @@ | ||
package com.truedev.kinoposk.api.model.deserializer | ||
|
||
import com.fasterxml.jackson.core.JsonParser | ||
import com.fasterxml.jackson.databind.DeserializationContext | ||
import com.fasterxml.jackson.databind.JsonDeserializer | ||
import com.fasterxml.jackson.databind.JsonNode | ||
import com.fasterxml.jackson.databind.node.ArrayNode | ||
import com.truedev.kinoposk.api.model.tvshow.Episode | ||
import java.time.LocalDate | ||
|
||
class StringToEpisodes : JsonDeserializer<List<Episode>>() { | ||
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): List<Episode> { | ||
val node: Any = p.readValueAsTree<JsonNode>() | ||
|
||
return (node as ArrayNode).toList() | ||
.map { it.get("episode") } | ||
.map { | ||
Episode( | ||
id = it.get("id").asInt(), | ||
seasonNumber = it.get("seasonNumber").asInt(), | ||
episodeNumber = it.get("episodeNumber").asInt(), | ||
name = it.get("name").asText().ifBlank { null }, | ||
nameEng = it.get("nameEng").asText().ifBlank { null }, | ||
synopsis = it.get("synopsis")?.asText(), | ||
releaseDate = it.get("releaseDate") | ||
?.let { releaseDate -> LocalDate.parse(releaseDate.asText()) }, | ||
dateAccuracy = it.get("dateAccuracy")?.asText() | ||
) | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/ContextData.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,32 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.annotation.JsonProperty | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class ContextData( | ||
val id: Int, | ||
val slug: String?, | ||
val title: String, | ||
val originalTitle: String?, | ||
val normalizedTitle: String?, | ||
val year: Int, | ||
val years: List<Year> = listOf(), | ||
val rating: Rating, | ||
val expectations: Expectations, | ||
val currentRating: String, | ||
// todo enum EXPECTATIONS,RATING | ||
val type: String, | ||
val serial: Boolean, | ||
val shortFilm: Boolean, | ||
val completed: Boolean, | ||
val genres: List<Genre> = listOf(), | ||
val countries: List<Country> = listOf(), | ||
val duration: Int, | ||
val trailerId: Int, | ||
val time: Int, | ||
@JsonProperty(value = "fulltime") | ||
val fullTime: Int, | ||
@JsonProperty(value = "formats") | ||
val format: Format | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Country.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,9 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Country( | ||
val id: Int, | ||
val name: String | ||
) |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Data.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,11 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Data( | ||
val description: String?, | ||
val downloadAvailable: Boolean, | ||
val contextData: ContextData, | ||
val seasons: List<Season> = listOf() | ||
) |
16 changes: 16 additions & 0 deletions
16
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Episode.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,16 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import java.time.LocalDate | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Episode( | ||
val id: Int, | ||
val seasonNumber: Int, | ||
val episodeNumber: Int, | ||
val name: String?, | ||
val nameEng: String?, | ||
val synopsis: String?, | ||
val releaseDate: LocalDate?, | ||
val dateAccuracy: String? | ||
) |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Expectations.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,10 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Expectations( | ||
val value: Double?, | ||
val count: Int, | ||
val ready: Boolean = false | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Format.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,9 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Format( | ||
val hasImax: Boolean, | ||
val has3D: Boolean | ||
) |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Genre.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,11 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Genre( | ||
val id: Int, | ||
val name: String, | ||
// translated genre | ||
val slug: String | ||
) |
10 changes: 10 additions & 0 deletions
10
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Rating.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,10 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Rating( | ||
val value: Double, | ||
val count: Int, | ||
val ready: Boolean = false | ||
) |
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Season.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,11 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize | ||
import com.truedev.kinoposk.api.model.deserializer.StringToEpisodes | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Season( | ||
val number: Int, | ||
@JsonDeserialize(using = StringToEpisodes::class) | ||
val episodes: List<Episode> = listOf() | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/TvShowExt.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,9 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class TvShowExt( | ||
val success: String, | ||
val data: Data | ||
) |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/com/truedev/kinoposk/api/model/tvshow/Year.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,9 @@ | ||
package com.truedev.kinoposk.api.model.tvshow | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
data class Year( | ||
val start: Int, | ||
val end: Int? | ||
) |
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