forked from recloudstream/cloudstream
fixed #652 (downloaded subtitles) and migration tool
This commit is contained in:
parent
59b0dc988b
commit
cd6c79b961
7 changed files with 61 additions and 34 deletions
|
@ -124,7 +124,7 @@ class WcoProvider : MainAPI() {
|
|||
|
||||
while (!document.select(".pagination").isEmpty()) {
|
||||
val link = document.select("a.page-link[rel=\"next\"]")
|
||||
if (!link.isEmpty()) {
|
||||
if (!link.isEmpty() && returnValue.size < 40) {
|
||||
val extraResponse = app.get(fixUrl(link[0].attr("href"))).text
|
||||
document = Jsoup.parse(extraResponse)
|
||||
returnValue.addAll(parseSearchPage(document))
|
||||
|
@ -132,7 +132,7 @@ class WcoProvider : MainAPI() {
|
|||
break
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
return returnValue.distinctBy { it.url }
|
||||
}
|
||||
|
||||
override suspend fun quickSearch(query: String): List<SearchResponse> {
|
||||
|
|
|
@ -129,8 +129,7 @@ object DownloadButtonSetup {
|
|||
displayName = keyInfo.displayName,
|
||||
relativePath = keyInfo.relativePath,
|
||||
)
|
||||
),
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
//R.id.global_to_navigation_player, PlayerFragment.newInstance(
|
||||
|
|
|
@ -43,11 +43,23 @@ class ParentItemAdapter(
|
|||
}
|
||||
|
||||
fun updateList(newList: List<HomePageList>) {
|
||||
// this moves all bad results to the bottom
|
||||
val endList = mutableListOf<HomePageList>()
|
||||
val newFilteredList = mutableListOf<HomePageList>()
|
||||
for (item in newList) {
|
||||
if(item.list.isEmpty()) {
|
||||
endList.add(item)
|
||||
} else {
|
||||
newFilteredList.add(item)
|
||||
}
|
||||
}
|
||||
newFilteredList.addAll(endList)
|
||||
|
||||
val diffResult = DiffUtil.calculateDiff(
|
||||
SearchDiffCallback(this.items, newList))
|
||||
SearchDiffCallback(this.items, newFilteredList))
|
||||
|
||||
items.clear()
|
||||
items.addAll(newList)
|
||||
items.addAll(newFilteredList)
|
||||
|
||||
diffResult.dispatchUpdatesTo(this)
|
||||
}
|
||||
|
|
|
@ -120,14 +120,13 @@ class CS3IPlayer : IPlayer {
|
|||
Handler(it).post {
|
||||
try {
|
||||
seekTime(1L)
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
}
|
||||
} catch (e : Exception) {
|
||||
} catch (e: Exception) {
|
||||
logError(e)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,7 +286,7 @@ class CS3IPlayer : IPlayer {
|
|||
}
|
||||
|
||||
companion object {
|
||||
var requestSubtitleUpdate : (() -> Unit)? = null
|
||||
var requestSubtitleUpdate: (() -> Unit)? = null
|
||||
|
||||
private fun createOnlineSource(link: ExtractorLink): DataSource.Factory {
|
||||
// Because Trailers.to seems to fail with http/1.1 the normal one uses.
|
||||
|
@ -660,8 +659,8 @@ class CS3IPlayer : IPlayer {
|
|||
val offlineSourceFactory = context.createOfflineSource()
|
||||
|
||||
val (subSources, activeSubtitles) = getSubSources(
|
||||
offlineSourceFactory,
|
||||
offlineSourceFactory,
|
||||
onlineSourceFactory = offlineSourceFactory,
|
||||
offlineSourceFactory = offlineSourceFactory,
|
||||
subtitleHelper,
|
||||
)
|
||||
|
||||
|
@ -740,8 +739,8 @@ class CS3IPlayer : IPlayer {
|
|||
val offlineSourceFactory = context.createOfflineSource()
|
||||
|
||||
val (subSources, activeSubtitles) = getSubSources(
|
||||
offlineSourceFactory,
|
||||
onlineSourceFactory,
|
||||
onlineSourceFactory = onlineSourceFactory,
|
||||
offlineSourceFactory = offlineSourceFactory,
|
||||
subtitleHelper
|
||||
)
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ import androidx.fragment.app.Fragment
|
|||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.lagradost.cloudstream3.APIHolder.apis
|
||||
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
|
||||
import com.lagradost.cloudstream3.HomePageList
|
||||
import com.lagradost.cloudstream3.R
|
||||
import com.lagradost.cloudstream3.mvvm.Resource
|
||||
|
@ -34,7 +36,16 @@ class QuickSearchFragment(var isMainApis: Boolean = false) : Fragment() {
|
|||
fun pushSearch(activity: Activity?, autoSearch: String? = null) {
|
||||
activity.navigate(R.id.global_to_navigation_quick_search, Bundle().apply {
|
||||
putBoolean("mainapi", true)
|
||||
putString("autosearch", autoSearch)
|
||||
autoSearch?.let {
|
||||
putString(
|
||||
"autosearch",
|
||||
it.trim()
|
||||
.removeSuffix("(DUB)")
|
||||
.removeSuffix("(SUB)")
|
||||
.removeSuffix("(Dub)")
|
||||
.removeSuffix("(Sub)").trim()
|
||||
)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -120,18 +131,24 @@ class QuickSearchFragment(var isMainApis: Boolean = false) : Fragment() {
|
|||
})
|
||||
|
||||
val searchExitIcon =
|
||||
quick_search.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||
quick_search?.findViewById<ImageView>(androidx.appcompat.R.id.search_close_btn)
|
||||
val searchMagIcon =
|
||||
quick_search.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
quick_search?.findViewById<ImageView>(androidx.appcompat.R.id.search_mag_icon)
|
||||
|
||||
searchMagIcon.scaleX = 0.65f
|
||||
searchMagIcon.scaleY = 0.65f
|
||||
quick_search.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
searchMagIcon?.scaleX = 0.65f
|
||||
searchMagIcon?.scaleY = 0.65f
|
||||
quick_search?.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
|
||||
override fun onQueryTextSubmit(query: String): Boolean {
|
||||
val active = if (isMainApis) {
|
||||
val langs = context?.getApiProviderLangSettings()
|
||||
apis.filter { langs?.contains(it.lang) == true }.map { it.name }.toSet()
|
||||
} else emptySet()
|
||||
|
||||
searchViewModel.searchAndCancel(
|
||||
query = query,
|
||||
isMainApis = isMainApis,
|
||||
ignoreSettings = true
|
||||
ignoreSettings = false,
|
||||
providersActive = active
|
||||
)
|
||||
quick_search?.let {
|
||||
UIHelper.hideKeyboard(it)
|
||||
|
@ -152,26 +169,26 @@ class QuickSearchFragment(var isMainApis: Boolean = false) : Fragment() {
|
|||
is Resource.Success -> {
|
||||
it.value.let { data ->
|
||||
if (data.isNotEmpty()) {
|
||||
(search_autofit_results?.adapter as SearchAdapter?)?.updateList(data)
|
||||
(search_autofit_results?.adapter as? SearchAdapter?)?.updateList(data)
|
||||
}
|
||||
}
|
||||
searchExitIcon.alpha = 1f
|
||||
quick_search_loading_bar.alpha = 0f
|
||||
searchExitIcon?.alpha = 1f
|
||||
quick_search_loading_bar?.alpha = 0f
|
||||
}
|
||||
is Resource.Failure -> {
|
||||
// Toast.makeText(activity, "Server error", Toast.LENGTH_LONG).show()
|
||||
searchExitIcon.alpha = 1f
|
||||
quick_search_loading_bar.alpha = 0f
|
||||
searchExitIcon?.alpha = 1f
|
||||
quick_search_loading_bar?.alpha = 0f
|
||||
}
|
||||
is Resource.Loading -> {
|
||||
searchExitIcon.alpha = 0f
|
||||
quick_search_loading_bar.alpha = 1f
|
||||
searchExitIcon?.alpha = 0f
|
||||
quick_search_loading_bar?.alpha = 1f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
quick_search_master_recycler.adapter = masterAdapter
|
||||
quick_search_master_recycler.layoutManager = GridLayoutManager(context, 1)
|
||||
quick_search_master_recycler?.adapter = masterAdapter
|
||||
quick_search_master_recycler?.layoutManager = GridLayoutManager(context, 1)
|
||||
|
||||
//quick_search.setOnQueryTextFocusChangeListener { _, b ->
|
||||
// if (b) {
|
||||
|
@ -185,7 +202,7 @@ class QuickSearchFragment(var isMainApis: Boolean = false) : Fragment() {
|
|||
}
|
||||
|
||||
arguments?.getString("autosearch")?.let {
|
||||
quick_search.setQuery(it, true)
|
||||
quick_search?.setQuery(it, true)
|
||||
arguments?.remove("autosearch")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ class EpisodeAdapter(
|
|||
card.episode,
|
||||
card.season,
|
||||
card.id,
|
||||
0,
|
||||
card.parentId,
|
||||
card.rating,
|
||||
card.description,
|
||||
System.currentTimeMillis(),
|
||||
|
|
|
@ -118,7 +118,7 @@ data class ResultEpisode(
|
|||
val description: String?,
|
||||
val isFiller: Boolean?,
|
||||
val tvType: TvType,
|
||||
val parentId: Int?,
|
||||
val parentId: Int,
|
||||
)
|
||||
|
||||
fun ResultEpisode.getRealPosition(): Long {
|
||||
|
@ -151,7 +151,7 @@ fun buildResultEpisode(
|
|||
description: String?,
|
||||
isFiller: Boolean?,
|
||||
tvType: TvType,
|
||||
parentId: Int?,
|
||||
parentId: Int,
|
||||
): ResultEpisode {
|
||||
val posDur = getViewPos(id)
|
||||
return ResultEpisode(
|
||||
|
|
Loading…
Reference in a new issue