if a media was already fully loaded, don't load it again for
Since medias are cached in memory it is unnecessary to load them if they have been fully loaded once before
This commit is contained in:
parent
6100533c4d
commit
fa6419bb02
@ -119,6 +119,11 @@ class AoDParser {
|
|||||||
return@runBlocking listOf()
|
return@runBlocking listOf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the episodes list is not empty it was loaded before
|
||||||
|
if (media.episodes.isNotEmpty()) {
|
||||||
|
return@runBlocking media.episodes
|
||||||
|
}
|
||||||
|
|
||||||
withContext(Dispatchers.Default) {
|
withContext(Dispatchers.Default) {
|
||||||
|
|
||||||
val res = Jsoup.connect(baseUrl + media.link)
|
val res = Jsoup.connect(baseUrl + media.link)
|
||||||
|
@ -8,7 +8,14 @@ class DataTypes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data class Media(val title: String, val link: String, val type: DataTypes.MediaType, val info : Info = Info(), var episodes: List<Episode> = listOf()) {
|
// TODO the episodes workflow could use a clean up/rework
|
||||||
|
data class Media(
|
||||||
|
val title: String,
|
||||||
|
val link: String,
|
||||||
|
val type: DataTypes.MediaType,
|
||||||
|
val info: Info = Info(),
|
||||||
|
var episodes: List<Episode> = listOf()
|
||||||
|
) {
|
||||||
override fun toString(): String {
|
override fun toString(): String {
|
||||||
return title
|
return title
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user