aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_go2work.go
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2022-03-29 22:18:15 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2022-03-29 22:18:15 +0200
commit4be5f62f0adc412c7eccccee59d03c00e5c4b5cf (patch)
treed3118e6fc8c60500b328e115ed5427900c21c2db /src/c_go2work.go
parentNew file (diff)
downloadgo2work-4be5f62f0adc412c7eccccee59d03c00e5c4b5cf.tar.gz
go2work-4be5f62f0adc412c7eccccee59d03c00e5c4b5cf.tar.bz2
go2work-4be5f62f0adc412c7eccccee59d03c00e5c4b5cf.tar.xz
go2work-4be5f62f0adc412c7eccccee59d03c00e5c4b5cf.tar.zst
go2work-4be5f62f0adc412c7eccccee59d03c00e5c4b5cf.zip
Update
Diffstat (limited to 'src/c_go2work.go')
-rw-r--r--src/c_go2work.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/c_go2work.go b/src/c_go2work.go
index 89fb91d..3daa17b 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
- * Tue Mar 29 20:55:49 CEST 2022
+ * Tue Mar 29 22:14:51 CEST 2022
* Joe
*
* The main.
@@ -51,6 +51,7 @@ import (
"log"
"os"
"time"
+ "strconv"
"strings"
)
@@ -63,6 +64,7 @@ const (
)
func main() {
+ var dest_t [2]int
log.SetPrefix(PROGNAME + ": ")
log.SetFlags(0)
if len(os.Args[0:]) == 1 {
@@ -81,17 +83,26 @@ func main() {
return
}
curr_t := get_time()
- dest_t := strings.Split(os.Args[1], ":")
+ str_dest_t := strings.Split(os.Args[1], ":")
+ dest_t[HOURS], _ = strconv.Atoi(str_dest_t[HOURS])
+ dest_t[MINS], _ = strconv.Atoi(str_dest_t[MINS])
+ // dest_t = [2]int{0, 0}
ticker := time.NewTicker(1 * time.Second)
quit := make(chan struct{})
- print_time(curr_t)
for {
select {
case <- ticker.C:
curr_t = get_time()
- print_time(curr_t)
+ // print_time(curr_t)
+ print_time_left(curr_t, dest_t)
if curr_t[HOURS] == dest_t[HOURS] && curr_t[MINS] == dest_t[MINS] {
- exec_player(true, "mpv", "--no-video", "/usr/home/jozan/mu/progressive/progressive_black_metal/deathspell_omega/2010_paracletus/02_wings_of_predation.flac")
+ exec_player(
+ true,
+ "mpv",
+ "--no-video",
+ "/usr/home/jozan/mu/progressive/progressive_black_metal/deathspell_omega/2010_paracletus/02_wings_of_predation.flac",
+ )
+ return
}
case <- quit:
ticker.Stop()
@@ -100,8 +111,12 @@ func main() {
}
}
-func get_time() []string {
+func get_time() [3]int {
+ var curr_t [3]int
now := time.Now()
t := strings.Split(now.Format("15:04:05"), ":")
- return t
+ curr_t[HOURS], _ = strconv.Atoi(t[HOURS])
+ curr_t[MINS], _ = strconv.Atoi(t[MINS])
+ curr_t[SECS], _ = strconv.Atoi(t[SECS])
+ return curr_t
}