fix(CineVision): Update domain and fix empty videoList (#989)
* fix(CineVision): Update hostname * refactor(CineVision): Merge CVConstants with main class * refactor(CVUrlActivity): Use main class instead of CVConstants * CineVision: improve sortIfContains * CineVision: bump version
This commit is contained in:
@ -5,7 +5,7 @@ ext {
|
|||||||
extName = 'CineVision'
|
extName = 'CineVision'
|
||||||
pkgNameSuffix = 'pt.cinevision'
|
pkgNameSuffix = 'pt.cinevision'
|
||||||
extClass = '.CineVision'
|
extClass = '.CineVision'
|
||||||
extVersionCode = 2
|
extVersionCode = 3
|
||||||
libVersion = '13'
|
libVersion = '13'
|
||||||
containsNsfw = true
|
containsNsfw = true
|
||||||
}
|
}
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
package eu.kanade.tachiyomi.animeextension.pt.cinevision
|
|
||||||
|
|
||||||
object CVConstants {
|
|
||||||
const val PREFIX_SEARCH = "slug:"
|
|
||||||
|
|
||||||
const val PREFERRED_QUALITY = "preferred_quality"
|
|
||||||
const val DEFAULT_QUALITY = "720p"
|
|
||||||
val QUALITY_LIST = arrayOf("480p", "720p")
|
|
||||||
|
|
||||||
const val PREFERRED_LANGUAGE = "preferred_language"
|
|
||||||
const val DEFAULT_LANGUAGE = "Legendado"
|
|
||||||
val LANGUAGE_LIST = arrayOf("Legendado", "Dublado")
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ class CVUrlActivity : Activity() {
|
|||||||
val pathSegments = intent?.data?.pathSegments
|
val pathSegments = intent?.data?.pathSegments
|
||||||
if (pathSegments != null && pathSegments.size > 1) {
|
if (pathSegments != null && pathSegments.size > 1) {
|
||||||
val slug = pathSegments[1]
|
val slug = pathSegments[1]
|
||||||
val searchQuery = CVConstants.PREFIX_SEARCH + slug
|
val searchQuery = CineVision.PREFIX_SEARCH + slug
|
||||||
val mainIntent = Intent().apply {
|
val mainIntent = Intent().apply {
|
||||||
action = "eu.kanade.tachiyomi.ANIMESEARCH"
|
action = "eu.kanade.tachiyomi.ANIMESEARCH"
|
||||||
putExtra("query", searchQuery)
|
putExtra("query", searchQuery)
|
||||||
|
@ -36,7 +36,7 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
|
|
||||||
override val name = "CineVision"
|
override val name = "CineVision"
|
||||||
|
|
||||||
override val baseUrl = "https://cinevisionv5.online"
|
override val baseUrl = "https://cinevision.app"
|
||||||
|
|
||||||
override val lang = "pt-BR"
|
override val lang = "pt-BR"
|
||||||
|
|
||||||
@ -166,8 +166,8 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchSearchAnime(page: Int, query: String, filters: AnimeFilterList): Observable<AnimesPage> {
|
override fun fetchSearchAnime(page: Int, query: String, filters: AnimeFilterList): Observable<AnimesPage> {
|
||||||
return if (query.startsWith(CVConstants.PREFIX_SEARCH)) {
|
return if (query.startsWith(PREFIX_SEARCH)) {
|
||||||
val slug = query.removePrefix(CVConstants.PREFIX_SEARCH)
|
val slug = query.removePrefix(PREFIX_SEARCH)
|
||||||
client.newCall(GET("$baseUrl/serie/$slug", headers))
|
client.newCall(GET("$baseUrl/serie/$slug", headers))
|
||||||
.asObservableSuccess()
|
.asObservableSuccess()
|
||||||
.map { response ->
|
.map { response ->
|
||||||
@ -244,11 +244,11 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
// ============================== Settings ==============================
|
// ============================== Settings ==============================
|
||||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||||
val videoQualityPref = ListPreference(screen.context).apply {
|
val videoQualityPref = ListPreference(screen.context).apply {
|
||||||
key = CVConstants.PREFERRED_QUALITY
|
key = PREFERRED_QUALITY
|
||||||
title = "Qualidade preferida"
|
title = "Qualidade preferida"
|
||||||
entries = CVConstants.QUALITY_LIST
|
entries = QUALITY_LIST
|
||||||
entryValues = CVConstants.QUALITY_LIST
|
entryValues = QUALITY_LIST
|
||||||
setDefaultValue(CVConstants.DEFAULT_QUALITY)
|
setDefaultValue(DEFAULT_QUALITY)
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
val selected = newValue as String
|
val selected = newValue as String
|
||||||
@ -258,11 +258,11 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val languagePref = ListPreference(screen.context).apply {
|
val languagePref = ListPreference(screen.context).apply {
|
||||||
key = CVConstants.PREFERRED_LANGUAGE
|
key = PREFERRED_LANGUAGE
|
||||||
title = "Tipo/Língua preferida"
|
title = "Tipo/Língua preferida"
|
||||||
entries = CVConstants.LANGUAGE_LIST
|
entries = LANGUAGE_LIST
|
||||||
entryValues = CVConstants.LANGUAGE_LIST
|
entryValues = LANGUAGE_LIST
|
||||||
setDefaultValue(CVConstants.DEFAULT_LANGUAGE)
|
setDefaultValue(DEFAULT_LANGUAGE)
|
||||||
summary = "%s"
|
summary = "%s"
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
val selected = newValue as String
|
val selected = newValue as String
|
||||||
@ -309,6 +309,7 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
for (video in this) {
|
for (video in this) {
|
||||||
if (item in video.quality) {
|
if (item in video.quality) {
|
||||||
newList.add(preferred, video)
|
newList.add(preferred, video)
|
||||||
|
preferred++
|
||||||
} else {
|
} else {
|
||||||
newList.add(video)
|
newList.add(video)
|
||||||
}
|
}
|
||||||
@ -317,9 +318,9 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun List<Video>.sort(): List<Video> {
|
override fun List<Video>.sort(): List<Video> {
|
||||||
val quality = preferences.getString(CVConstants.PREFERRED_QUALITY, CVConstants.DEFAULT_QUALITY)!!
|
val quality = preferences.getString(PREFERRED_QUALITY, DEFAULT_QUALITY)!!
|
||||||
val language = preferences.getString(CVConstants.PREFERRED_LANGUAGE, CVConstants.DEFAULT_LANGUAGE)!!
|
val language = preferences.getString(PREFERRED_LANGUAGE, DEFAULT_LANGUAGE)!!
|
||||||
val newList = this.sortIfContains(language).reversed().sortIfContains(quality)
|
val newList = sortIfContains(language).sortIfContains(quality)
|
||||||
return newList
|
return newList
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,5 +328,15 @@ class CineVision : ConfigurableAnimeSource, ParsedAnimeHttpSource() {
|
|||||||
private val DATE_FORMATTER by lazy {
|
private val DATE_FORMATTER by lazy {
|
||||||
SimpleDateFormat("MMMM. dd, yyyy", Locale.ENGLISH)
|
SimpleDateFormat("MMMM. dd, yyyy", Locale.ENGLISH)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const val PREFIX_SEARCH = "slug:"
|
||||||
|
|
||||||
|
private const val PREFERRED_QUALITY = "preferred_quality"
|
||||||
|
private const val DEFAULT_QUALITY = "720p"
|
||||||
|
private val QUALITY_LIST = arrayOf("480p", "720p")
|
||||||
|
|
||||||
|
private const val PREFERRED_LANGUAGE = "preferred_language"
|
||||||
|
private const val DEFAULT_LANGUAGE = "Legendado"
|
||||||
|
private val LANGUAGE_LIST = arrayOf("Legendado", "Dublado")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user