playlist GUI

This commit is contained in:
Dmitry Sergeev
2026-09-01 22:26:26 +03:00
parent cb5321cd8b
commit b0e7bc4cc3
7 changed files with 260 additions and 5 deletions
+7 -2
View File
@@ -6,6 +6,7 @@ type PlaylistTimingState struct {
Revision uint64
Duration time.Duration
Started bool
Expired bool
Deadline time.Time
}
@@ -16,6 +17,7 @@ func NewPlaylistTiming(
return PlaylistTimingState{
Revision: revision,
Duration: duration,
Expired: false,
}
}
@@ -24,10 +26,12 @@ func StartPlaylistTiming(
revision uint64,
now time.Time,
) (PlaylistTimingState, bool) {
if revision != current.Revision || current.Duration <= 0 || current.Started {
if revision != current.Revision ||
current.Duration <= 0 ||
current.Started ||
current.Expired {
return current, false
}
next := current
next.Started = true
next.Deadline = now.Add(current.Duration)
@@ -48,5 +52,6 @@ func ExpirePlaylistTiming(
next := current
next.Started = false
next.Deadline = time.Time{}
next.Expired = true
return next, true
}