From 96013554e05a7b2b518878a1b08e09a7c48e0fe3 Mon Sep 17 00:00:00 2001 From: Tordarus Date: Sat, 30 Aug 2025 15:39:17 +0200 Subject: [PATCH] added LoopState.RepeatAgain() function --- loopstate.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/loopstate.go b/loopstate.go index d4f4bf7..568b9fa 100644 --- a/loopstate.go +++ b/loopstate.go @@ -7,6 +7,9 @@ import ( "strings" ) +// LoopState is an integer representing the amount of loops. +// Specially handled values are LoopInfinite, LoopForced and LoopInvalid. +// There is also the alias value LoopNo which is equal to 1 type LoopState int const ( @@ -64,3 +67,8 @@ func (s LoopState) String() string { return strconv.Itoa(int(s)) } } + +// RepeatAgain returns true if the song will be repeated again after the end of the song is reached +func (s LoopState) RepeatAgain() bool { + return s == LoopInfinite || s == LoopForced || s > LoopNo +}