try fix format update crash
This commit is contained in:
parent
12f99f781a
commit
63a7c1e2d0
4 changed files with 29 additions and 13 deletions
|
|
@ -54,12 +54,8 @@ class FormatAdapter(onItemClickListener: OnItemClickListener, activity: Activity
|
|||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
try {
|
||||
val isLabel = formats[position]!!.label != null
|
||||
return if (isLabel) 0 else 1
|
||||
}catch (err: Exception) {
|
||||
return 1
|
||||
}
|
||||
val item = formats.getOrNull(position)
|
||||
return if (item?.label != null) 0 else 1
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
|
|
@ -92,8 +88,8 @@ class FormatAdapter(onItemClickListener: OnItemClickListener, activity: Activity
|
|||
return
|
||||
}
|
||||
|
||||
val item = itm.format!!
|
||||
val card = holder.item!!
|
||||
val item = itm.format ?: return
|
||||
val card = holder.item ?: return
|
||||
//card.popup()
|
||||
UiUtil.populateFormatCard(activity, card, item)
|
||||
card.isChecked = selectedVideoFormat == item || selectedAudioFormats.any { it == item }
|
||||
|
|
|
|||
|
|
@ -688,12 +688,17 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
|||
|
||||
if (playerClients.isNotEmpty()){
|
||||
extractorArgs.add("player_client=${playerClients.joinToString(",")}")
|
||||
}else{
|
||||
//TODO DISCUSS
|
||||
//extractorArgs.add("player_client=default,-web,-web-safari,-android,-ios,-tv")
|
||||
}
|
||||
|
||||
if (poTokens.isNotEmpty() && sharedPreferences.getBoolean("use_cookies", false)) {
|
||||
extractorArgs.add("po_token=${poTokens.joinToString(",")}")
|
||||
}
|
||||
|
||||
//extractorArgs.add("skip=translated_subs")
|
||||
|
||||
val useLanguageForMetadata = sharedPreferences.getBoolean("use_app_language_for_metadata", true)
|
||||
if (useLanguageForMetadata) {
|
||||
val lang = java.util.Locale.getDefault().language
|
||||
|
|
@ -853,6 +858,11 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
|||
request.addOption("--proxy", proxy)
|
||||
}
|
||||
|
||||
val updateYTDLP = sharedPreferences.getBoolean("update_ytdlp_while_downloading", false)
|
||||
if (updateYTDLP) {
|
||||
request.addOption("-U")
|
||||
}
|
||||
|
||||
val keepCache = sharedPreferences.getBoolean("keep_cache", false)
|
||||
if(keepCache){
|
||||
request.addOption("--keep-fragments")
|
||||
|
|
|
|||
|
|
@ -502,4 +502,6 @@
|
|||
<string name="chapters">Chapters</string>
|
||||
<string name="use_original_url_playlist">Use original url for playlist url</string>
|
||||
<string name="use_original_url_playlist_summary">Use playlist url given by user instead of the playlist_webpage_url tag from the json dump</string>
|
||||
<string name="update_ytdlp_while_downloading">Update yt-dlp while downloading</string>
|
||||
<string name="update_ytdlp_while_downloading_summary">Add -U to yt-dlp to update it to latest before downloading</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -2,10 +2,6 @@
|
|||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<Preference
|
||||
app:icon="@drawable/ic_info"
|
||||
app:key="version"
|
||||
app:title="@string/version"/>
|
||||
|
||||
<PreferenceCategory android:title="@string/source">
|
||||
|
||||
|
|
@ -34,10 +30,23 @@
|
|||
android:key="auto_update_ytdlp"
|
||||
app:title="@string/auto_update_ytdlp" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:widgetLayout="@layout/preferece_material_switch"
|
||||
android:icon="@drawable/ic_update"
|
||||
android:defaultValue="true"
|
||||
android:key="update_ytdlp_while_downloading"
|
||||
android:summary="@string/update_ytdlp_while_downloading_summary"
|
||||
android:title="@string/update_ytdlp_while_downloading" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory android:title="@string/app">
|
||||
|
||||
<Preference
|
||||
app:icon="@drawable/ic_info"
|
||||
app:key="version"
|
||||
app:title="@string/version"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:widgetLayout="@layout/preferece_material_switch"
|
||||
app:defaultValue="true"
|
||||
|
|
@ -65,7 +74,6 @@
|
|||
app:title="@string/changelog" />
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
<PreferenceCategory android:title="@string/format">
|
||||
<ListPreference
|
||||
android:defaultValue="filesize"
|
||||
|
|
|
|||
Loading…
Reference in a new issue