Update dependencies and some linting (#1631)
This commit is contained in:
@ -54,17 +54,17 @@ abstract class DooPlay(
|
||||
const val PREFIX_SEARCH = "path:"
|
||||
}
|
||||
|
||||
protected open val PREF_QUALITY_DEFAULT = "720p"
|
||||
protected open val PREF_QUALITY_KEY = "preferred_quality"
|
||||
protected open val PREF_QUALITY_TITLE = when (lang) {
|
||||
protected open val prefQualityDefault = "720p"
|
||||
protected open val prefQualityKey = "preferred_quality"
|
||||
protected open val prefQualityTitle = when (lang) {
|
||||
"pt-BR" -> "Qualidade preferida"
|
||||
else -> "Preferred quality"
|
||||
}
|
||||
protected open val PREF_QUALITY_VALUES = arrayOf("480p", "720p")
|
||||
protected open val PREF_QUALITY_ENTRIES = PREF_QUALITY_VALUES
|
||||
protected open val prefQualityValues = arrayOf("480p", "720p")
|
||||
protected open val prefQualityEntries = prefQualityValues
|
||||
|
||||
protected open val VIDEO_SORT_PREF_KEY = PREF_QUALITY_KEY
|
||||
protected open val VIDEO_SORT_PREF_DEFAULT = PREF_QUALITY_DEFAULT
|
||||
protected open val videoSortPrefKey = prefQualityKey
|
||||
protected open val videoSortPrefDefault = prefQualityDefault
|
||||
|
||||
// ============================== Popular ===============================
|
||||
override fun popularAnimeSelector() = "article.w_item_a > a"
|
||||
@ -296,11 +296,11 @@ abstract class DooPlay(
|
||||
// ============================== Settings ==============================
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val videoQualityPref = ListPreference(screen.context).apply {
|
||||
key = PREF_QUALITY_KEY
|
||||
title = PREF_QUALITY_TITLE
|
||||
entries = PREF_QUALITY_ENTRIES
|
||||
entryValues = PREF_QUALITY_VALUES
|
||||
setDefaultValue(PREF_QUALITY_DEFAULT)
|
||||
key = prefQualityKey
|
||||
title = prefQualityTitle
|
||||
entries = prefQualityEntries
|
||||
entryValues = prefQualityValues
|
||||
setDefaultValue(prefQualityDefault)
|
||||
summary = "%s"
|
||||
setOnPreferenceChangeListener { _, newValue ->
|
||||
val selected = newValue as String
|
||||
@ -405,7 +405,7 @@ abstract class DooPlay(
|
||||
|
||||
open class UriPartFilter(
|
||||
displayName: String,
|
||||
val vals: FilterItems,
|
||||
private val vals: FilterItems,
|
||||
) : AnimeFilter.Select<String>(
|
||||
displayName,
|
||||
vals.map { it.first }.toTypedArray(),
|
||||
@ -413,6 +413,7 @@ abstract class DooPlay(
|
||||
fun toUriPart() = vals[state].second
|
||||
}
|
||||
|
||||
@Suppress("UNUSED")
|
||||
private inline fun <reified R> AnimeFilterList.asUriPart(): String {
|
||||
return this.first { it is R }.let { it as UriPartFilter }.toUriPart()
|
||||
}
|
||||
@ -434,12 +435,12 @@ abstract class DooPlay(
|
||||
*/
|
||||
protected open fun getRealAnimeDoc(document: Document): Document {
|
||||
val menu = document.selectFirst(animeMenuSelector)
|
||||
if (menu != null) {
|
||||
return if (menu != null) {
|
||||
val originalUrl = menu.parent()!!.attr("href")
|
||||
val req = client.newCall(GET(originalUrl, headers)).execute()
|
||||
return req.asJsoup()
|
||||
req.asJsoup()
|
||||
} else {
|
||||
return document
|
||||
document
|
||||
}
|
||||
}
|
||||
|
||||
@ -470,18 +471,18 @@ abstract class DooPlay(
|
||||
}
|
||||
|
||||
override fun List<Video>.sort(): List<Video> {
|
||||
val quality = preferences.getString(VIDEO_SORT_PREF_KEY, VIDEO_SORT_PREF_DEFAULT)!!
|
||||
val quality = preferences.getString(videoSortPrefKey, videoSortPrefDefault)!!
|
||||
return sortedWith(
|
||||
compareBy { it.quality.lowercase().contains(quality.lowercase()) },
|
||||
).reversed()
|
||||
}
|
||||
|
||||
protected open val DATE_FORMATTER by lazy {
|
||||
protected open val dateFormatter by lazy {
|
||||
SimpleDateFormat("MMMM. dd, yyyy", Locale.ENGLISH)
|
||||
}
|
||||
|
||||
protected open fun String.toDate(): Long {
|
||||
return runCatching { DATE_FORMATTER.parse(trim())?.time }
|
||||
return runCatching { dateFormatter.parse(trim())?.time }
|
||||
.getOrNull() ?: 0L
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class DooPlayGenerator : ThemeSourceGenerator {
|
||||
SingleLang("Cinemathek", "https://cinemathek.net", "de", isNsfw = true, overrideVersionCode = 11),
|
||||
SingleLang("CineVision", "https://cinevisionv3.online", "pt-BR", isNsfw = true, overrideVersionCode = 5),
|
||||
SingleLang("GoAnimes", "https://goanimes.net", "pt-BR", isNsfw = true),
|
||||
SingleLang("pactedanime", "https://pactedanime.com", "en", isNsfw = false, overrideVersionCode = 4),
|
||||
SingleLang("pactedanime", "https://pactedanime.com", "en", isNsfw = false, className = "PactedAnime", overrideVersionCode = 4),
|
||||
SingleLang("AnimeOnline360", "https://animeonline360.me", "en", isNsfw = false),
|
||||
SingleLang("Pi Fansubs", "https://pifansubs.org", "pt-BR", isNsfw = true, overrideVersionCode = 15),
|
||||
SingleLang("DonghuaX", "https://donghuax.com", "pt-BR", isNsfw = false),
|
||||
|
@ -9,7 +9,7 @@ import kotlin.system.exitProcess
|
||||
|
||||
class DooPlayUrlActivity : Activity() {
|
||||
|
||||
private val TAG = "DooPlayUrlActivity"
|
||||
private val tag = "DooPlayUrlActivity"
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
@ -27,10 +27,10 @@ class DooPlayUrlActivity : Activity() {
|
||||
try {
|
||||
startActivity(mainIntent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Log.e(TAG, e.toString())
|
||||
Log.e(tag, e.toString())
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "could not parse uri from intent $intent")
|
||||
Log.e(tag, "could not parse uri from intent $intent")
|
||||
}
|
||||
|
||||
finish()
|
||||
|
@ -273,7 +273,7 @@ abstract class DopeFlix(
|
||||
return GET(url, headers)
|
||||
}
|
||||
|
||||
override fun getFilterList(): AnimeFilterList = DopeFlixFilters.filterList
|
||||
override fun getFilterList(): AnimeFilterList = DopeFlixFilters.FILTER_LIST
|
||||
|
||||
// =========================== Anime Details ============================
|
||||
override fun animeDetailsParse(document: Document): SAnime {
|
||||
|
@ -46,20 +46,20 @@ object DopeFlixFilters {
|
||||
}
|
||||
}
|
||||
|
||||
class TypeFilter : QueryPartFilter("Type", DopeFlixFiltersData.types)
|
||||
class QualityFilter : QueryPartFilter("Quality", DopeFlixFiltersData.qualities)
|
||||
class ReleaseYearFilter : QueryPartFilter("Released at", DopeFlixFiltersData.years)
|
||||
class TypeFilter : QueryPartFilter("Type", DopeFlixFiltersData.TYPES)
|
||||
class QualityFilter : QueryPartFilter("Quality", DopeFlixFiltersData.QUALITIES)
|
||||
class ReleaseYearFilter : QueryPartFilter("Released at", DopeFlixFiltersData.YEARS)
|
||||
|
||||
class GenresFilter : CheckBoxFilterList(
|
||||
"Genres",
|
||||
DopeFlixFiltersData.genres.map { CheckBoxVal(it.first, false) },
|
||||
DopeFlixFiltersData.GENRES.map { CheckBoxVal(it.first, false) },
|
||||
)
|
||||
class CountriesFilter : CheckBoxFilterList(
|
||||
"Countries",
|
||||
DopeFlixFiltersData.countries.map { CheckBoxVal(it.first, false) },
|
||||
DopeFlixFiltersData.COUNTRIES.map { CheckBoxVal(it.first, false) },
|
||||
)
|
||||
|
||||
val filterList = AnimeFilterList(
|
||||
val FILTER_LIST = AnimeFilterList(
|
||||
TypeFilter(),
|
||||
QualityFilter(),
|
||||
ReleaseYearFilter(),
|
||||
@ -83,29 +83,29 @@ object DopeFlixFilters {
|
||||
filters.asQueryPart<TypeFilter>(),
|
||||
filters.asQueryPart<QualityFilter>(),
|
||||
filters.asQueryPart<ReleaseYearFilter>(),
|
||||
filters.parseCheckbox<GenresFilter>(DopeFlixFiltersData.genres),
|
||||
filters.parseCheckbox<CountriesFilter>(DopeFlixFiltersData.countries),
|
||||
filters.parseCheckbox<GenresFilter>(DopeFlixFiltersData.GENRES),
|
||||
filters.parseCheckbox<CountriesFilter>(DopeFlixFiltersData.COUNTRIES),
|
||||
)
|
||||
}
|
||||
|
||||
private object DopeFlixFiltersData {
|
||||
val all = Pair("All", "all")
|
||||
val ALL = Pair("All", "all")
|
||||
|
||||
val types = arrayOf(
|
||||
all,
|
||||
val TYPES = arrayOf(
|
||||
ALL,
|
||||
Pair("Movies", "movies"),
|
||||
Pair("TV Shows", "tv"),
|
||||
)
|
||||
|
||||
val qualities = arrayOf(
|
||||
all,
|
||||
val QUALITIES = arrayOf(
|
||||
ALL,
|
||||
Pair("HD", "HD"),
|
||||
Pair("SD", "SD"),
|
||||
Pair("CAM", "CAM"),
|
||||
)
|
||||
|
||||
val years = arrayOf(
|
||||
all,
|
||||
val YEARS = arrayOf(
|
||||
ALL,
|
||||
Pair("2022", "2022"),
|
||||
Pair("2021", "2021"),
|
||||
Pair("2020", "2020"),
|
||||
@ -114,7 +114,7 @@ object DopeFlixFilters {
|
||||
Pair("Older", "older-2018"),
|
||||
)
|
||||
|
||||
val genres = arrayOf(
|
||||
val GENRES = arrayOf(
|
||||
Pair("Action", "10"),
|
||||
Pair("Action & Adventure", "24"),
|
||||
Pair("Adventure", "18"),
|
||||
@ -145,7 +145,7 @@ object DopeFlixFilters {
|
||||
Pair("Western", "6"),
|
||||
)
|
||||
|
||||
val countries = arrayOf(
|
||||
val COUNTRIES = arrayOf(
|
||||
Pair("Argentina", "11"),
|
||||
Pair("Australia", "151"),
|
||||
Pair("Austria", "4"),
|
||||
|
@ -14,7 +14,7 @@ object Decryptor {
|
||||
val salt = saltedData.copyOfRange(8, 16)
|
||||
val ciphertext = saltedData.copyOfRange(16, saltedData.size)
|
||||
val password = remoteKey.toByteArray()
|
||||
val (key, iv) = GenerateKeyAndIv(password, salt) ?: return null
|
||||
val (key, iv) = generateKeyAndIv(password, salt) ?: return null
|
||||
val keySpec = SecretKeySpec(key, "AES")
|
||||
val ivSpec = IvParameterSpec(iv)
|
||||
val cipher = Cipher.getInstance("AES/CBC/PKCS5Padding")
|
||||
@ -24,7 +24,7 @@ object Decryptor {
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/41434590/8166854
|
||||
private fun GenerateKeyAndIv(
|
||||
private fun generateKeyAndIv(
|
||||
password: ByteArray,
|
||||
salt: ByteArray,
|
||||
hashAlgorithm: String = "MD5",
|
||||
|
@ -78,7 +78,7 @@ interface ThemeSourceGenerator {
|
||||
| pkgNameSuffix = '${pkgNameSuffix(source, ".")}'
|
||||
| extClass = '.${source.className}'
|
||||
| extFactory = '$themePkg'
|
||||
| extVersionCode = ${baseVersionCode + source.overrideVersionCode + multisrcLibraryVersion}
|
||||
| extVersionCode = ${baseVersionCode + source.overrideVersionCode + MULTISRC_LIBRARY_VERSION}
|
||||
| ${if (source.isNsfw) "containsNsfw = true\n" else ""}
|
||||
|}
|
||||
|$defaultAdditionalGradleText
|
||||
@ -302,4 +302,4 @@ sealed class ThemeSourceData {
|
||||
/**
|
||||
* This variable should be increased when the multisrc library changes in a way that prompts global extension upgrade
|
||||
*/
|
||||
const val multisrcLibraryVersion = 0
|
||||
const val MULTISRC_LIBRARY_VERSION = 0
|
||||
|
Reference in New Issue
Block a user