Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add live, new and previously-shown data to db #147

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions data/src/main/java/com/m3u/data/database/model/Programme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,11 @@ data class Programme(
val title: String,
@ColumnInfo(name = "description")
val description: String,
@ColumnInfo(name = "new", defaultValue = "0")
val isNew: Boolean,
@ColumnInfo(name = "new_tag", defaultValue = "0")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"_tag"

val isNewTag: Boolean,
@ColumnInfo(name = "live", defaultValue = "0")
val isLive: Boolean,
val isNew: Boolean,
@ColumnInfo(name = "live_tag", defaultValue = "0")
val isLiveTag: Boolean,
@ColumnInfo(name = "previous_start")
val isLive: Boolean,
@ColumnInfo(name = "previous_start", defaultValue = "NULL")
val previouslyShownStart: String? = null,
@ColumnInfo(name = "icon")
val icon: String? = null,
Expand Down
4 changes: 0 additions & 4 deletions data/src/main/java/com/m3u/data/parser/epg/EpgData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ data class EpgProgramme(
val desc: String? = null,
val icon: String? = null,
val isNew: Boolean = false,
val isNewTag: Boolean = false,
val isLive: Boolean = false,
val isLiveTag: Boolean = false,
val previouslyShownStart: String? = null,
val categories: List<String>
) {
Expand Down Expand Up @@ -65,9 +63,7 @@ fun EpgProgramme.toProgramme(
icon = icon,
categories = categories,
isNew = isNew,
isNewTag = isNewTag,
isLive = isLive,
isLiveTag = isLiveTag,
previouslyShownStart = previouslyShownStart,
channelId = channel
)
14 changes: 5 additions & 9 deletions data/src/main/java/com/m3u/data/parser/epg/EpgParserImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ class EpgParserImpl @Inject constructor(
var desc: String? = null
val categories = mutableListOf<String>()
var icon: String? = null
var isNewTag = false // Initialize isNew flag
var isLiveTag = false
var isNew = false
var isLive = false
var previouslyShownStart: String? = null // Initialize previouslyShown variable
while (next() != XmlPullParser.END_TAG) {
if (eventType != XmlPullParser.START_TAG) continue
Expand All @@ -104,16 +104,14 @@ class EpgParserImpl @Inject constructor(
"desc" -> desc = readDesc()
"category" -> categories += readCategory()
"icon" -> icon = readIcon()
"new" -> isNewTag = readNew() // Update isNewTag flag
"live" -> isLiveTag = readLive() // Update isNewTag flag
"new" -> isNew = readNew() // Update isNewTag flag
"live" -> isLive = readLive() // Update isNewTag flag
"previously-shown" -> previouslyShownStart = readPreviouslyShown()
else -> skip()
}
}
require(XmlPullParser.END_TAG, ns, "programme")
// Add logic to determine whether the program is new based on title
val isNew = title?.contains("ᴺᵉʷ") ?: false
val isLive = title?.contains("ᴸᶦᵛᵉ") ?: false
//
themodfatherinc marked this conversation as resolved.
Show resolved Hide resolved
return EpgProgramme(
start = start,
stop = stop,
Expand All @@ -123,9 +121,7 @@ class EpgParserImpl @Inject constructor(
icon = icon,
categories = categories,
isNew = isNew,
isNewTag = isNewTag,
isLive = isLive,
isLiveTag = isLiveTag,
previouslyShownStart = previouslyShownStart
)
}
Expand Down
Loading