fixed subs bug + fixed generator bug + bump 3.1.4 + updated drive link

This commit is contained in:
reduplicated 2022-08-31 20:08:45 +02:00
parent cbff00090d
commit 7a68d6304f
5 changed files with 32 additions and 14 deletions

View file

@ -36,7 +36,7 @@ android {
targetSdkVersion 30
versionCode 50
versionName "3.1.3"
versionName "3.1.4"
resValue "string", "app_version",
"${defaultConfig.versionName}${versionNameSuffix ?: ""}"

View file

@ -32,9 +32,9 @@ class CustomReportSender : ReportSender {
override fun send(context: Context, errorContent: CrashReportData) {
println("Sending report")
val url =
"https://docs.google.com/forms/u/0/d/e/1FAIpQLSeFmyBChi6HF3IkhTVWPiDXJtxt8W0Hf4Agljm_0-0_QuEYFg/formResponse"
"https://docs.google.com/forms/u/0/d/e/1FAIpQLSe9Vff8oHGMRXcjgCXZwkjvx3eBdNpn4DzjO0FkcWEU1gEQpA/formResponse"
val data = mapOf(
"entry.134906550" to errorContent.toJSON()
"entry.1586460852" to errorContent.toJSON()
)
thread { // to not run it on main thread

View file

@ -101,6 +101,7 @@ class GeneratorPlayer : FullScreenPlayer() {
private fun setSubtitles(sub: SubtitleData?): Boolean {
currentSelectedSubtitles = sub
//Log.i(TAG, "setSubtitles = $sub")
return player.setPreferredSubtitles(sub)
}
@ -849,17 +850,33 @@ class GeneratorPlayer : FullScreenPlayer() {
private fun autoSelectFromSettings(): Boolean {
// auto select subtitle based of settings
val langCode = preferredAutoSelectSubtitles
if (!langCode.isNullOrEmpty() && player.getCurrentPreferredSubtitle() == null) {
getAutoSelectSubtitle(currentSubs, settings = true, downloads = false)?.let { sub ->
context?.let { ctx ->
if (setSubtitles(sub)) {
player.saveData()
player.reloadPlayer(ctx)
player.handleEvent(CSPlayerEvent.Play)
return true
val current = player.getCurrentPreferredSubtitle()
Log.i(TAG, "autoSelectFromSettings = $current")
context?.let { ctx ->
if (current != null) {
if (setSubtitles(current)) {
player.saveData()
player.reloadPlayer(ctx)
player.handleEvent(CSPlayerEvent.Play)
return true
}
} else
if (!langCode.isNullOrEmpty()) {
getAutoSelectSubtitle(
currentSubs,
settings = true,
downloads = false
)?.let { sub ->
if (setSubtitles(sub)) {
player.saveData()
player.reloadPlayer(ctx)
player.handleEvent(CSPlayerEvent.Play)
return true
}
}
}
}
}
return false
}
@ -881,6 +898,7 @@ class GeneratorPlayer : FullScreenPlayer() {
}
private fun autoSelectSubtitles() {
//Log.i(TAG, "autoSelectSubtitles")
normalSafeApiCall {
if (!autoSelectFromSettings()) {
autoSelectFromDownloads()

View file

@ -14,7 +14,7 @@ interface IGenerator {
fun getCurrentId(): Int? // this is used to save data or read data about this id
fun getCurrent(offset : Int = 0): Any? // this is used to get metadata about the current playing, can return null
fun getAll() : List<Any>? // thus us used to get the metadata about all entries, not needed
fun getAll() : List<Any>? // this us used to get the metadata about all entries, not needed
/* not safe, must use try catch */
suspend fun generateLinks(

View file

@ -1226,7 +1226,7 @@ class ResultViewModel2 : ViewModel() {
it.getAll() // I know kinda shit to itterate all, but it is 100% sure to work
?.indexOfFirst { value -> value is ResultEpisode && value.id == click.data.id }
?.let { index ->
if (index > 0)
if (index >= 0)
it.goto(index)
}