aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/c_go2work.go4
-rw-r--r--src/c_player.go24
2 files changed, 18 insertions, 10 deletions
diff --git a/src/c_go2work.go b/src/c_go2work.go
index 3b4e4a3..e985144 100644
--- a/src/c_go2work.go
+++ b/src/c_go2work.go
@@ -57,11 +57,11 @@ func main() {
ticker := time.NewTicker(2 * time.Second)
quit := make(chan struct{})
fmt.Println("Time is: " + t)
- exec_player("mpv", "/home/jozan/mu/rock/grunge/nirvana/1993_in_utero/04_rape_me.flac")
+ exec_player(true, "mpv", "--no-video", "/home/jozan/mu/rock/grunge/nirvana/1993_in_utero/04_rape_me.flac")
for {
select {
case <- ticker.C:
- exec_player("mpv", "/home/jozan/mu/rock/grunge/nirvana/1993_in_utero/04_rape_me.flac")
+ exec_player(false, "mpv", "--no-video", "/home/jozan/mu/rock/grunge/nirvana/1993_in_utero/04_rape_me.flac")
case <- quit:
ticker.Stop()
return
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)
+ }
}