Skip to content

Commit

Permalink
Hide "Sync Programmes" Button for Xtream VOD and Series Playlists.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Jun 1, 2024
1 parent 347b4f2 commit f48f2dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
19 changes: 12 additions & 7 deletions data/src/main/java/com/m3u/data/database/model/Playlist.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,18 @@ val Playlist.type: String?

fun Playlist.epgUrlsOrXtreamXmlUrl(): List<String> = when (source) {
DataSource.Xtream -> {
val input = XtreamInput.decodeFromPlaylistUrl(url)
val epgUrl = XtreamParser.createXmlUrl(
basicUrl = input.basicUrl,
username = input.username,
password = input.password
)
listOf(epgUrl)
when (type) {
DataSource.Xtream.TYPE_LIVE -> {
val input = XtreamInput.decodeFromPlaylistUrl(url)
val epgUrl = XtreamParser.createXmlUrl(
basicUrl = input.basicUrl,
username = input.username,
password = input.password
)
listOf(epgUrl)
}
else -> emptyList()
}
}

else -> epgUrls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import com.google.accompanist.permissions.rememberPermissionState
import com.m3u.core.util.basic.title
import com.m3u.data.database.model.DataSource
import com.m3u.data.database.model.Playlist
import com.m3u.data.database.model.epgUrlsOrXtreamXmlUrl
import com.m3u.data.repository.playlist.PlaylistRepository
import com.m3u.i18n.R.string
import com.m3u.material.components.Background
Expand Down Expand Up @@ -169,11 +170,13 @@ private fun PlaylistConfigurationScreen(
placeholder = stringResource(string.feat_playlist_configuration_user_agent).title(),
onValueChange = { userAgent = it }
)
SyncProgrammesButton(
subscribingOrRefreshing = subscribingOrRefreshing,
expired = expired,
onSyncProgrammes = onSyncProgrammes
)
if (playlist.epgUrlsOrXtreamXmlUrl().isNotEmpty()) {
SyncProgrammesButton(
subscribingOrRefreshing = subscribingOrRefreshing,
expired = expired,
onSyncProgrammes = onSyncProgrammes
)
}

if (playlist.source == DataSource.M3U) {
EpgManifestGallery(
Expand Down

0 comments on commit f48f2dc

Please sign in to comment.