mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add OpenSubtitles support for Brazilian Portuguese
This commit is contained in:
parent
4bb15a61c2
commit
1b129920f3
3 changed files with 13 additions and 6 deletions
|
@ -143,8 +143,9 @@ class OpenSubtitlesApi(index: Int) : InAppAuthAPIManager(index), AbstractSubApi
|
||||||
/**
|
/**
|
||||||
* Some languages do not use the normal country codes on OpenSubtitles
|
* Some languages do not use the normal country codes on OpenSubtitles
|
||||||
* */
|
* */
|
||||||
private val languageExceptions = mapOf(
|
private val languageExceptions = mapOf<String, String>(
|
||||||
"pt" to "pt-PT"
|
// "pt" to "pt-PT",
|
||||||
|
// "pt" to "pt-BR"
|
||||||
)
|
)
|
||||||
private fun fixLanguage(language: String?) : String? {
|
private fun fixLanguage(language: String?) : String? {
|
||||||
return languageExceptions[language] ?: language
|
return languageExceptions[language] ?: language
|
||||||
|
|
|
@ -734,7 +734,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
if ((currentMeta as? ResultEpisode)?.tvType?.isLiveStream() == true) return
|
if ((currentMeta as? ResultEpisode)?.tvType?.isLiveStream() == true) return
|
||||||
|
|
||||||
val (position, duration) = posDur
|
val (position, duration) = posDur
|
||||||
if(duration == 0L) return // idk how you achieved this, but div by zero crash
|
if (duration == 0L) return // idk how you achieved this, but div by zero crash
|
||||||
|
|
||||||
viewModel.getId()?.let {
|
viewModel.getId()?.let {
|
||||||
DataStoreHelper.setViewPos(it, position, duration)
|
DataStoreHelper.setViewPos(it, position, duration)
|
||||||
|
@ -1015,7 +1015,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
limitTitle = settingsManager.getInt(ctx.getString(R.string.prefer_limit_title_key), 0)
|
limitTitle = settingsManager.getInt(ctx.getString(R.string.prefer_limit_title_key), 0)
|
||||||
updateForcedEncoding(ctx)
|
updateForcedEncoding(ctx)
|
||||||
|
|
||||||
filterSubByLang = settingsManager.getBoolean(getString(R.string.filter_sub_lang_key), false)
|
filterSubByLang =
|
||||||
|
settingsManager.getBoolean(getString(R.string.filter_sub_lang_key), false)
|
||||||
if (filterSubByLang) {
|
if (filterSubByLang) {
|
||||||
val langFromPrefMedia = settingsManager.getStringSet(
|
val langFromPrefMedia = settingsManager.getStringSet(
|
||||||
this.getString(R.string.provider_lang_key),
|
this.getString(R.string.provider_lang_key),
|
||||||
|
|
|
@ -71,7 +71,8 @@ object SubtitleHelper {
|
||||||
|
|
||||||
/** ISO_639_1 -> lang*/
|
/** ISO_639_1 -> lang*/
|
||||||
fun fromTwoLettersToLanguage(input: String): String? {
|
fun fromTwoLettersToLanguage(input: String): String? {
|
||||||
if (input.length != 2) return null
|
// pr-BR
|
||||||
|
if (input.substringBefore("-").length != 2) return null
|
||||||
if (ISO_639_1Map.isEmpty()) {
|
if (ISO_639_1Map.isEmpty()) {
|
||||||
initISO6391Map()
|
initISO6391Map()
|
||||||
}
|
}
|
||||||
|
@ -269,6 +270,8 @@ object SubtitleHelper {
|
||||||
"pl" to "PL",
|
"pl" to "PL",
|
||||||
"ps" to "AF",
|
"ps" to "AF",
|
||||||
"pt" to "PT",
|
"pt" to "PT",
|
||||||
|
"pt-pt" to "PT",
|
||||||
|
"pt-br" to "BR",
|
||||||
"rm" to "CH",
|
"rm" to "CH",
|
||||||
"rn" to "BI",
|
"rn" to "BI",
|
||||||
"ro" to "RO",
|
"ro" to "RO",
|
||||||
|
@ -452,7 +455,9 @@ object SubtitleHelper {
|
||||||
Language639("Persian", "فارسی", "fa", "fas", "", "fas", ""),
|
Language639("Persian", "فارسی", "fa", "fas", "", "fas", ""),
|
||||||
Language639("Polish", "język polski, polszczyzna", "pl", "pol", "pol", "pol", "pols"),
|
Language639("Polish", "język polski, polszczyzna", "pl", "pol", "pol", "pol", "pols"),
|
||||||
Language639("Pashto", "پښتو", "ps", "pus", "pus", "pus", ""),
|
Language639("Pashto", "پښتو", "ps", "pus", "pus", "pus", ""),
|
||||||
Language639("Portuguese", "português", "pt", "por", "por", "por", ""),
|
Language639("Portuguese", "português", "pt-pt", "por", "por", "por", ""),
|
||||||
|
// Addition to support Brazilian Portuguese properly, might break other things
|
||||||
|
Language639("Portuguese (Brazilian)", "português", "pt-br", "por", "por", "por", ""),
|
||||||
Language639("Quechua", "Runa Simi, Kichwa", "qu", "que", "que", "que", ""),
|
Language639("Quechua", "Runa Simi, Kichwa", "qu", "que", "que", "que", ""),
|
||||||
Language639("Romansh", "rumantsch grischun", "rm", "roh", "roh", "roh", ""),
|
Language639("Romansh", "rumantsch grischun", "rm", "roh", "roh", "roh", ""),
|
||||||
Language639("Kirundi", "Ikirundi", "rn", "run", "run", "run", ""),
|
Language639("Kirundi", "Ikirundi", "rn", "run", "run", "run", ""),
|
||||||
|
|
Loading…
Reference in a new issue