mirror of
https://github.com/recloudstream/cloudstream-extensions-multilingual.git
synced 2024-08-15 03:15:14 +00:00
try to speed up the getMainPage
This commit is contained in:
parent
9fef2e58f4
commit
2447cee079
1 changed files with 21 additions and 9 deletions
|
@ -595,8 +595,8 @@ class MacIPTVProvider(override var lang: String) : MainAPI() {
|
||||||
|
|
||||||
|
|
||||||
val rgxcodeCountry = findKeyWord(codeCountry)
|
val rgxcodeCountry = findKeyWord(codeCountry)
|
||||||
val arrayHomepage = arrayListOf<HomePageList>()
|
|
||||||
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
override suspend fun getMainPage(page: Int, request: MainPageRequest): HomePageResponse {
|
||||||
|
val arrayHomepage = arrayListOf<HomePageList>()
|
||||||
if (!firstInitDone) {
|
if (!firstInitDone) {
|
||||||
val headerIPTV = getAuthHeader()
|
val headerIPTV = getAuthHeader()
|
||||||
val url_info =
|
val url_info =
|
||||||
|
@ -642,24 +642,26 @@ class MacIPTVProvider(override var lang: String) : MainAPI() {
|
||||||
responseGetGenretoJSON.js.forEach { js ->
|
responseGetGenretoJSON.js.forEach { js ->
|
||||||
val idGenre = js.id
|
val idGenre = js.id
|
||||||
val categoryTitle = js.title.toString()
|
val categoryTitle = js.title.toString()
|
||||||
|
val arraymedia = ArrayList<Channel>()
|
||||||
if (idGenre!!.contains("""\d""".toRegex()) && (categoryTitle.uppercase()
|
if (idGenre!!.contains("""\d""".toRegex()) && (categoryTitle.uppercase()
|
||||||
.contains(rgxcodeCountry) ||
|
.contains(rgxcodeCountry) ||
|
||||||
categoryTitle.isContainsTargetCountry()
|
categoryTitle.isContainsTargetCountry()
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
AllchannelstoJSON.forEach { data ->
|
val itr = AllchannelstoJSON.iterator()
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
val data = itr.next()
|
||||||
val genre = data.tvGenreId
|
val genre = data.tvGenreId
|
||||||
|
|
||||||
if (genre != null) {
|
if (genre != null) {
|
||||||
if (genre == idGenre) {
|
if (genre == idGenre) {
|
||||||
|
itr.remove()
|
||||||
val name = data.name.toString()
|
val name = data.name.toString()
|
||||||
val tv_genre_id = data.tvGenreId
|
val tv_genre_id = data.tvGenreId
|
||||||
val idCH = data.id
|
val idCH = data.id
|
||||||
val link = "http://localhost/ch/$idCH" + "_"
|
val link = "http://localhost/ch/$idCH" + "_"
|
||||||
val logo = data.logo?.replace("""\""", "")
|
val logo = data.logo?.replace("""\""", "")
|
||||||
val ch_id = data.cmds[0].chId
|
val ch_id = data.cmds[0].chId
|
||||||
arraymediaPlaylist.add(
|
arraymedia.add(
|
||||||
Channel(
|
Channel(
|
||||||
name,
|
name,
|
||||||
link,
|
link,
|
||||||
|
@ -670,7 +672,18 @@ class MacIPTVProvider(override var lang: String) : MainAPI() {
|
||||||
ch_id
|
ch_id
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
arraymediaPlaylist.add(
|
||||||
|
Channel(
|
||||||
|
name,
|
||||||
|
link,
|
||||||
|
logo,
|
||||||
|
"",
|
||||||
|
idCH,
|
||||||
|
tv_genre_id,
|
||||||
|
ch_id
|
||||||
|
)
|
||||||
|
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -680,8 +693,8 @@ class MacIPTVProvider(override var lang: String) : MainAPI() {
|
||||||
val groupMedia = ArrayList<String>()
|
val groupMedia = ArrayList<String>()
|
||||||
var b_new: String
|
var b_new: String
|
||||||
var newgroupMedia: Boolean
|
var newgroupMedia: Boolean
|
||||||
val home = arraymediaPlaylist.mapNotNull { media ->
|
val home = arraymedia.mapNotNull { media ->
|
||||||
val b = cleanTitle(media.title)//
|
val b = cleanTitle(media.title)
|
||||||
b_new = b.take(6)
|
b_new = b.take(6)
|
||||||
newgroupMedia = true
|
newgroupMedia = true
|
||||||
for (nameMedia in groupMedia) {
|
for (nameMedia in groupMedia) {
|
||||||
|
@ -748,4 +761,3 @@ class MacIPTVProvider(override var lang: String) : MainAPI() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue