pull/1112/head
deniscerri 5 months ago
parent 10184e4ecf
commit 1dad3a79b5
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -255,7 +255,7 @@ object RuntimeManager {
if (!successCodes.contains(exitCode)) {
// Check if process was manually killed (removed from map)
if (processId != null && !idProcessMap.containsKey(processId)) throw CanceledException()
if (out.isEmpty()) throw ExecuteException(err)
throw ExecuteException(err)
}
ExecuteResponse(fullCommand, exitCode, System.currentTimeMillis() - startTime, out, err)

@ -698,7 +698,7 @@ class DownloadMultipleBottomSheetDialog : BottomSheetDialogFragment(), Configure
items.forEach {
it.videoPreferences.compatibilityMode = checked
if(checked) {
it.container = "mkv"
it.container = "mp4"
}
}
CoroutineScope(Dispatchers.IO).launch { items.forEach { downloadViewModel.updateDownload(it) } }

@ -344,7 +344,8 @@ class DownloadVideoFragment(private var resultItem: ResultItem? = null, private
}
}
if (downloadItem.videoPreferences.compatibilityMode) {
containerAutoCompleteTextView.setText("mkv",false)
containerAutoCompleteTextView.setText("mp4",false)
downloadItem.container = "mp4"
}
view.findViewById<LinearLayout>(R.id.adjust).apply {
visibility = if (shownFields.contains("adjust_video")) View.VISIBLE else View.GONE
@ -453,8 +454,8 @@ class DownloadVideoFragment(private var resultItem: ResultItem? = null, private
downloadItem.videoPreferences.compatibilityMode = it
container.isEnabled = !it
if (it) {
containerAutoCompleteTextView.setText("mkv",false)
downloadItem.container = "mkv"
containerAutoCompleteTextView.setText("mp4",false)
downloadItem.container = "mp4"
}
},
alsoDownloadAsAudioClicked = {

@ -104,12 +104,14 @@ class ProcessingSettingsFragment : BaseSettingsFragment() {
val audioCodecPref = findPreference<ListPreference>("audio_codec")
val videoCodecPref = findPreference<ListPreference>("video_codec")
val videoContainerPref = findPreference<ListPreference>("video_format")
val recodeVideoPreference = findPreference<SwitchPreferenceCompat>("recode_video")!!
val compatibleVideoPreference = findPreference<SwitchPreferenceCompat>("compatible_video")!!
audioCodecPref?.isEnabled = !compatibleVideoPreference.isChecked
videoCodecPref?.isEnabled = !compatibleVideoPreference.isChecked
videoContainerPref?.isEnabled = !compatibleVideoPreference.isChecked
recodeVideoPreference.setOnPreferenceClickListener {
if (compatibleVideoPreference.isChecked && recodeVideoPreference.isChecked) {
@ -121,6 +123,7 @@ class ProcessingSettingsFragment : BaseSettingsFragment() {
compatibleVideoPreference.setOnPreferenceClickListener {
audioCodecPref?.isEnabled = !compatibleVideoPreference.isChecked
videoCodecPref?.isEnabled = !compatibleVideoPreference.isChecked
videoContainerPref?.isEnabled = !compatibleVideoPreference.isChecked
if (compatibleVideoPreference.isChecked) {
if (recodeVideoPreference.isChecked) {
@ -137,6 +140,7 @@ class ProcessingSettingsFragment : BaseSettingsFragment() {
editor.putString("audio_codec", audioCodecValues[audioCodecs.indexOf(newAudioCodec)]).apply()
editor.putString("video_codec", videoCodecValues[videoCodecs.indexOf(newVideoCodec)]).apply()
editor.putString("video_format", "").apply()
requireActivity().recreate()
}
true

@ -217,7 +217,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
val intent = Intent(requireContext(), PoTokenWebViewLoginActivity::class.java)
intent.putExtra("url", "https://www.youtube.com")
intent.putExtra("redirect_url", "https://www.youtube.com/embed/${editText.text.toString().getIDFromYoutubeURL()}")
intent.putExtra("redirect_url", "https://www.youtube.com/watch?v=${editText.text.toString().getIDFromYoutubeURL()}")
intent.putExtra("no_auth", true)
webPoTokenResultLauncher.launch(intent)
}

@ -158,20 +158,22 @@ class PoTokenWebViewLoginActivity : BaseActivity() {
}
}
webView.evaluateJavascript("(function(){return document.readyState;})()") { value ->
if (value?.trim('"') == "complete") {
Handler(Looper.getMainLooper()).postDelayed({
redirectUrl?.apply {
val extraHeaders: MutableMap<String?, String?> =
HashMap()
extraHeaders["Referer"] = "https://www.google.com/"
webView.loadUrl(this, extraHeaders)
}
redirectUrl = null
}, 2500)
val canRedirect = noAuth || url?.contains("youtube.com/account") == true
if (canRedirect) {
webView.evaluateJavascript("(function(){return document.readyState;})()") { value ->
if (value?.trim('"') == "complete") {
Handler(Looper.getMainLooper()).postDelayed({
redirectUrl?.apply {
val extraHeaders: MutableMap<String?, String?> =
HashMap()
extraHeaders["Referer"] = "https://www.google.com/"
webView.loadUrl(this, extraHeaders)
}
redirectUrl = null
}, 2500)
}
}
}
}
}

@ -137,7 +137,7 @@ class UpdateUtil(var context: Context) {
}
else -> {
val request = YTDLRequest(emptyList())
request.addOption("--update-to", "${channel}@latest")
request.addOption("--update-to", "$channel")
val res = RuntimeManager.getInstance().execute(request)
val out = res.out.lines().last { it.isNotBlank() }

@ -328,6 +328,7 @@ class NewPipeUtil(context: Context) {
if(sharedPreferences.getString("formats_source", "yt-dlp") == "newpipe" || ignoreFormatPreference){
if (stream.audioStreams.isNotEmpty()){
stream.audioStreams = stream.audioStreams.sortedByDescending { it.bitrate }
for (f in 0 until stream.audioStreams.size){
val it = stream.audioStreams[f]
if (it.bitrate == 0 || listOf(599, 600).contains(it.itag)) continue
@ -354,9 +355,9 @@ class NewPipeUtil(context: Context) {
}
}
if (stream.videoStreams.isNotEmpty()){
for (f in 0 until stream.videoStreams.size){
val it = stream.videoStreams[f]
if (stream.videoOnlyStreams.isNotEmpty()){
for (f in 0 until stream.videoOnlyStreams.size){
val it = stream.videoOnlyStreams[f]
if (it.bitrate == 0) continue
val formatObj = Format(
@ -372,9 +373,9 @@ class NewPipeUtil(context: Context) {
}
}
if (stream.videoOnlyStreams.isNotEmpty()){
for (f in 0 until stream.videoOnlyStreams.size){
val it = stream.videoOnlyStreams[f]
if (stream.videoStreams.isNotEmpty()){
for (f in 0 until stream.videoStreams.size){
val it = stream.videoStreams[f]
if (it.bitrate == 0) continue
val formatObj = Format(

@ -1124,7 +1124,7 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
if (downloadItem.format.format_id == context.resources.getString(R.string.worst_quality) || downloadItem.format.format_id == "wa" || downloadItem.format.format_id == "worst") {
formatSorting.remove("size")
formatSorting.remove("+size")
formatSorting.addAll(0,listOf("+br", "+res", "+fps"))
formatSorting.addAll(0,listOf("+abr","+br", "+res", "+fps"))
}
if (abrSort.isNotBlank()){

Loading…
Cancel
Save