Skip to content

Commit

Permalink
Merge pull request #68 from Dark25/MonosChinos
Browse files Browse the repository at this point in the history
Fix(es/MonosChinos): Update source
  • Loading branch information
Dark25 authored Sep 4, 2024
2 parents 466ab77 + e533dc9 commit fe7c3e5
Show file tree
Hide file tree
Showing 9 changed files with 367 additions and 205 deletions.
6 changes: 5 additions & 1 deletion src/es/monoschinos/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ext {
extName = 'MonosChinos'
extClass = '.MonosChinos'
extVersionCode = 28
extVersionCode = 29
}

apply from: "$rootDir/common.gradle"
Expand All @@ -12,4 +12,8 @@ dependencies {
implementation(project(':lib:okru-extractor'))
implementation(project(':lib:streamtape-extractor'))
implementation(project(':lib:filemoon-extractor'))
implementation(project(':lib:voe-extractor'))
implementation(project(':lib:streamwish-extractor'))
implementation(project(':lib:mixdrop-extractor'))
implementation(project(':lib:dood-extractor'))
}
Binary file modified src/es/monoschinos/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/es/monoschinos/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/es/monoschinos/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/es/monoschinos/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/es/monoschinos/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package eu.kanade.tachiyomi.animeextension.es.monoschinos

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class EpisodesDto(
@SerialName("paginate_url") var paginateUrl: String? = null,
@SerialName("perpage") var perpage: Double? = null,
@SerialName("eps") var eps: ArrayList<Eps> = arrayListOf(),
)

@Serializable
data class Eps(
@SerialName("num") var num: Int? = null,
)

@Serializable
data class EpisodeInfoDto(
@SerialName("default") var default: String? = null,
@SerialName("caps") var caps: ArrayList<Caps> = arrayListOf(),
)

@Serializable
data class Caps(
@SerialName("episodio") var episodio: Int? = null,
@SerialName("url") var url: String? = null,
@SerialName("thumb") var thumb: String? = null,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package eu.kanade.tachiyomi.animeextension.es.monoschinos

import eu.kanade.tachiyomi.animesource.model.AnimeFilter
import eu.kanade.tachiyomi.animesource.model.AnimeFilterList
import java.util.Calendar

object MonosChinosFilters {
open class QueryPartFilter(displayName: String, val vals: Array<Pair<String, String>>) : AnimeFilter.Select<String>(
displayName,
vals.map { it.first }.toTypedArray(),
) {
fun toQueryPart(name: String) = vals[state].second.takeIf { it.isNotEmpty() }?.let { "&$name=${vals[state].second}" } ?: run { "" }
}

open class CheckBoxFilterList(name: String, values: List<CheckBox>) : AnimeFilter.Group<AnimeFilter.CheckBox>(name, values)

private class CheckBoxVal(name: String, state: Boolean = false) : AnimeFilter.CheckBox(name, state)

private inline fun <reified R> AnimeFilterList.parseCheckbox(
options: Array<Pair<String, String>>,
name: String,
): String {
return (this.getFirst<R>() as CheckBoxFilterList).state
.mapNotNull { checkbox ->
if (checkbox.state) {
options.find { it.first == checkbox.name }!!.second
} else {
null
}
}.joinToString(",").let {
if (it.isBlank()) {
""
} else {
"&$name=$it"
}
}
}

private inline fun <reified R> AnimeFilterList.asQueryPart(name: String): String {
return (this.getFirst<R>() as QueryPartFilter).toQueryPart(name)
}

private inline fun <reified R> AnimeFilterList.getFirst(): R {
return this.filterIsInstance<R>().first()
}

private fun String.changePrefix() = this.takeIf { it.startsWith("&") }?.let { this.replaceFirst("&", "?") } ?: run { this }

data class FilterSearchParams(val filter: String = "") {
fun getQuery() = filter.changePrefix()
}

internal fun getSearchParameters(filters: AnimeFilterList): FilterSearchParams {
if (filters.isEmpty()) return FilterSearchParams()
return FilterSearchParams(
filters.parseCheckbox<GenresFilter>(DoramasytFiltersData.GENRES, "genero") +
filters.parseCheckbox<TypesFilter>(DoramasytFiltersData.TYPES, "tipo") +
filters.asQueryPart<YearsFilter>("fecha") +
filters.asQueryPart<LettersFilter>("letra"),
)
}

val FILTER_LIST get() = AnimeFilterList(
AnimeFilter.Header("La busqueda por texto ignora el filtro"),
GenresFilter(),
TypesFilter(),
YearsFilter(),
LettersFilter(),
)

class GenresFilter : CheckBoxFilterList("Género", DoramasytFiltersData.GENRES.map { CheckBoxVal(it.first, false) })

class TypesFilter : CheckBoxFilterList("Tipo", DoramasytFiltersData.TYPES.map { CheckBoxVal(it.first, false) })

class YearsFilter : QueryPartFilter("Año", DoramasytFiltersData.YEARS)

class LettersFilter : QueryPartFilter("Letra", DoramasytFiltersData.LETTER)

private object DoramasytFiltersData {
val TYPES = arrayOf(
Pair("<Selecionar>", ""),
Pair("Pelicula", "pelicula"),
Pair("Anime", "anime"),
)

val YEARS = arrayOf(Pair("<Seleccionar>", "")) + (1982..Calendar.getInstance().get(Calendar.YEAR)).map { Pair("$it", "$it") }.reversed().toTypedArray()

val LETTER = arrayOf(Pair("<Seleccionar>", "")) + ('A'..'Z').map { Pair("$it", "$it") }.toTypedArray()

val GENRES = arrayOf(
Pair("<Selecionar>", ""),
Pair("Acción", "accion"),
Pair("Aventura", "aventura"),
Pair("Carreras", "carreras"),
Pair("Ciencia Ficción", "ciencia-ficcion"),
Pair("Comedia", "comedia"),
Pair("Cyberpunk", "cyberpunk"),
Pair("Deportes", "deportes"),
Pair("Drama", "drama"),
Pair("Ecchi", "ecchi"),
Pair("Escolares", "escolares"),
Pair("Fantasía", "fantasia"),
Pair("Gore", "gore"),
Pair("Harem", "harem"),
Pair("Horror", "horror"),
Pair("Josei", "josei"),
Pair("Lucha", "lucha"),
Pair("Magia", "magia"),
Pair("Mecha", "mecha"),
Pair("Militar", "militar"),
Pair("Misterio", "misterio"),
Pair("Música", "musica"),
Pair("Parodias", "parodias"),
Pair("Psicológico", "psicologico"),
Pair("Recuerdos de la vida", "recuerdos-de-la-vida"),
Pair("Seinen", "seinen"),
Pair("Shojo", "shojo"),
Pair("Shonen", "shonen"),
Pair("Sobrenatural", "sobrenatural"),
Pair("Vampiros", "vampiros"),
Pair("Yaoi", "yaoi"),
Pair("Yuri", "yuri"),
Pair("Latino", "latino"),
Pair("Espacial", "espacial"),
Pair("Histórico", "historico"),
Pair("Samurai", "samurai"),
Pair("Artes Marciales", "artes-marciales"),
Pair("Demonios", "demonios"),
Pair("Romance", "romance"),
Pair("Dementia", "dementia"),
Pair(" Policía", "policia"),
Pair("Castellano", "castellano"),
Pair("Historia paralela", "historia-paralela"),
Pair("Aenime", "aenime"),
Pair("Blu-ray", "blu-ray"),
Pair("Monogatari", "monogatari"),
)
}
}

0 comments on commit fe7c3e5

Please sign in to comment.