aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_player.go
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2022-03-24 16:13:22 +0100
committerJozanLeClerc <bousset.rudy@gmail.com>2022-03-24 16:13:22 +0100
commitc449b34d54519cab2b899b657e8dabe7f0641d41 (patch)
treed8de7d8480e2aed510c9c12a064119e7f203e220 /src/c_player.go
parentLearning in progress (diff)
downloadgo2work-c449b34d54519cab2b899b657e8dabe7f0641d41.tar.gz
go2work-c449b34d54519cab2b899b657e8dabe7f0641d41.tar.bz2
go2work-c449b34d54519cab2b899b657e8dabe7f0641d41.tar.xz
go2work-c449b34d54519cab2b899b657e8dabe7f0641d41.tar.zst
go2work-c449b34d54519cab2b899b657e8dabe7f0641d41.zip
Learning in progress
Diffstat (limited to 'src/c_player.go')
-rw-r--r--src/c_player.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/c_player.go b/src/c_player.go
index 399f90e..c9f804e 100644
--- a/src/c_player.go
+++ b/src/c_player.go
@@ -48,17 +48,25 @@
package main
import (
+ "bytes"
"fmt"
- // "log"
+ "log"
"os/exec"
)
-func exec_player(args ...string) {
+func exec_player(show_fortune bool, args ...string) {
+ var cmd *exec.Cmd
+ if show_fortune == true {
+ cmd = exec.Command("fortune", "-s")
+ var out bytes.Buffer
+ cmd.Stdout = &out
+ cmd.Run()
+ fmt.Println(out.String())
+ }
fmt.Println("Playing: " + args[len(args) - 1])
- cmd := exec.Command(args)
- // cmd := exec.Command("mpv", file)
- // err := cmd.Run();
- // if err != nil {
- // log.Fatal(err)
- // }
+ cmd = exec.Command(args[0], append(args[1:])...)
+ err := cmd.Run();
+ if err != nil {
+ log.Fatal(err)
+ }
}