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,20 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<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.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
<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.READ_EXTERNAL_STORAGE" /> <!-- Downloads -->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <!-- Downloads on low api devices-->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <!-- some dependency needs this -->
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <!-- Used for player vertical slide-->
<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" /> 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"
android:required="false"/>
<uses-feature android:name="android.software.leanback"
android:required="false"/>
<!-- Fixes android tv fuckery -->
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="false" />
<!--TODO https://stackoverflow.com/questions/41799732/chromecast-button-not-visible-in-android-->
<application
@ -32,19 +37,21 @@
tools:targetApi="o">
<meta-data
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:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
android:resizeableActivity="true"
android:supportsPictureInPicture="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="content"/>
<data android:mimeType="video/*"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="content" />
<data android:mimeType="video/*" />
</intent-filter>
</activity>
@ -55,22 +62,62 @@
android:label="@string/app_name"
android:resizeableActivity="true"
android:supportsPictureInPicture="true">
<intent-filter
android:exported="true">
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.LEANBACK_LAUNCHER"/>
<intent-filter android:exported="true">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<intent-filter
android:exported="true">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.BROWSABLE"/>
<category android:name="android.intent.category.DEFAULT"/>
<intent-filter android:exported="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<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="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="allanime.site" android:pathPrefix="/"/>
<data android:scheme="https" android:host="animekisa.in" android:pathPrefix="/"/>
@ -78,45 +125,22 @@
<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="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="9anime.center" android:pathPrefix="/"/>
<data android:scheme="https" android:host="asiaflix.app" android:pathPrefix="/"/>
<data android:scheme="https" android:host="dreamsub.me" 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>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="cloudstreamapp"/>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="cloudstreamapp" />
</intent-filter>
</activity>
@ -125,19 +149,17 @@
android:enabled="false"
android:exported="true">
<intent-filter android:exported="true">
<action android:name="restart_service"/>
<action android:name="restart_service" />
</intent-filter>
</receiver>
<service
android:name=".services.VideoDownloadService"
android:enabled="true"
android:exported="false">
</service>
android:exported="false"></service>
<activity
android:exported="false"
android:name=".ui.ControllerActivity">
</activity>
android:name=".ui.ControllerActivity"></activity>
<provider
android:name="androidx.core.content.FileProvider"
@ -147,7 +169,7 @@
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
android:resource="@xml/provider_paths" />
</provider>
</application>
</manifest>

View file

@ -160,12 +160,55 @@ class EgyBestProvider : MainAPI() {
@JsonProperty("quality") val quality: Int?,
@JsonProperty("link") val link: String
)
override suspend fun loadLinks(
data: String,
isCasting: Boolean,
subtitleCallback: (SubtitleFile) -> Unit,
callback: (ExtractorLink) -> Unit
): 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 jsonArray = parseJson<List<Sources>>(requestJSON)
for (i in jsonArray) {

View file

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

View file

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

View file

@ -97,7 +97,8 @@ class SettingsFragment : PreferenceFragmentCompat() {
private fun Context.isAutoTv(): Boolean {
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

View file

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

View file

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