even more fixes

pull/765/head
deniscerri 1 year ago
parent 1426ceef0a
commit 7cfa82e0aa
No known key found for this signature in database
GPG Key ID: 95C43D517D830350

@ -28,7 +28,7 @@ jobs:
- uses: gradle/gradle-build-action@v3
with:
gradle-version: 7.5
gradle-version: 8.9
- name: Create base64 jks file
run: echo "${{ secrets.BASE_64_SIGNING_KEY }}" > app/release_keystore.txt
- name: Create jks file

@ -57,7 +57,7 @@ class ResultRepository(private val resultDao: ResultDao, private val commandTemp
suspend fun getHomeRecommendations(){
deleteAll()
val category = sharedPreferences.getString("home_recommendations", "")
val category = sharedPreferences.getString("recommendations_home", "")
val items = when(category) {
"newpipe" -> newPipeUtil.getTrending()
"yt_api" -> youtubeApiUtil.getTrending()
@ -82,17 +82,18 @@ class ResultRepository(private val resultDao: ResultDao, private val commandTemp
}
fun getStreamingUrlAndChapters(url: String) : Pair<List<String>, List<ChapterItem>?> {
val newPipeTrial = if (isUsingNewPipeExtractorDataFetching()) {
newPipeUtil.getStreamingUrlAndChapters(url)
}else {
Result.failure(Throwable())
}
if (newPipeTrial.isFailure){
val res = ytdlpUtil.getStreamingUrlAndChapters(url)
return res.getOrDefault(Pair(listOf(""), null))
}
return newPipeTrial.getOrNull()!!
// val newPipeTrial = if (isUsingNewPipeExtractorDataFetching()) {
// newPipeUtil.getStreamingUrlAndChapters(url)
// }else {
// Result.failure(Throwable())
// }
// if (newPipeTrial.isFailure){
// val res = ytdlpUtil.getStreamingUrlAndChapters(url)
// return res.getOrDefault(Pair(listOf(""), null))
// }
return ytdlpUtil.getStreamingUrlAndChapters(url)
.getOrDefault(Pair(listOf(""), null))
}
suspend fun search(inputQuery: String, resetResults: Boolean, addToResults: Boolean) : ArrayList<ResultItem>{

@ -124,7 +124,7 @@ class ResultViewModel(private val application: Application) : AndroidViewModel(a
}
}
fun getHomeRecommendations() = viewModelScope.launch(Dispatchers.IO){
val homeRecommendations = sharedPreferences.getString("home_recommendations", "")
val homeRecommendations = sharedPreferences.getString("recommendations_home", "")
val customHomeRecommendations = sharedPreferences.getString("custom_home_recommendation_url", "")
val emptyCustomRecommendations = customHomeRecommendations.isNullOrBlank() && homeRecommendations == "custom"

@ -65,6 +65,7 @@ class YoutubePlayerClientAdapter(onItemClickListener: OnItemClickListener, activ
title.text = item.playerClient
val content = card.findViewById<ChipGroup>(R.id.content)
content.removeAllViews()
val chips = mutableListOf<TextView>()
item.poTokens.forEach {
val tmp = activity.layoutInflater.inflate(R.layout.textview_chip, content, false) as TextView

@ -275,7 +275,7 @@ class DownloadAudioFragment(private var resultItem: ResultItem? = null, private
)
)
if (currentDownloadItem == null || !containers.contains(downloadItem.container)){
if (currentDownloadItem == null || !containers.contains(downloadItem.container.ifEmpty { getString(R.string.defaultValue) })){
downloadItem.container = if (containerPreference == getString(R.string.defaultValue)) "" else containerPreference!!
}
containerAutoCompleteTextView.setText(downloadItem.container.ifEmpty { getString(R.string.defaultValue) }, false)

@ -312,7 +312,7 @@ class DownloadVideoFragment(private var resultItem: ResultItem? = null, private
containers
)
)
if (currentDownloadItem == null || !containers.contains(downloadItem.container)){
if (currentDownloadItem == null || !containers.contains(downloadItem.container.ifEmpty { getString(R.string.defaultValue) })){
downloadItem.container = if (containerPreference == getString(R.string.defaultValue)) "" else containerPreference!!
}
containerAutoCompleteTextView!!.setText(

@ -18,6 +18,7 @@ import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.widget.Button
import android.widget.ProgressBar
import android.widget.TextView
import androidx.core.os.bundleOf
import androidx.core.view.isVisible
@ -271,6 +272,8 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
val player = VideoPlayerUtil.buildPlayer(requireContext())
videoView.player = player
val loading = view.findViewById<ProgressBar>(R.id.loading)
lifecycleScope.launch {
try {
val data = withContext(Dispatchers.IO) {
@ -282,6 +285,7 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
}
if (data.first.isEmpty()) throw Exception("No Data found!")
loading.isVisible = false
val urls = data.first
if (urls.size == 2){
@ -299,6 +303,7 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
player.prepare()
player.play()
}catch (e: Exception){
loading.isVisible = false
e.printStackTrace()
}
}

@ -272,7 +272,7 @@ class GeneralSettingsFragment : BaseSettingsFragment() {
}
}
findPreference<ListPreference>("home_recommendations")?.apply {
findPreference<ListPreference>("recommendations_home")?.apply {
val s = getString(R.string.video_recommendations_summary)
summary = if (value.isNullOrBlank()) {
s
@ -297,11 +297,11 @@ class GeneralSettingsFragment : BaseSettingsFragment() {
findPreference<EditTextPreference>("custom_home_recommendation_url")?.apply {
title = "[${getString(R.string.video_recommendations)}] ${getString(R.string.custom)}"
isVisible = preferences.getString("home_recommendations", "") == "custom"
isVisible = preferences.getString("recommendations_home", "") == "custom"
}
findPreference<EditTextPreference>("api_key")?.apply {
isVisible = preferences.getString("home_recommendations", "") == "yt_api"
isVisible = preferences.getString("recommendations_home", "") == "yt_api"
val s = getString(R.string.api_key_summary)
summary = if (text.isNullOrBlank()) {
s

@ -14,6 +14,7 @@ import android.widget.EditText
import android.widget.TextView
import androidx.activity.result.ActivityResultLauncher
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.widget.SwitchCompat
import androidx.core.view.isVisible
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
@ -88,6 +89,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
val useVisitorData = requireView().findViewById<MaterialSwitch>(R.id.use_visitor_data)
switch.isChecked = conf.enabled
switch.jumpDrawablesToCurrentState()
useVisitorData.isEnabled = conf.enabled
fun setValues(conf: YoutubeGeneratePoTokenItem) {
@ -175,6 +177,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
useVisitorData?.apply {
this.isChecked = conf.useVisitorData
useVisitorData.jumpDrawablesToCurrentState()
setOnCheckedChangeListener { _, b ->
configuration.remove(conf)
conf.useVisitorData = b
@ -203,6 +206,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
}
regenerateBtn.setOnClickListener {
layout.dismiss()
val intent = Intent(requireContext(), PoTokenWebViewLoginActivity::class.java)
intent.putExtra("url", editText.text.toString())
webPoTokenResultLauncher.launch(intent)

@ -512,8 +512,9 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
fun getStreamingUrlAndChapters(url: String) : Result<Pair<List<String>, List<ChapterItem>?>> {
try {
val request = YoutubeDLRequest(url)
request.addOption("--get-url")
//request.addOption("--get-url")
request.addOption("--print", "%(.{urls,chapters})s")
request.addOption("-S", "res:720,+proto:m3u8")
request.applyDefaultOptionsForFetchingData(url)
if (url.isYoutubeURL()) {
request.setYoutubeExtractorArgs(url)
@ -709,6 +710,8 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
}
if (!sharedPreferences.getBoolean("mtime", false)){
request.addOption("--no-mtime")
}else{
request.addOption("--mtime")
}
val sponsorBlockFilters : ArrayList<String> = when(downloadItem.type) {

@ -45,6 +45,22 @@
app:layout_constraintEnd_toEndOf="@+id/frame_layout" />
<ProgressBar
android:id="@+id/loading"
style="@style/Widget.Material3.Button.IconButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/save_thumb"
app:icon="@drawable/ic_image"
app:iconSize="30dp"
android:indeterminate="true"
app:iconTint="?android:colorAccent"
app:layout_constraintBottom_toBottomOf="@+id/frame_layout"
app:layout_constraintEnd_toEndOf="@+id/frame_layout"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/frame_layout" />
<androidx.core.widget.NestedScrollView
android:orientation="vertical"
android:layout_width="match_parent"

@ -71,7 +71,7 @@
<PreferenceCategory android:title="YouTube">
<ListPreference
android:icon="@drawable/baseline_recommend_24"
android:key="home_recommendations"
android:key="recommendations_home"
android:defaultValue="newpipe"
android:entries="@array/video_recommendations"
android:entryValues="@array/video_recommnedations_values"
@ -125,7 +125,7 @@
android:entryValues="@array/countries_values"
app:icon="@drawable/ic_language"
app:useSimpleSummaryProvider="true"
app:dependency="home_recommendations"
app:dependency="recommendations_home"
app:key="locale"
app:title="@string/preferred_locale" />

@ -24,8 +24,8 @@ buildscript {
coroutineVer = '1.7.3'
retrofitVer = "2.9.0"
kodeinVer = "7.16.0"
navVer = "2.8.3"
media3_version = "1.5.1"
navVer = "2.8.9"
media3_version = "1.6.0"
agp_version = '8.1.0'
agp_version1 = '7.4.2'
roomVer = '2.5.2'

Loading…
Cancel
Save