minor fixes
* fix episode count in MediaFragement * fix tmdb language tag * update media type detection to use the episode field as episodeNumber may be messinging from certain episodes of tv shows
This commit is contained in:
parent
01d026cc7f
commit
cf02bee7d4
|
@ -11,9 +11,9 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.mosad.teapod"
|
applicationId "org.mosad.teapod"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 32
|
targetSdkVersion 33
|
||||||
versionCode 100990 //01.00.000
|
versionCode 100991 //01.00.000
|
||||||
versionName "1.1.0-beta1"
|
versionName "1.1.0-beta2"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
resValue "string", "build_time", buildTime()
|
resValue "string", "build_time", buildTime()
|
||||||
|
|
|
@ -245,11 +245,11 @@ data class SeriesItem(
|
||||||
@SerialName("images") val images: Images,
|
@SerialName("images") val images: Images,
|
||||||
@SerialName("is_simulcast") val isSimulcast: Boolean,
|
@SerialName("is_simulcast") val isSimulcast: Boolean,
|
||||||
@SerialName("maturity_ratings") val maturityRatings: List<String>,
|
@SerialName("maturity_ratings") val maturityRatings: List<String>,
|
||||||
@SerialName("audio_locales") val audioLocales: List<String>
|
@SerialName("audio_locales") val audioLocales: List<String>,
|
||||||
|
@SerialName("episode_count") val episodeCount: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
val NoneSeriesItem = SeriesItem("", "", "", Images(emptyList(), emptyList()), false, emptyList(), emptyList())
|
val NoneSeriesItem = SeriesItem("", "", "", Images(emptyList(), emptyList()), false, emptyList(), emptyList(), 0)
|
||||||
val NoneSeries = Series(1, listOf(NoneSeriesItem))
|
val NoneSeries = Series(1, listOf(NoneSeriesItem))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,7 +47,6 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||||
playerFinishedCallback()
|
playerFinishedCallback()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
binding = FragmentMediaBinding.inflate(inflater, container, false)
|
binding = FragmentMediaBinding.inflate(inflater, container, false)
|
||||||
return binding.root
|
return binding.root
|
||||||
|
@ -91,6 +90,7 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||||
|
|
||||||
// load poster and backdrop
|
// load poster and backdrop
|
||||||
Glide.with(requireContext()).load(posterUrl)
|
Glide.with(requireContext()).load(posterUrl)
|
||||||
|
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
||||||
.into(binding.imagePoster)
|
.into(binding.imagePoster)
|
||||||
Glide.with(requireContext()).load(backdropUrl)
|
Glide.with(requireContext()).load(backdropUrl)
|
||||||
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
.apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY)))
|
||||||
|
@ -147,14 +147,14 @@ class MediaFragment(private val mediaIdStr: String) : Fragment() {
|
||||||
// episodes count
|
// episodes count
|
||||||
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
||||||
R.plurals.text_episodes_count,
|
R.plurals.text_episodes_count,
|
||||||
episodesCrunchy.total,
|
seriesCrunchy.episodeCount,
|
||||||
episodesCrunchy.total
|
seriesCrunchy.episodeCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is TMDBMovie -> {
|
is TMDBMovie -> {
|
||||||
val tmdbMovie = (tmdbResult as TMDBMovie?)
|
val tmdbMovie = tmdbResult as TMDBMovie
|
||||||
|
|
||||||
if (tmdbMovie?.runtime != null) {
|
if (tmdbMovie.runtime != null) {
|
||||||
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
binding.textEpisodesOrRuntime.text = resources.getQuantityString(
|
||||||
R.plurals.text_runtime,
|
R.plurals.text_runtime,
|
||||||
tmdbMovie.runtime,
|
tmdbMovie.runtime,
|
||||||
|
|
|
@ -76,9 +76,9 @@ class MediaFragmentViewModel(application: Application) : AndroidViewModel(applic
|
||||||
currentEpisodesCrunchy.clear()
|
currentEpisodesCrunchy.clear()
|
||||||
currentEpisodesCrunchy.addAll(episodesCrunchy.data)
|
currentEpisodesCrunchy.addAll(episodesCrunchy.data)
|
||||||
|
|
||||||
// set media type
|
// set media type, for movies the episode field is empty
|
||||||
mediaType = episodesCrunchy.data.firstOrNull()?.let {
|
mediaType = episodesCrunchy.data.firstOrNull()?.let {
|
||||||
if (it.episodeNumber != null) MediaType.TVSHOW else MediaType.MOVIE
|
if (it.episode.isNotEmpty()) MediaType.TVSHOW else MediaType.MOVIE
|
||||||
} ?: MediaType.OTHER
|
} ?: MediaType.OTHER
|
||||||
|
|
||||||
// load playheads and tmdb in parallel
|
// load playheads and tmdb in parallel
|
||||||
|
|
|
@ -246,7 +246,7 @@ class PlayerViewModel(application: Application) : AndroidViewModel(application)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
currentIntroMetadata = NoneDatalabIntro //Crunchyroll.datalabIntro(currentEpisode.id)
|
currentIntroMetadata = Crunchyroll.datalabIntro(currentEpisode.id)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
Log.d(classTag, "streams: ${currentEpisode.streamsLink}")
|
Log.d(classTag, "streams: ${currentEpisode.streamsLink}")
|
||||||
|
|
|
@ -67,7 +67,7 @@ class TMDBApiController {
|
||||||
): T = coroutineScope {
|
): T = coroutineScope {
|
||||||
val path = "$apiUrl$endpoint"
|
val path = "$apiUrl$endpoint"
|
||||||
val params = concatenate(
|
val params = concatenate(
|
||||||
listOf("api_key" to apiKey, "language" to Preferences.preferredSubtitleLocale.language),
|
listOf("api_key" to apiKey, "language" to Preferences.preferredSubtitleLocale.toLanguageTag()),
|
||||||
parameters
|
parameters
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="?colorSurfaceVariant"/>
|
||||||
|
<size
|
||||||
|
android:width="400px"
|
||||||
|
android:height="600px"/>
|
||||||
|
</shape>
|
|
@ -42,7 +42,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:contentDescription="@string/media_poster_backdrop_desc"
|
android:contentDescription="@string/media_poster_backdrop_desc"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
tools:srcCompat="@drawable/placeholder_image" />
|
tools:srcCompat="@android:color/darker_gray" />
|
||||||
|
|
||||||
<com.google.android.material.imageview.ShapeableImageView
|
<com.google.android.material.imageview.ShapeableImageView
|
||||||
android:id="@+id/image_poster"
|
android:id="@+id/image_poster"
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
android:layout_marginBottom="7dp"
|
android:layout_marginBottom="7dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
|
app:shapeAppearance="@style/ShapeAppearance.Teapod.RoundedPoster"
|
||||||
tools:src="@drawable/ic_launcher_background" />
|
tools:src="@drawable/placeholder_image_2_3" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue