fixed android TV auto, no download support & VLC on A11+

This commit is contained in:
LagradOst 2022-05-05 23:50:08 +02:00
parent cf2de2d331
commit eea424c1e8
7 changed files with 146 additions and 81 deletions

View file

@ -1,19 +1,24 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" package="com.lagradost.cloudstream3"> xmlns:tools="http://schemas.android.com/tools"
package="com.lagradost.cloudstream3">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <!-- I dont remember, probs has to do with downloads -->
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <!-- Downloads -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Downloads on low api devices-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!-- some dependency needs this -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <!-- Used for player vertical slide-->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <!--Used for app update-->
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /> <!--<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /> not used atm, but code exist that requires it that are not run-->
<permission android:name="android.permission.QUERY_ALL_PACKAGES" /> <!-- Used for getting if vlc is installed -->
<uses-feature android:name="android.hardware.touchscreen" <!-- Fixes android tv fuckery -->
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" /> android:required="false" />
<uses-feature android:name="android.software.leanback" <uses-feature
android:name="android.software.leanback"
android:required="false" /> android:required="false" />
<!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android--> <!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android-->
@ -34,7 +39,8 @@
android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME" android:name="com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME"
android:value="com.lagradost.cloudstream3.utils.CastOptionsProvider" /> android:value="com.lagradost.cloudstream3.utils.CastOptionsProvider" />
<activity android:name=".ui.player.DownloadedPlayerActivity" <activity
android:name=".ui.player.DownloadedPlayerActivity"
android:screenOrientation="userLandscape" android:screenOrientation="userLandscape"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation" android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
android:resizeableActivity="true" android:resizeableActivity="true"
@ -43,6 +49,7 @@
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" /> <data android:scheme="content" />
<data android:mimeType="video/*" /> <data android:mimeType="video/*" />
</intent-filter> </intent-filter>
@ -55,22 +62,62 @@
android:label="@string/app_name" android:label="@string/app_name"
android:resizeableActivity="true" android:resizeableActivity="true"
android:supportsPictureInPicture="true"> android:supportsPictureInPicture="true">
<intent-filter <intent-filter android:exported="true">
android:exported="true">
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter> </intent-filter>
<intent-filter <intent-filter android:exported="true">
android:exported="true">
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:scheme="https" android:host="pelisplus.icu" android:pathPrefix="/"/> <data android:scheme="https" android:host="pelisplus.icu" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelisplushd.net" android:pathPrefix="/"/> <data android:scheme="https" android:host="pelisplushd.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelismart.com" android:pathPrefix="/"/> <data android:scheme="https" android:host="pelismart.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="melomovie.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="doramasyt.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="cinecalidad.lol" android:pathPrefix="/"/>
<data android:scheme="https" android:host="cuevana3.me" android:pathPrefix="/"/>
<data android:scheme="https" android:host="entrepeliculasyseries.nu" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelisflix.li" android:pathPrefix="/"/>
<data android:scheme="https" android:host="seriesflix.video" android:pathPrefix="/"/>
<data android:scheme="https" android:host="ihavenotv.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="lookmovie.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.vmovee.watch" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allmoviesforyou.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vidembed.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-film.me" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-serie.org" android:pathPrefix="/"/>
<data android:scheme="https" android:host="french-stream.re" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asianembed.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asiaflix.app" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bflix.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="fmovies.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="sflix.pro" android:pathPrefix="/"/>
<data android:scheme="https" android:host="filman.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="sflix.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dopebox.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="solarmovie.pe" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymoviepedia.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.pinoy-hd.xyz" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymovies.es" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.2embed.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dramasee.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="watchasian.sh" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kdramahood.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="akwam.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="mycima.tv" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.egy.best" android:pathPrefix="/"/>
<data android:scheme="https" android:host="secretlink.xyz" android:pathPrefix="/"/>
<data android:scheme="https" android:host="hdm.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="theflix.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="streamingcommunity.top" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.tantifilm.rodeo" android:pathPrefix="/"/>
<data android:scheme="https" android:host="v2.apimdb.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.wcostream.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="gogoanime.film" android:pathPrefix="/"/> <data android:scheme="https" android:host="gogoanime.film" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allanime.site" android:pathPrefix="/"/> <data android:scheme="https" android:host="allanime.site" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animekisa.in" android:pathPrefix="/"/> <data android:scheme="https" android:host="animekisa.in" android:pathPrefix="/"/>
@ -78,44 +125,21 @@
<data android:scheme="https" android:host="www3.animeflv.net" android:pathPrefix="/"/> <data android:scheme="https" android:host="www3.animeflv.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="tenshi.moe" android:pathPrefix="/"/> <data android:scheme="https" android:host="tenshi.moe" android:pathPrefix="/"/>
<data android:scheme="https" android:host="wcostream.cc" android:pathPrefix="/"/> <data android:scheme="https" android:host="wcostream.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bestdubbedanime.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="doramasyt.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="cinecalidad.lol" android:pathPrefix="/"/>
<data android:scheme="https" android:host="cuevana3.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="entrepeliculasyseries.nu" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pelisflix.li" android:pathPrefix="/"/>
<data android:scheme="https" android:host="seriesflix.video" android:pathPrefix="/"/>
<data android:scheme="https" android:host="ihavenotv.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.vmovee.watch" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.wcostream.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="allmoviesforyou.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="monoschinos2.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vidembed.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-film.me" android:pathPrefix="/"/>
<data android:scheme="https" android:host="vf-serie.org" android:pathPrefix="/"/>
<data android:scheme="https" android:host="french-stream.re" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asianembed.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bflix.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="fmovies.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="sflix.pro" android:pathPrefix="/"/>
<data android:scheme="https" android:host="filman.cc" android:pathPrefix="/"/>
<data android:scheme="https" android:host="zoro.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymoviepedia.ru" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.pinoy-hd.xyz" android:pathPrefix="/"/>
<data android:scheme="https" android:host="pinoymovies.es" android:pathPrefix="/"/>
<data android:scheme="https" android:host="trailers.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dramasee.net" android:pathPrefix="/"/>
<data android:scheme="https" android:host="watchasian.sh" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kdramahood.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="akwam.io" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animepahe.com" android:pathPrefix="/"/> <data android:scheme="https" android:host="animepahe.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="9anime.center" android:pathPrefix="/"/> <data android:scheme="https" android:host="dreamsub.me" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asiaflix.app" android:pathPrefix="/"/> <data android:scheme="https" android:host="9anime.id" android:pathPrefix="/"/>
<data android:scheme="https" android:host="www.animeworld.tv" android:pathPrefix="/"/>
<data android:scheme="https" android:host="zoro.to" android:pathPrefix="/"/>
<data android:scheme="https" android:host="bestdubbedanime.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="monoschinos2.com" android:pathPrefix="/"/>
<data android:scheme="https" android:host="kawaiifu.com" android:pathPrefix="/"/>
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" /> <category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="cloudstreamapp" /> <data android:scheme="cloudstreamapp" />
</intent-filter> </intent-filter>
</activity> </activity>
@ -131,13 +155,11 @@
<service <service
android:name=".services.VideoDownloadService" android:name=".services.VideoDownloadService"
android:enabled="true" android:enabled="true"
android:exported="false"> android:exported="false"></service>
</service>
<activity <activity
android:exported="false" android:exported="false"
android:name=".ui.ControllerActivity"> android:name=".ui.ControllerActivity"></activity>
</activity>
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"

