quality tag on search

This commit is contained in:
LagradOst 2022-03-30 15:41:45 +02:00
parent 6b3eb0047f
commit 0715c599d6
10 changed files with 105 additions and 87 deletions

View file

@ -556,6 +556,35 @@ enum class SearchQuality {
HD, HD,
BlueRay, BlueRay,
DVD, DVD,
SD,
FourK,
UHD,
}
/**Add anything to here if you find a site that uses some specific naming convention*/
fun getQualityFromString(string: String?) : SearchQuality? {
val check = (string ?: return null).trim().lowercase().replace(" ","")
return when(check) {
"cam" -> SearchQuality.Cam
"hdcam" -> SearchQuality.HdCam
"hq" -> SearchQuality.HQ
"hdrip" -> SearchQuality.HD
"hd" -> SearchQuality.HD
"camrip" -> SearchQuality.CamRip
"rip" -> SearchQuality.CamRip
"tc" -> SearchQuality.Telecine
"ts" -> SearchQuality.Telesync
"dvd" -> SearchQuality.DVD
"blueray" -> SearchQuality.BlueRay
"sd" -> SearchQuality.SD
"4k" -> SearchQuality.FourK
"uhd" -> SearchQuality.UHD // may also be 4k or 8k
"blue" -> SearchQuality.BlueRay
"wp" -> SearchQuality.WorkPrint
"workprint" -> SearchQuality.WorkPrint
else -> null
}
} }
interface SearchResponse { interface SearchResponse {

View file

@ -25,12 +25,13 @@ class DopeboxProvider : SflixProvider() {
override var mainUrl = "https://dopebox.to" override var mainUrl = "https://dopebox.to"
override var name = "Dopebox" override var name = "Dopebox"
} }
class SolarmovieProvider : SflixProvider() { class SolarmovieProvider : SflixProvider() {
override var mainUrl = "https://solarmovie.pe" override var mainUrl = "https://solarmovie.pe"
override var name = "Solarmovie" override var name = "Solarmovie"
} }
open class SflixProvider() : MainAPI() { open class SflixProvider : MainAPI() {
override var mainUrl = "https://sflix.to" override var mainUrl = "https://sflix.to"
override var name = "Sflix.to" override var name = "Sflix.to"
@ -87,6 +88,10 @@ open class SflixProvider() : MainAPI() {
val image = it.select("img").attr("data-src") val image = it.select("img").attr("data-src")
val isMovie = href.contains("/movie/") val isMovie = href.contains("/movie/")
val metaInfo = it.select("div.fd-infor > span.fdi-item")
// val rating = metaInfo[0].text()
val quality = getQualityFromString(metaInfo?.getOrNull(1)?.text())
if (isMovie) { if (isMovie) {
MovieSearchResponse( MovieSearchResponse(
title, title,
@ -94,7 +99,8 @@ open class SflixProvider() : MainAPI() {
this.name, this.name,
TvType.Movie, TvType.Movie,
image, image,
year year,
quality = quality
) )
} else { } else {
TvSeriesSearchResponse( TvSeriesSearchResponse(
@ -104,7 +110,8 @@ open class SflixProvider() : MainAPI() {
TvType.TvSeries, TvType.TvSeries,
image, image,
year, year,
null null,
quality = quality
) )
} }
} }

View file

@ -33,6 +33,7 @@ object SearchResultBuilder {
val textIsDub: TextView? = itemView.text_is_dub val textIsDub: TextView? = itemView.text_is_dub
val textIsSub: TextView? = itemView.text_is_sub val textIsSub: TextView? = itemView.text_is_sub
val textQuality: TextView? = itemView.text_quality
val bg: CardView = itemView.backgroundCard val bg: CardView = itemView.backgroundCard
@ -46,6 +47,28 @@ object SearchResultBuilder {
textIsDub?.isVisible = false textIsDub?.isVisible = false
textIsSub?.isVisible = false textIsSub?.isVisible = false
when(card.quality) {
SearchQuality.BlueRay -> R.string.quality_blueray
SearchQuality.Cam -> R.string.quality_cam
SearchQuality.CamRip -> R.string.quality_cam_rip
SearchQuality.DVD -> R.string.quality_dvd
SearchQuality.HD -> R.string.quality_hd
SearchQuality.HQ -> R.string.quality_hq
SearchQuality.HdCam -> R.string.quality_cam_hd
SearchQuality.Telecine -> R.string.quality_tc
SearchQuality.Telesync -> R.string.quality_ts
SearchQuality.WorkPrint -> R.string.quality_workprint
SearchQuality.SD -> R.string.quality_sd
SearchQuality.FourK -> R.string.quality_4k
SearchQuality.UHD -> R.string.quality_uhd
else -> null
}?.let { textRes ->
textQuality?.setText(textRes)
textQuality?.isVisible = true
} ?: run {
textQuality?.isVisible = false
}
cardText?.text = card.name cardText?.text = card.name
cardView.isVisible = true cardView.isVisible = true

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/dubColorBg"/> <solid android:color="@color/dubColorBg"/>
<corners android:radius="@dimen/rounded_image_radius"/> <corners android:radius="@dimen/rounded_image_radius"/>
<stroke android:color="@color/dubColor" android:width="2dp"/> <!-- <stroke android:color="@color/dubColor" android:width="2dp"/>-->
</shape> </shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/subColorBg"/> <solid android:color="@color/subColorBg"/>
<corners android:radius="@dimen/rounded_image_radius"/> <corners android:radius="@dimen/rounded_image_radius"/>
<stroke android:color="@color/subColor" android:width="2dp"/> <!-- <stroke android:color="@color/subColor" android:width="2dp"/>-->
</shape> </shape>

View file

@ -2,5 +2,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/typeColorBg"/> <solid android:color="@color/typeColorBg"/>
<corners android:radius="@dimen/rounded_image_radius"/> <corners android:radius="@dimen/rounded_image_radius"/>
<stroke android:color="@color/typeColor" android:width="1dp"/> <!-- <stroke android:color="@color/typeColor" android:width="2dp"/>-->
</shape> </shape>

View file

@ -84,6 +84,12 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp"> android:layout_height="30dp">
</ImageView>--> </ImageView>-->
<TextView
tools:text="@string/quality_hd"
android:id="@+id/text_quality"
style="@style/SearchBox"
android:background="@drawable/type_bg_color"/>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="end" android:layout_gravity="end"
@ -99,32 +105,15 @@
<TextView <TextView
android:text="@string/app_dubbed_text" android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
android:textColor="@color/textColor" style="@style/SearchBox"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:layout_marginBottom="5dp"
android:layout_gravity="end" android:layout_gravity="end"
android:paddingBottom="4dp" android:background="@drawable/dub_bg_color" />
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/dub_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" android:text="@string/app_subbed_text"
style="@style/SearchBox"
android:layout_gravity="end" android:layout_gravity="end"
android:textColor="@color/textColor" android:background="@drawable/sub_bg_color" />
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/sub_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -55,81 +55,31 @@
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:ellipsize="end" /> android:ellipsize="end" />
<!--<View <TextView
android:id="@+id/search_result_lang" tools:text="@string/quality_hd"
android:layout_gravity="bottom" android:id="@+id/text_quality"
android:layout_width="match_parent" android:textColor="@color/textColor"
android:layout_height="4dp" style="@style/SearchBox"
android:alpha="0.9"> android:background="@drawable/type_bg_color" />
</View>-->
<!--<ImageView
android:src="@drawable/ic_baseline_bookmark_24"
android:id="@+id/search_result_lang"
android:layout_gravity="right"
android:layout_marginTop="-5dp"
android:layout_marginRight="-6.5dp"
android:layout_width="30dp"
android:layout_height="30dp">
</ImageView>-->
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<!-- <TextView
android:text="Movie"
android:textColor="?attr/textColor"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:layout_marginBottom="5dp"
android:layout_gravity="end"
android:paddingBottom="8dp"
android:minWidth="50dp"
android:gravity="end"
android:background="@drawable/type_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>-->
<!--
<ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary"
android:src="@drawable/ic_baseline_subtitles_24" android:layout_width="wrap_content"
android:layout_height="20dp">
</ImageView>-->
<TextView <TextView
android:text="@string/app_dubbed_text" android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
android:textColor="@color/textColor"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:layout_marginBottom="5dp"
android:layout_gravity="end" android:layout_gravity="end"
android:paddingBottom="4dp" style="@style/SearchBox"
android:minWidth="50dp" android:background="@drawable/dub_bg_color" />
android:gravity="center"
android:background="@drawable/dub_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" android:text="@string/app_subbed_text"
android:layout_gravity="end" android:layout_gravity="end"
android:textColor="@color/textColor" style="@style/SearchBox"
android:paddingRight="10dp" android:background="@drawable/sub_bg_color" />
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/sub_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -433,6 +433,7 @@
<string name="home_source">Source</string> <string name="home_source">Source</string>
<string name="coming_soon">Coming soon…</string> <string name="coming_soon">Coming soon…</string>
<string name="quality_cam">Cam</string> <string name="quality_cam">Cam</string>
<string name="quality_cam_rip">Cam</string> <string name="quality_cam_rip">Cam</string>
<string name="quality_cam_hd">Cam</string> <string name="quality_cam_hd">Cam</string>
@ -443,5 +444,9 @@
<string name="quality_blueray">BlueRay</string> <string name="quality_blueray">BlueRay</string>
<string name="quality_workprint">WP</string> <string name="quality_workprint">WP</string>
<string name="quality_dvd">DVD</string> <string name="quality_dvd">DVD</string>
<string name="quality_4k">4K</string>
<string name="quality_sd">SD</string>
<string name="quality_uhd">UHD</string>
<string name="poster_image">Poster Image</string> <string name="poster_image">Poster Image</string>
</resources> </resources>

View file

@ -321,6 +321,21 @@
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
</style> </style>
<style name="SearchBox">
<item name="android:textStyle">bold</item>
<item name="minWidth">50dp</item>
<item name="android:minWidth">50dp</item>
<item name="android:gravity">center</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">5dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingRight">10dp</item>
<item name="android:paddingTop">5dp</item>
<item name="android:paddingBottom">5dp</item>
<item name="textColor">@color/textColor</item>
</style>
<style name="NiceButton"> <style name="NiceButton">
<!--removes shadow--> <!--removes shadow-->
<item name="android:stateListAnimator">@null</item> <item name="android:stateListAnimator">@null</item>