final touches
This commit is contained in:
parent
ae5270b440
commit
10ca8cf638
2 changed files with 21 additions and 18 deletions
|
|
@ -630,7 +630,7 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
val aria2 = sharedPreferences.getBoolean("aria2", false)
|
val aria2 = sharedPreferences.getBoolean("aria2", false)
|
||||||
if (aria2) {
|
if (aria2) {
|
||||||
request.addOption("--downloader", "libaria2c.so")
|
request.addOption("--downloader", "libaria2c.so")
|
||||||
request.addOption("--external-downloader-args", "aria2c:\"--summary-interval=1\"")
|
//request.addOption("--external-downloader-args", "aria2c:\"--summary-interval=1\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
val concurrentFragments = sharedPreferences.getInt("concurrent_fragments", 1)
|
val concurrentFragments = sharedPreferences.getInt("concurrent_fragments", 1)
|
||||||
|
|
@ -789,6 +789,7 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
when(type){
|
when(type){
|
||||||
DownloadViewModel.Type.audio -> {
|
DownloadViewModel.Type.audio -> {
|
||||||
val supportedContainers = context.resources.getStringArray(R.array.audio_containers)
|
val supportedContainers = context.resources.getStringArray(R.array.audio_containers)
|
||||||
|
val preferredLanguage = sharedPreferences.getString("audio_language","")!!
|
||||||
var abrSort = ""
|
var abrSort = ""
|
||||||
|
|
||||||
var audioQualityId : String = downloadItem.format.format_id
|
var audioQualityId : String = downloadItem.format.format_id
|
||||||
|
|
@ -801,10 +802,10 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
audioQualityId += "/ba/b"
|
audioQualityId += "/ba/b"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((audioQualityId.isBlank() || audioQualityId == "ba/b") && preferredLanguage.isNotBlank()) {
|
||||||
|
audioQualityId = "ba[language^=$preferredLanguage]/ba/b"
|
||||||
|
}
|
||||||
|
|
||||||
val ext = downloadItem.container
|
|
||||||
val preferredLanguage = sharedPreferences.getString("audio_language","")!!
|
|
||||||
println(audioQualityId)
|
|
||||||
if (audioQualityId.isNotBlank()) {
|
if (audioQualityId.isNotBlank()) {
|
||||||
if (audioQualityId.matches(".*-[0-9]+.*".toRegex())) {
|
if (audioQualityId.matches(".*-[0-9]+.*".toRegex())) {
|
||||||
audioQualityId = if(!downloadItem.format.lang.isNullOrBlank() && downloadItem.format.lang != "None"){
|
audioQualityId = if(!downloadItem.format.lang.isNullOrBlank() && downloadItem.format.lang != "None"){
|
||||||
|
|
@ -815,13 +816,10 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
}
|
}
|
||||||
|
|
||||||
request.addOption("-f", audioQualityId)
|
request.addOption("-f", audioQualityId)
|
||||||
}else{
|
|
||||||
//enters here if generic or quick downloaded with ba format
|
|
||||||
if (preferredLanguage.isNotBlank()){
|
|
||||||
request.addOption("-f", "ba[language^=$preferredLanguage]/ba/b")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
request.addOption("-x")
|
request.addOption("-x")
|
||||||
|
val ext = downloadItem.container
|
||||||
|
|
||||||
val formatSorting = mutableListOf<String>()
|
val formatSorting = mutableListOf<String>()
|
||||||
val formatImportance: MutableList<String>
|
val formatImportance: MutableList<String>
|
||||||
|
|
@ -844,11 +842,11 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
"file_size" -> {
|
"file_size" -> {
|
||||||
formatSorting.add("size")
|
formatSorting.add("size")
|
||||||
}
|
}
|
||||||
"language" -> {
|
// "language" -> {
|
||||||
if (preferredLanguage.isNotBlank()) {
|
// if (preferredLanguage.isNotBlank()) {
|
||||||
formatSorting.add("lang:${preferredLanguage}")
|
// formatSorting.add("lang:${preferredLanguage}")
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
"codec" -> {
|
"codec" -> {
|
||||||
if (aCodecPref.isNotBlank()){
|
if (aCodecPref.isNotBlank()){
|
||||||
formatSorting.add("acodec:$aCodecPref")
|
formatSorting.add("acodec:$aCodecPref")
|
||||||
|
|
@ -1044,7 +1042,11 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
f.append("$videoF+$altAudioF/")
|
f.append("$videoF+$altAudioF/")
|
||||||
}
|
}
|
||||||
if (!f.contains("$videoF+ba")) {
|
if (!f.contains("$videoF+ba")) {
|
||||||
f.append("$videoF+ba/")
|
if (preferredAudioLanguage.isNotEmpty()) {
|
||||||
|
f.append("$videoF+ba[language^=$preferredAudioLanguage]/")
|
||||||
|
}else {
|
||||||
|
f.append("$videoF+ba/")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
f.append("$videoF/b")
|
f.append("$videoF/b")
|
||||||
|
|
||||||
|
|
@ -1175,9 +1177,9 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
formatSorting.add("abr:${abrSort}")
|
formatSorting.add("abr:${abrSort}")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (preferredLanguage.isNotBlank()) {
|
// if (preferredLanguage.isNotBlank()) {
|
||||||
formatSorting.add("lang:${preferredLanguage}")
|
// formatSorting.add("lang:${preferredLanguage}")
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (formatSorting.isNotEmpty()) {
|
if (formatSorting.isNotEmpty()) {
|
||||||
request.addOption("-S", formatSorting.joinToString(","))
|
request.addOption("-S", formatSorting.joinToString(","))
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@
|
||||||
- Removed custom format sorting by default to avoid common issues with format selection, and moved the preferences to advanced settings. Most of users don't need to customize sorting formats anyway :)
|
- Removed custom format sorting by default to avoid common issues with format selection, and moved the preferences to advanced settings. Most of users don't need to customize sorting formats anyway :)
|
||||||
- Fixed app sometimes building -f as bv/bv+ba/b instead of bv+ba/bv/b
|
- Fixed app sometimes building -f as bv/bv+ba/b instead of bv+ba/bv/b
|
||||||
- Update WorkManager library, hopefully fixing #720
|
- Update WorkManager library, hopefully fixing #720
|
||||||
|
- Looks like adding preferred language in -S is useless so i added it as part of ba[lang^=...]
|
||||||
- Other small things
|
- Other small things
|
||||||
|
|
||||||
Hopefully this build is stable for the time being!
|
Hopefully this build is stable for the time being!
|
||||||
Loading…
Reference in a new issue