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 targetSdkVersion 30
versionCode 50 versionCode 50
versionName "3.1.3" versionName "3.1.4"
resValue "string", "app_version", resValue "string", "app_version",
"${defaultConfig.versionName}${versionNameSuffix ?: ""}" "${defaultConfig.versionName}${versionNameSuffix ?: ""}"

View file

@ -32,9 +32,9 @@ class CustomReportSender : ReportSender {
override fun send(context: Context, errorContent: CrashReportData) { override fun send(context: Context, errorContent: CrashReportData) {
println("Sending report") println("Sending report")
val url = 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( val data = mapOf(
"entry.134906550" to errorContent.toJSON() "entry.1586460852" to errorContent.toJSON()
) )
thread { // to not run it on main thread thread { // to not run it on main thread

View file

@ -101,6 +101,7 @@ class GeneratorPlayer : FullScreenPlayer() {
private fun setSubtitles(sub: SubtitleData?): Boolean { private fun setSubtitles(sub: SubtitleData?): Boolean {
currentSelectedSubtitles = sub currentSelectedSubtitles = sub
//Log.i(TAG, "setSubtitles = $sub")
return player.setPreferredSubtitles(sub) return player.setPreferredSubtitles(sub)
} }
@ -849,17 +850,33 @@ class GeneratorPlayer : FullScreenPlayer() {
private fun autoSelectFromSettings(): Boolean { private fun autoSelectFromSettings(): Boolean {
// auto select subtitle based of settings // auto select subtitle based of settings
val langCode = preferredAutoSelectSubtitles val langCode = preferredAutoSelectSubtitles
if (!langCode.isNullOrEmpty() && player.getCurrentPreferredSubtitle() == null) { val current = player.getCurrentPreferredSubtitle()
getAutoSelectSubtitle(currentSubs, settings = true, downloads = false)?.let { sub -> Log.i(TAG, "autoSelectFromSettings = $current")
context?.let { ctx -> context?.let { ctx ->
if (setSubtitles(sub)) { if (current != null) {
player.saveData() if (setSubtitles(current)) {
player.reloadPlayer(ctx) player.saveData()
player.handleEvent(CSPlayerEvent.Play) player.reloadPlayer(ctx)
return true 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 return false
} }
@ -881,6 +898,7 @@ class GeneratorPlayer : FullScreenPlayer() {
} }
private fun autoSelectSubtitles() { private fun autoSelectSubtitles() {
//Log.i(TAG, "autoSelectSubtitles")
normalSafeApiCall { normalSafeApiCall {
if (!autoSelectFromSettings()) { if (!autoSelectFromSettings()) {
autoSelectFromDownloads() 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 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 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 */ /* not safe, must use try catch */
suspend fun generateLinks( 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 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 } ?.indexOfFirst { value -> value is ResultEpisode && value.id == click.data.id }
?.let { index -> ?.let { index ->
if (index > 0) if (index >= 0)
it.goto(index) it.goto(index)
} }