diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-30 13:20:29 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2022-03-30 13:20:29 +0200 |
commit | 231b272f820445472f07f54796ceeb75c3d642c0 (patch) | |
tree | cf7b8d9724f7c362eaf858352c48925f6e6b5fa8 | |
parent | In progress (diff) | |
download | go2work-231b272f820445472f07f54796ceeb75c3d642c0.tar.gz go2work-231b272f820445472f07f54796ceeb75c3d642c0.tar.bz2 go2work-231b272f820445472f07f54796ceeb75c3d642c0.tar.xz go2work-231b272f820445472f07f54796ceeb75c3d642c0.tar.zst go2work-231b272f820445472f07f54796ceeb75c3d642c0.zip |
Good progress
-rw-r--r-- | src/c_defs.go | 15 | ||||
-rw-r--r-- | src/c_go2work.go | 6 | ||||
-rw-r--r-- | src/c_player.go | 6 |
3 files changed, 19 insertions, 8 deletions
diff --git a/src/c_defs.go b/src/c_defs.go index b2c5474..41174b9 100644 --- a/src/c_defs.go +++ b/src/c_defs.go @@ -55,13 +55,24 @@ const ( SECS = 2 INTERVAL = 500 LOG_FORMAT = "bad time format" - DEF_FILES = "/usr/home/jozan/mu/progressive/progressive_black_metal/deathspell_omega/2010_paracletus/02_wings_of_predation.flac" DEF_MEDIA_PLAYER = "mpv" - DEF_PLAYER_OPTIONS = []string{"--no-video", "--loop"} DEF_RANDOM = true DEF_USE_FORTUNE = true ) +func DEF_FILES() []string { + return []string{ + "/usr/home/jozan/mu/progressive/progressive_black_metal/deathspell_omega/2010_paracletus/02_wings_of_predation.flac", + } +} + +func DEF_PLAYER_OPTIONS() []string { + return []string{ + "--no-video", + "--loop", + } +} + type options struct { files []string media_player string diff --git a/src/c_go2work.go b/src/c_go2work.go index 079d133..5dc460c 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 - * Wed Mar 30 01:38:10 CEST 2022 + * Wed Mar 30 13:20:26 CEST 2022 * Joe * * The main. @@ -112,11 +112,11 @@ func main() { if curr_t[HOURS] == dest_t[HOURS] && curr_t[MINS] == dest_t[MINS] && curr_t[SECS] == dest_t[SECS] { + args := append(DEF_PLAYER_OPTIONS(), DEF_FILES()[0]) exec_player( DEF_USE_FORTUNE, DEF_MEDIA_PLAYER, - "--no-video", - DEF_FILES, + args..., ) return } diff --git a/src/c_player.go b/src/c_player.go index 623adaa..7729d8a 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 01:18:12 CEST 2022 + * Wed Mar 30 13:20:13 CEST 2022 * Joe * * Funcs to play the file @@ -54,7 +54,7 @@ import ( "os/exec" ) -func exec_player(show_fortune bool, args ...string) { +func exec_player(show_fortune bool, player string, args ...string) { var cmd *exec.Cmd if show_fortune == true { fmt.Print("\n\n") @@ -64,7 +64,7 @@ func exec_player(show_fortune bool, args ...string) { cmd.Run() fmt.Println(out.String()) } - cmd = exec.Command(args[0], append(args[1:])...) + cmd = exec.Command(player, append(args[0:])...) err := cmd.Run(); if err != nil { log.Fatal(err) |