View file

@ -160,12 +160,55 @@ class EgyBestProvider : MainAPI() {
@JsonProperty("quality") val quality: Int?, @JsonProperty("quality") val quality: Int?,
@JsonProperty("link") val link: String @JsonProperty("link") val link: String
) )
override suspend fun loadLinks( override suspend fun loadLinks(
data: String, data: String,
isCasting: Boolean, isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit, subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit callback: (ExtractorLink) -> Unit
): Boolean { ): Boolean {
/*val baseURL = data.split("/")[0] + "//" + data.split("/")[2]
val episodeSoup = app.get(data).document
val vidstreamURL = fixUrlNull(episodeSoup.selectFirst("iframe.auto-size")?.attr("src") ) ?: throw ErrorLoadingException("No iframe")
val videoSoup = app.get(vidstreamURL).document
fixUrlNull( videoSoup.select("source").firstOrNull { it.hasAttr("src") }?.attr("src"))?.let {
callback.invoke(ExtractorLink(this.name,this.name,it,"",Qualities.Unknown.value,it.contains(".m3u8")))
} ?: run {
var jsCode = videoSoup.select("script")[1].data()
val verificationToken = Regex("{'[0-9a-zA-Z_]*':'ok'}").findAll(jsCode)[0][2:-7]
val encodedAdLinkVar = Regex("([0-9a-zA-Z_]{2,12}\[Math").findAll(jsCode)[0][1:-5]
val encodingArraysRegEx = Regex(",[0-9a-zA-Z_]{2,12}=\[\]").findAll(jsCode)
val firstEncodingArray = encodingArraysRegEx[1][1:-3]
val secondEncodingArray = encodingArraysRegEx[2][1:-3]
jsCode = Regex("^<script type=\"text/javascript\">", "", jsCode)
jsCode = Regex("[;,]\$\('\*'\)(.*)$", ";", jsCode)
jsCode = Regex(",ismob=(.*)\(navigator\[(.*)\]\)[,;]", ";", jsCode)
jsCode = Regex("var a0b=function\(\)(.*)a0a\(\);",).findAll( jsCode)
jsCode += "var link = ''; for (var i = 0; i <= $secondEncodingArray['length']; i++) { link += $firstEncodingArray[$secondEncodingArray[i]] || ''; } return [link, $encodedAdLinkVar[0]] }"
val jsCodeReturn = executeJS(jsCode)()
val verificationPath = jsCodeReturn[0]
val encodedAdPath = jsCodeReturn[1]
val adLink = baseURL + "/" + str(decode(encodedAdPath + "=" * (-len(encodedAdPath) % 4)), "utf-8")
val session.get(adLink)
val verificationLink = baseURL + "/tvc.php?verify=" + verificationPath
val session.post(verificationLink, data={verificationToken: "ok"})
val vidstreamResponseText = session.get(vidstreamURL).text
val videoSoup = BeautifulSoup(vidstreamResponseText, features="html.parser")
val qualityLinksFileURL = baseURL + videoSoup.body.find("source").get("src")
}
return true*/
val requestJSON = app.get("https://api.zr5.repl.co/egybest?url=$data").text val requestJSON = app.get("https://api.zr5.repl.co/egybest?url=$data").text
val jsonArray = parseJson<List<Sources>>(requestJSON) val jsonArray = parseJson<List<Sources>>(requestJSON)
for (i in jsonArray) { for (i in jsonArray) {

View file

@ -208,8 +208,8 @@ class EpisodeAdapter(
return@setOnLongClickListener true return@setOnLongClickListener true
} }
episodeDownloadImage.visibility = if (hasDownloadSupport) View.VISIBLE else View.GONE episodeDownloadImage.isVisible = hasDownloadSupport
episodeDownloadBar.visibility = if (hasDownloadSupport) View.VISIBLE else View.GONE episodeDownloadBar.isVisible = hasDownloadSupport
} }
override fun reattachDownloadButton() { override fun reattachDownloadButton() {

View file

@ -1845,8 +1845,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
// handleAction(EpisodeClickEvent(ACTION_SHOW_OPTIONS, card)) // handleAction(EpisodeClickEvent(ACTION_SHOW_OPTIONS, card))
// } // }
result_download_movie?.visibility = result_movie_progress_downloaded_holder?.isVisible = hasDownloadSupport
if (hasDownloadSupport) VISIBLE else GONE
if (hasDownloadSupport) { if (hasDownloadSupport) {
val localId = d.getId() val localId = d.getId()
val file = val file =

View file

@ -97,7 +97,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
private fun Context.isAutoTv(): Boolean { private fun Context.isAutoTv(): Boolean {
val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager? val uiModeManager = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager?
return uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION // AFT = Fire TV
return uiModeManager?.currentModeType == Configuration.UI_MODE_TYPE_TELEVISION || Build.MODEL.contains("AFT")
} }
const val accountEnabled = true const val accountEnabled = true

View file

@ -484,14 +484,13 @@ object AppUtils {
fun Context.isAppInstalled(uri: String): Boolean { fun Context.isAppInstalled(uri: String): Boolean {
val pm = Wrappers.packageManager(this) val pm = Wrappers.packageManager(this)
var appInstalled = false
appInstalled = try { return try {
pm.getPackageInfo(uri, PackageManager.GET_ACTIVITIES) pm.getPackageInfo(uri, 0) // PackageManager.GET_ACTIVITIES
true true
} catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) {
false false
} }
return appInstalled
} }
fun getFocusRequest(): AudioFocusRequest? { fun getFocusRequest(): AudioFocusRequest? {

View file

@ -541,6 +541,7 @@
android:layout_width="match_parent" />--> android:layout_width="match_parent" />-->
<FrameLayout <FrameLayout
android:id="@+id/result_movie_progress_downloaded_holder"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">