diff options
-rw-r--r-- | src/c_defs.go | 4 | ||||
-rw-r--r-- | src/c_go2work.go | 18 | ||||
-rw-r--r-- | src/c_player.go | 21 |
3 files changed, 31 insertions, 12 deletions
diff --git a/src/c_defs.go b/src/c_defs.go index 4a4dc59..e969c3b 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/c_defs.go - * Fri Apr 1 17:11:48 CEST 2022 + * Fri Apr 1 17:40:35 CEST 2022 * Joe * * Definitions. @@ -69,8 +69,8 @@ func DEF_FILES() []string { func DEF_PLAYER_OPTIONS() []string { return []string{ - "--no-video", "--loop", + "--no-video", } } diff --git a/src/c_go2work.go b/src/c_go2work.go index faca5a3..c234e86 100644 --- a/src/c_go2work.go +++ b/src/c_go2work.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/c_go2work.go - * Fri Apr 1 17:03:18 CEST 2022 + * Fri Apr 1 17:40:27 CEST 2022 * Joe * * The main. @@ -116,12 +116,16 @@ func main() { curr_t[SECS] == dest_t[SECS] { // implement random args := append(DEF_PLAYER_OPTIONS(), DEF_FILES()[0]) - exec_player( - options.use_fortune, - options.media_player, - args..., - ) - return + has_rang := false + for { + exec_player( + options.use_fortune, + has_rang, + options.media_player, + args..., + ) + has_rang = true + } } case <- quit: ticker.Stop() diff --git a/src/c_player.go b/src/c_player.go index 7729d8a..f3485be 100644 --- a/src/c_player.go +++ b/src/c_player.go @@ -39,7 +39,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * go2work: src/c_player.go - * Wed Mar 30 13:20:13 CEST 2022 + * Fri Apr 1 17:40:31 CEST 2022 * Joe * * Funcs to play the file @@ -54,9 +54,24 @@ import ( "os/exec" ) -func exec_player(show_fortune bool, player string, args ...string) { +func has_rang() (f func()(int)) { + var i int + i = 0 + f = func()(int) { + i++ + return i + } + return +} + +func exec_player( + show_fortune bool, + has_rang bool, + player string, + args ...string, +) { var cmd *exec.Cmd - if show_fortune == true { + if show_fortune == true && has_rang == false { fmt.Print("\n\n") cmd = exec.Command("fortune", "-s") var out bytes.Buffer |