television

a simple LAN/WLAN desktop public broadcasting service
Log | Files | Refs | README

commit bbafdc28f9e6e469f71c384a8adfd086c6c6c5cd
parent 8e3c4acc09d81ba43004601c0f7e0090542efcf1
Author: ugrnm <ultrageranium@bleu255.com>
Date:   Fri, 27 Sep 2024 18:36:37 +0200

custom snap

Diffstat:
Mtelevision.go | 27++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/television.go b/television.go @@ -3,6 +3,7 @@ package main import ( "flag" "os" + "os/exec" "fmt" "time" "net/http" @@ -11,8 +12,9 @@ import ( ) var( - portNum int - wwwDir string + portNum int + wwwDir string + snapCmd string ) func snap() { @@ -43,13 +45,32 @@ func snap() { } } +func mysnap() { + + for { + + cmd := exec.Command("sh", "-c", snapCmd) + if err := cmd.Run(); err != nil { + panic(err) + } + + time.Sleep(1000 * time.Millisecond) + + } +} + func main() { flag.IntVar(&portNum, "port", 8888, "http port number") flag.StringVar(&wwwDir, "www", "./www", "www directory") + flag.StringVar(&snapCmd, "snap", "", "custom snap command") flag.Parse() - go snap() + if len(snapCmd) > 0 { + go mysnap() + } else { + go snap() + } fmt.Printf("we're live on port %d!\n", portNum) fmt.Printf("ctrl-c for emergency shutdown\n")