rework media parsing, parse secondary stream (sub/jap)
* use the secondary stream if no primary is present
This commit is contained in:
@ -27,7 +27,7 @@ data class Media(
|
||||
val link: String,
|
||||
val type: DataTypes.MediaType,
|
||||
val info: Info = Info(),
|
||||
var episodes: List<Episode> = listOf()
|
||||
var episodes: ArrayList<Episode> = arrayListOf()
|
||||
)
|
||||
|
||||
data class Info(
|
||||
@ -40,10 +40,15 @@ data class Info(
|
||||
var episodesCount: Int = 0
|
||||
)
|
||||
|
||||
/**
|
||||
* if secStreamOmU == true, then a secondary stream is present
|
||||
*/
|
||||
data class Episode(
|
||||
val id: Int = 0,
|
||||
var title: String = "",
|
||||
var streamUrl: String = "",
|
||||
var priStreamUrl: String = "",
|
||||
var secStreamUrl: String = "",
|
||||
var secStreamOmU: Boolean = false,
|
||||
var posterUrl: String = "",
|
||||
var description: String = "",
|
||||
var shortDesc: String = "",
|
||||
@ -60,3 +65,17 @@ data class TMDBResponse(
|
||||
val backdropUrl: String = "",
|
||||
var runtime: Int = 0
|
||||
)
|
||||
|
||||
data class AoDObject(val playlist: List<Playlist>)
|
||||
|
||||
data class Playlist(
|
||||
val sources: List<Source>,
|
||||
val image: String,
|
||||
val title: String,
|
||||
val description: String,
|
||||
val mediaid: Int
|
||||
)
|
||||
|
||||
data class Source(
|
||||
val file: String = ""
|
||||
)
|
||||
|
@ -25,21 +25,24 @@ class EpisodeItemAdapter(private val episodes: List<Episode>) : RecyclerView.Ada
|
||||
|
||||
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
|
||||
val context = holder.view.context
|
||||
val ep = episodes[position]
|
||||
|
||||
holder.view.text_episode_title.text = context.getString(
|
||||
R.string.component_episode_title,
|
||||
episodes[position].number,
|
||||
episodes[position].description
|
||||
)
|
||||
holder.view.text_episode_desc.text = episodes[position].shortDesc
|
||||
val titleText = if (ep.priStreamUrl.isEmpty() && ep.secStreamOmU) {
|
||||
context.getString(R.string.component_episode_title_sub, ep.number, ep.description)
|
||||
} else {
|
||||
context.getString(R.string.component_episode_title, ep.number, ep.description)
|
||||
}
|
||||
|
||||
holder.view.text_episode_title.text = titleText
|
||||
holder.view.text_episode_desc.text = ep.shortDesc
|
||||
|
||||
if (episodes[position].posterUrl.isNotEmpty()) {
|
||||
Glide.with(context).load(episodes[position].posterUrl)
|
||||
Glide.with(context).load(ep.posterUrl)
|
||||
.apply(RequestOptions.bitmapTransform(RoundedCornersTransformation(10, 0)))
|
||||
.into(holder.view.image_episode)
|
||||
}
|
||||
|
||||
if (episodes[position].watched) {
|
||||
if (ep.watched) {
|
||||
holder.view.image_watched.setImageDrawable(
|
||||
ContextCompat.getDrawable(context, R.drawable.ic_baseline_check_circle_24)
|
||||
)
|
||||
|
Reference in New Issue
Block a user