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,
BlueRay,
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 {

View file

@ -25,12 +25,13 @@ class DopeboxProvider : SflixProvider() {
override var mainUrl = "https://dopebox.to"
override var name = "Dopebox"
}
class SolarmovieProvider : SflixProvider() {
override var mainUrl = "https://solarmovie.pe"
override var name = "Solarmovie"
}
open class SflixProvider() : MainAPI() {
open class SflixProvider : MainAPI() {
override var mainUrl = "https://sflix.to"
override var name = "Sflix.to"
@ -87,6 +88,10 @@ open class SflixProvider() : MainAPI() {
val image = it.select("img").attr("data-src")
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) {
MovieSearchResponse(
title,
@ -94,7 +99,8 @@ open class SflixProvider() : MainAPI() {
this.name,
TvType.Movie,
image,
year
year,
quality = quality
)
} else {
TvSeriesSearchResponse(
@ -104,7 +110,8 @@ open class SflixProvider() : MainAPI() {
TvType.TvSeries,
image,
year,
null
null,
quality = quality
)
}
}

View file

@ -33,6 +33,7 @@ object SearchResultBuilder {
val textIsDub: TextView? = itemView.text_is_dub
val textIsSub: TextView? = itemView.text_is_sub
val textQuality: TextView? = itemView.text_quality
val bg: CardView = itemView.backgroundCard
@ -46,6 +47,28 @@ object SearchResultBuilder {
textIsDub?.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
cardView.isVisible = true

View file

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

View file

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

View file

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

View file

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

View file

@ -55,81 +55,31 @@
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:ellipsize="end" />
<!--<View
android:id="@+id/search_result_lang"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="4dp"
android:alpha="0.9">
<TextView
tools:text="@string/quality_hd"
android:id="@+id/text_quality"
android:textColor="@color/textColor"
style="@style/SearchBox"
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
android:orientation="vertical"
android:layout_gravity="end"
android:layout_width="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
android:text="@string/app_dubbed_text"
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:paddingBottom="4dp"
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/dub_bg_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
style="@style/SearchBox"
android:background="@drawable/dub_bg_color" />
<TextView
android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text"
android:layout_gravity="end"
android:textColor="@color/textColor"
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" />
style="@style/SearchBox"
android:background="@drawable/sub_bg_color" />
</LinearLayout>
</androidx.cardview.widget.CardView>

View file

@ -433,6 +433,7 @@
<string name="home_source">Source</string>
<string name="coming_soon">Coming soon…</string>
<string name="quality_cam">Cam</string>
<string name="quality_cam_rip">Cam</string>
<string name="quality_cam_hd">Cam</string>
@ -443,5 +444,9 @@
<string name="quality_blueray">BlueRay</string>
<string name="quality_workprint">WP</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>
</resources>

View file

@ -321,6 +321,21 @@
<item name="android:textStyle">bold</item>
</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">
<!--removes shadow-->
<item name="android:stateListAnimator">@null</item>