minor code clean up
This commit is contained in:
		| @ -90,10 +90,11 @@ class AoDParser { | ||||
|                 val media = Media( | ||||
|                     it.select("h3.animebox-title").text(), | ||||
|                     it.select("p.animebox-link").select("a").attr("href"), | ||||
|                     type, | ||||
|                     it.select("p.animebox-image").select("img").attr("src"), | ||||
|                     it.select("p.animebox-shorttext").text() | ||||
|                     type | ||||
|                 ) | ||||
|                 media.info.posterLink = it.select("p.animebox-image").select("img").attr("src") | ||||
|                 media.info.shortDesc = it.select("p.animebox-shorttext").text() | ||||
|  | ||||
|                 mediaList.add(media) | ||||
|             } | ||||
|  | ||||
| @ -130,6 +131,13 @@ class AoDParser { | ||||
|                     "episodenanzahl" -> media.info.episodesCount = it.select("td").text().toInt() | ||||
|                 } | ||||
|             } | ||||
|             /** | ||||
|              * TODO tv show specific for each episode (div.episodebox) | ||||
|              *  * episode id (div.flip-front -> id.substringafter("-")) | ||||
|              *  * watched (if div.status-icon-orange present = true) | ||||
|              *  * watchedCallback | ||||
|              *  * episodebox-shorttext | ||||
|              */ | ||||
|  | ||||
|             val playlists = res.select("input.streamstarter_html5").eachAttr("data-playlist") | ||||
|             val csrfToken = res.select("meta[name=csrf-token]").attr("content") | ||||
|  | ||||
| @ -43,8 +43,8 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) : | ||||
|      */ | ||||
|     private fun initGUI() { | ||||
|         // generic gui | ||||
|         val backdropUrl = if (tmdb.backdropUrl.isNotEmpty()) tmdb.backdropUrl else media.posterLink | ||||
|         val posterUrl = if (tmdb.posterUrl.isNotEmpty()) tmdb.posterUrl else media.posterLink | ||||
|         val backdropUrl = if (tmdb.backdropUrl.isNotEmpty()) tmdb.backdropUrl else media.info.posterLink | ||||
|         val posterUrl = if (tmdb.posterUrl.isNotEmpty()) tmdb.posterUrl else media.info.posterLink | ||||
|  | ||||
|         Glide.with(requireContext()).load(backdropUrl) | ||||
|             .apply(RequestOptions.placeholderOf(ColorDrawable(Color.DKGRAY))) | ||||
| @ -57,7 +57,7 @@ class MediaFragment(private val media: Media, private val tmdb: TMDBResponse) : | ||||
|         text_title.text = media.title | ||||
|         text_year.text = media.info.year.toString() | ||||
|         text_age.text = media.info.age.toString() | ||||
|         text_overview.text = media.shortDesc //if (tmdb.overview.isNotEmpty()) tmdb.overview else media.shortDesc | ||||
|         text_overview.text = media.info.shortDesc //if (tmdb.overview.isNotEmpty()) tmdb.overview else media.shortDesc | ||||
|  | ||||
|         // specific gui | ||||
|         if (media.type == MediaType.TVSHOW) { | ||||
|  | ||||
| @ -21,7 +21,7 @@ class CustomAdapter(val context: Context, private val originalMedia: ArrayList<M | ||||
|         val imagePoster = view.findViewById<ImageView>(R.id.image_poster) | ||||
|  | ||||
|         textTitle.text = filteredMedia[position].title | ||||
|         Glide.with(context).load(filteredMedia[position].posterLink).into(imagePoster) | ||||
|         Glide.with(context).load(filteredMedia[position].info.posterLink).into(imagePoster) | ||||
|  | ||||
|         return view | ||||
|     } | ||||
|  | ||||
| @ -8,14 +8,35 @@ class DataTypes { | ||||
|     } | ||||
| } | ||||
|  | ||||
| data class Media(val title: String, val link: String, val type: DataTypes.MediaType, val posterLink: String, val shortDesc : String, var episodes: List<Episode> = listOf(), val info : Info = Info()) { | ||||
| data class Media(val title: String, val link: String, val type: DataTypes.MediaType, val info : Info = Info(), var episodes: List<Episode> = listOf()) { | ||||
|     override fun toString(): String { | ||||
|         return title | ||||
|     } | ||||
| } | ||||
|  | ||||
| data class Info(var description: String = "", var year: Int = 0, var age: Int = 0, var episodesCount: Int = 0) | ||||
| data class Info( | ||||
|     var posterLink: String = "", | ||||
|     var shortDesc: String = "", | ||||
|     var description: String = "", | ||||
|     var year: Int = 0, | ||||
|     var age: Int = 0, | ||||
|     var episodesCount: Int = 0 | ||||
| ) | ||||
|  | ||||
| data class Episode(val title: String = "", val streamUrl: String = "", val posterLink: String = "", var description: String = "", var number: Int = 0, var watched: Boolean = false) | ||||
| data class Episode( | ||||
|     val title: String = "", | ||||
|     val streamUrl: String = "", | ||||
|     val posterLink: String = "", | ||||
|     var description: String = "", | ||||
|     var number: Int = 0, | ||||
|     var watched: Boolean = false | ||||
| ) | ||||
|  | ||||
| data class TMDBResponse(val id: Int = 0, val title: String = "", val overview: String = "", val posterUrl: String = "", val backdropUrl: String = "", var runtime: Int = 0) | ||||
| data class TMDBResponse( | ||||
|     val id: Int = 0, | ||||
|     val title: String = "", | ||||
|     val overview: String = "", | ||||
|     val posterUrl: String = "", | ||||
|     val backdropUrl: String = "", | ||||
|     var runtime: Int = 0 | ||||
| ) | ||||
|  | ||||
		Reference in New Issue
	
	Block a user