-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Edens Fairy * Add type filter * Fix message * Change message * Sort genres
- Loading branch information
1 parent
7d0bc1f
commit 9cf3412
Showing
7 changed files
with
88 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
ext { | ||
extName = 'Edens Fairy' | ||
extClass = '.Eflee' | ||
themePkg = 'zeistmanga' | ||
baseUrl = 'https://www.eflee.co' | ||
overrideVersionCode = 0 | ||
} | ||
|
||
apply from: "$rootDir/common.gradle" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
79 changes: 79 additions & 0 deletions
79
src/es/eflee/src/eu/kanade/tachiyomi/extension/es/eflee/Eflee.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,79 @@ | ||
package eu.kanade.tachiyomi.extension.es.eflee | ||
|
||
import eu.kanade.tachiyomi.multisrc.zeistmanga.Genre | ||
import eu.kanade.tachiyomi.multisrc.zeistmanga.GenreList | ||
import eu.kanade.tachiyomi.multisrc.zeistmanga.Type | ||
import eu.kanade.tachiyomi.multisrc.zeistmanga.ZeistManga | ||
import eu.kanade.tachiyomi.network.GET | ||
import eu.kanade.tachiyomi.source.model.Filter | ||
import eu.kanade.tachiyomi.source.model.FilterList | ||
import eu.kanade.tachiyomi.util.asJsoup | ||
import kotlinx.coroutines.CoroutineScope | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import org.jsoup.nodes.Document | ||
|
||
class Eflee : ZeistManga( | ||
"Edens Fairy", | ||
"https://www.eflee.co", | ||
"es", | ||
) { | ||
override val popularMangaSelector = "#PopularPosts3 article" | ||
override val popularMangaSelectorTitle = ".post-title a" | ||
override val popularMangaSelectorUrl = popularMangaSelectorTitle | ||
|
||
override val useNewChapterFeed = true | ||
override val chapterCategory = "Cap" | ||
|
||
override val hasFilters = true | ||
override val hasLanguageFilter = false | ||
override val hasGenreFilter = false | ||
override val hasStatusFilter = false | ||
|
||
private var genresList: List<Genre> = emptyList() | ||
private var fetchGenresAttempts: Int = 0 | ||
|
||
override fun getFilterList(): FilterList { | ||
CoroutineScope(Dispatchers.IO).launch { fetchGenres() } | ||
val filters = super.getFilterList().list.toMutableList() | ||
if (genresList.isNotEmpty()) { | ||
filters += GenreList( | ||
title = "Generos", | ||
genres = genresList, | ||
) | ||
} else { | ||
filters += listOf( | ||
Filter.Separator(), | ||
Filter.Header("Presione 'Restablecer' para intentar mostrar los géneros"), | ||
) | ||
} | ||
return FilterList(filters) | ||
} | ||
|
||
override fun getTypeList(): List<Type> = listOf( | ||
Type("Todos", ""), | ||
Type("Manga", "Manga"), | ||
Type("Manhua", "Manhua"), | ||
Type("Manhwa", "Manhwa"), | ||
) | ||
|
||
private fun fetchGenres() { | ||
if (fetchGenresAttempts < 3 && genresList.isEmpty()) { | ||
try { | ||
genresList = client.newCall(GET(baseUrl, headers)).execute() | ||
.use { parseGenres(it.asJsoup()) } | ||
.sortedBy { it.value } | ||
} catch (_: Exception) { | ||
} finally { | ||
fetchGenresAttempts++ | ||
} | ||
} | ||
} | ||
|
||
private fun parseGenres(document: Document): List<Genre> { | ||
return document.select(".filters .filter:first-child input:not(.hidden)") | ||
.map { element -> | ||
Genre(element.attr("id"), element.attr("value")) | ||
} | ||
} | ||
} |