playlist GUI
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user