even more fixes
This commit is contained in:
parent
1426ceef0a
commit
7cfa82e0aa
13 changed files with 53 additions and 23 deletions
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
||||||
|
|
||||||
- uses: gradle/gradle-build-action@v3
|
- uses: gradle/gradle-build-action@v3
|
||||||
with:
|
with:
|
||||||
gradle-version: 7.5
|
gradle-version: 8.9
|
||||||
- name: Create base64 jks file
|
- name: Create base64 jks file
|
||||||
run: echo "${{ secrets.BASE_64_SIGNING_KEY }}" > app/release_keystore.txt
|
run: echo "${{ secrets.BASE_64_SIGNING_KEY }}" > app/release_keystore.txt
|
||||||
- name: Create jks file
|
- name: Create jks file
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ class ResultRepository(private val resultDao: ResultDao, private val commandTemp
|
||||||
|
|
||||||
suspend fun getHomeRecommendations(){
|
suspend fun getHomeRecommendations(){
|
||||||
deleteAll()
|
deleteAll()
|
||||||
val category = sharedPreferences.getString("home_recommendations", "")
|
val category = sharedPreferences.getString("recommendations_home", "")
|
||||||
val items = when(category) {
|
val items = when(category) {
|
||||||
"newpipe" -> newPipeUtil.getTrending()
|
"newpipe" -> newPipeUtil.getTrending()
|
||||||
"yt_api" -> youtubeApiUtil.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>?> {
|
fun getStreamingUrlAndChapters(url: String) : Pair<List<String>, List<ChapterItem>?> {
|
||||||
val newPipeTrial = if (isUsingNewPipeExtractorDataFetching()) {
|
// val newPipeTrial = if (isUsingNewPipeExtractorDataFetching()) {
|
||||||
newPipeUtil.getStreamingUrlAndChapters(url)
|
// newPipeUtil.getStreamingUrlAndChapters(url)
|
||||||
}else {
|
// }else {
|
||||||
Result.failure(Throwable())
|
// Result.failure(Throwable())
|
||||||
}
|
// }
|
||||||
if (newPipeTrial.isFailure){
|
// if (newPipeTrial.isFailure){
|
||||||
val res = ytdlpUtil.getStreamingUrlAndChapters(url)
|
// val res = ytdlpUtil.getStreamingUrlAndChapters(url)
|
||||||
return res.getOrDefault(Pair(listOf(""), null))
|
// return res.getOrDefault(Pair(listOf(""), null))
|
||||||
}
|
// }
|
||||||
|
|
||||||
return newPipeTrial.getOrNull()!!
|
return ytdlpUtil.getStreamingUrlAndChapters(url)
|
||||||
|
.getOrDefault(Pair(listOf(""), null))
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun search(inputQuery: String, resetResults: Boolean, addToResults: Boolean) : ArrayList<ResultItem>{
|
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){
|
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 customHomeRecommendations = sharedPreferences.getString("custom_home_recommendation_url", "")
|
||||||
val emptyCustomRecommendations = customHomeRecommendations.isNullOrBlank() && homeRecommendations == "custom"
|
val emptyCustomRecommendations = customHomeRecommendations.isNullOrBlank() && homeRecommendations == "custom"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,7 @@ class YoutubePlayerClientAdapter(onItemClickListener: OnItemClickListener, activ
|
||||||
title.text = item.playerClient
|
title.text = item.playerClient
|
||||||
|
|
||||||
val content = card.findViewById<ChipGroup>(R.id.content)
|
val content = card.findViewById<ChipGroup>(R.id.content)
|
||||||
|
content.removeAllViews()
|
||||||
val chips = mutableListOf<TextView>()
|
val chips = mutableListOf<TextView>()
|
||||||
item.poTokens.forEach {
|
item.poTokens.forEach {
|
||||||
val tmp = activity.layoutInflater.inflate(R.layout.textview_chip, content, false) as TextView
|
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!!
|
downloadItem.container = if (containerPreference == getString(R.string.defaultValue)) "" else containerPreference!!
|
||||||
}
|
}
|
||||||
containerAutoCompleteTextView.setText(downloadItem.container.ifEmpty { getString(R.string.defaultValue) }, false)
|
containerAutoCompleteTextView.setText(downloadItem.container.ifEmpty { getString(R.string.defaultValue) }, false)
|
||||||
|
|
|
||||||
|
|
@ -312,7 +312,7 @@ class DownloadVideoFragment(private var resultItem: ResultItem? = null, private
|
||||||
containers
|
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!!
|
downloadItem.container = if (containerPreference == getString(R.string.defaultValue)) "" else containerPreference!!
|
||||||
}
|
}
|
||||||
containerAutoCompleteTextView!!.setText(
|
containerAutoCompleteTextView!!.setText(
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.view.Window
|
import android.view.Window
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
|
import android.widget.ProgressBar
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.core.os.bundleOf
|
import androidx.core.os.bundleOf
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
|
@ -271,6 +272,8 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
|
||||||
val player = VideoPlayerUtil.buildPlayer(requireContext())
|
val player = VideoPlayerUtil.buildPlayer(requireContext())
|
||||||
videoView.player = player
|
videoView.player = player
|
||||||
|
|
||||||
|
val loading = view.findViewById<ProgressBar>(R.id.loading)
|
||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
try {
|
try {
|
||||||
val data = withContext(Dispatchers.IO) {
|
val data = withContext(Dispatchers.IO) {
|
||||||
|
|
@ -282,6 +285,7 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.first.isEmpty()) throw Exception("No Data found!")
|
if (data.first.isEmpty()) throw Exception("No Data found!")
|
||||||
|
loading.isVisible = false
|
||||||
|
|
||||||
val urls = data.first
|
val urls = data.first
|
||||||
if (urls.size == 2){
|
if (urls.size == 2){
|
||||||
|
|
@ -299,6 +303,7 @@ class ResultCardDetailsDialog : BottomSheetDialogFragment(), GenericDownloadAdap
|
||||||
player.prepare()
|
player.prepare()
|
||||||
player.play()
|
player.play()
|
||||||
}catch (e: Exception){
|
}catch (e: Exception){
|
||||||
|
loading.isVisible = false
|
||||||
e.printStackTrace()
|
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)
|
val s = getString(R.string.video_recommendations_summary)
|
||||||
summary = if (value.isNullOrBlank()) {
|
summary = if (value.isNullOrBlank()) {
|
||||||
s
|
s
|
||||||
|
|
@ -297,11 +297,11 @@ class GeneralSettingsFragment : BaseSettingsFragment() {
|
||||||
|
|
||||||
findPreference<EditTextPreference>("custom_home_recommendation_url")?.apply {
|
findPreference<EditTextPreference>("custom_home_recommendation_url")?.apply {
|
||||||
title = "[${getString(R.string.video_recommendations)}] ${getString(R.string.custom)}"
|
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 {
|
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)
|
val s = getString(R.string.api_key_summary)
|
||||||
summary = if (text.isNullOrBlank()) {
|
summary = if (text.isNullOrBlank()) {
|
||||||
s
|
s
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import android.widget.EditText
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.appcompat.widget.SwitchCompat
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
|
@ -88,6 +89,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
|
||||||
val useVisitorData = requireView().findViewById<MaterialSwitch>(R.id.use_visitor_data)
|
val useVisitorData = requireView().findViewById<MaterialSwitch>(R.id.use_visitor_data)
|
||||||
|
|
||||||
switch.isChecked = conf.enabled
|
switch.isChecked = conf.enabled
|
||||||
|
switch.jumpDrawablesToCurrentState()
|
||||||
useVisitorData.isEnabled = conf.enabled
|
useVisitorData.isEnabled = conf.enabled
|
||||||
|
|
||||||
fun setValues(conf: YoutubeGeneratePoTokenItem) {
|
fun setValues(conf: YoutubeGeneratePoTokenItem) {
|
||||||
|
|
@ -175,6 +177,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
|
||||||
|
|
||||||
useVisitorData?.apply {
|
useVisitorData?.apply {
|
||||||
this.isChecked = conf.useVisitorData
|
this.isChecked = conf.useVisitorData
|
||||||
|
useVisitorData.jumpDrawablesToCurrentState()
|
||||||
setOnCheckedChangeListener { _, b ->
|
setOnCheckedChangeListener { _, b ->
|
||||||
configuration.remove(conf)
|
configuration.remove(conf)
|
||||||
conf.useVisitorData = b
|
conf.useVisitorData = b
|
||||||
|
|
@ -203,6 +206,7 @@ class GenerateYoutubePoTokensFragment : Fragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
regenerateBtn.setOnClickListener {
|
regenerateBtn.setOnClickListener {
|
||||||
|
layout.dismiss()
|
||||||
val intent = Intent(requireContext(), PoTokenWebViewLoginActivity::class.java)
|
val intent = Intent(requireContext(), PoTokenWebViewLoginActivity::class.java)
|
||||||
intent.putExtra("url", editText.text.toString())
|
intent.putExtra("url", editText.text.toString())
|
||||||
webPoTokenResultLauncher.launch(intent)
|
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>?>> {
|
fun getStreamingUrlAndChapters(url: String) : Result<Pair<List<String>, List<ChapterItem>?>> {
|
||||||
try {
|
try {
|
||||||
val request = YoutubeDLRequest(url)
|
val request = YoutubeDLRequest(url)
|
||||||
request.addOption("--get-url")
|
//request.addOption("--get-url")
|
||||||
request.addOption("--print", "%(.{urls,chapters})s")
|
request.addOption("--print", "%(.{urls,chapters})s")
|
||||||
|
request.addOption("-S", "res:720,+proto:m3u8")
|
||||||
request.applyDefaultOptionsForFetchingData(url)
|
request.applyDefaultOptionsForFetchingData(url)
|
||||||
if (url.isYoutubeURL()) {
|
if (url.isYoutubeURL()) {
|
||||||
request.setYoutubeExtractorArgs(url)
|
request.setYoutubeExtractorArgs(url)
|
||||||
|
|
@ -709,6 +710,8 @@ class YTDLPUtil(private val context: Context, private val commandTemplateDao: Co
|
||||||
}
|
}
|
||||||
if (!sharedPreferences.getBoolean("mtime", false)){
|
if (!sharedPreferences.getBoolean("mtime", false)){
|
||||||
request.addOption("--no-mtime")
|
request.addOption("--no-mtime")
|
||||||
|
}else{
|
||||||
|
request.addOption("--mtime")
|
||||||
}
|
}
|
||||||
|
|
||||||
val sponsorBlockFilters : ArrayList<String> = when(downloadItem.type) {
|
val sponsorBlockFilters : ArrayList<String> = when(downloadItem.type) {
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,22 @@
|
||||||
app:layout_constraintEnd_toEndOf="@+id/frame_layout" />
|
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
|
<androidx.core.widget.NestedScrollView
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
<PreferenceCategory android:title="YouTube">
|
<PreferenceCategory android:title="YouTube">
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:icon="@drawable/baseline_recommend_24"
|
android:icon="@drawable/baseline_recommend_24"
|
||||||
android:key="home_recommendations"
|
android:key="recommendations_home"
|
||||||
android:defaultValue="newpipe"
|
android:defaultValue="newpipe"
|
||||||
android:entries="@array/video_recommendations"
|
android:entries="@array/video_recommendations"
|
||||||
android:entryValues="@array/video_recommnedations_values"
|
android:entryValues="@array/video_recommnedations_values"
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
android:entryValues="@array/countries_values"
|
android:entryValues="@array/countries_values"
|
||||||
app:icon="@drawable/ic_language"
|
app:icon="@drawable/ic_language"
|
||||||
app:useSimpleSummaryProvider="true"
|
app:useSimpleSummaryProvider="true"
|
||||||
app:dependency="home_recommendations"
|
app:dependency="recommendations_home"
|
||||||
app:key="locale"
|
app:key="locale"
|
||||||
app:title="@string/preferred_locale" />
|
app:title="@string/preferred_locale" />
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ buildscript {
|
||||||
coroutineVer = '1.7.3'
|
coroutineVer = '1.7.3'
|
||||||
retrofitVer = "2.9.0"
|
retrofitVer = "2.9.0"
|
||||||
kodeinVer = "7.16.0"
|
kodeinVer = "7.16.0"
|
||||||
navVer = "2.8.3"
|
navVer = "2.8.9"
|
||||||
media3_version = "1.5.1"
|
media3_version = "1.6.0"
|
||||||
agp_version = '8.1.0'
|
agp_version = '8.1.0'
|
||||||
agp_version1 = '7.4.2'
|
agp_version1 = '7.4.2'
|
||||||
roomVer = '2.5.2'
|
roomVer = '2.5.2'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue