github.com/gkstretton/dark/services/goo@v0.0.0-20231114224855-2d1a2074d446/main.go (about)

     1  package main
     2  
     3  import (
     4  	"flag"
     5  	"fmt"
     6  	"time"
     7  
     8  	"github.com/gkstretton/dark/services/goo/actor"
     9  	"github.com/gkstretton/dark/services/goo/email"
    10  	"github.com/gkstretton/dark/services/goo/events"
    11  	"github.com/gkstretton/dark/services/goo/filesystem"
    12  	"github.com/gkstretton/dark/services/goo/keyvalue"
    13  	"github.com/gkstretton/dark/services/goo/livecapture"
    14  	"github.com/gkstretton/dark/services/goo/livechat"
    15  	"github.com/gkstretton/dark/services/goo/mqtt"
    16  	"github.com/gkstretton/dark/services/goo/obs"
    17  	"github.com/gkstretton/dark/services/goo/scheduler"
    18  	"github.com/gkstretton/dark/services/goo/session"
    19  	"github.com/gkstretton/dark/services/goo/vialprofiles"
    20  )
    21  
    22  var (
    23  	test = flag.Bool("test", false, "if true, just run test code")
    24  )
    25  
    26  func main() {
    27  	flag.Parse()
    28  
    29  	if *test {
    30  		mqtt.Start()
    31  		sm := session.NewSessionManager(false)
    32  		twitchApi := livechat.Start()
    33  		events.Start(sm)
    34  		time.Sleep(time.Second)
    35  		actor.LaunchActor(twitchApi)
    36  		return
    37  	}
    38  
    39  	filesystem.AssertBasePaths()
    40  
    41  	mqtt.Start()
    42  	keyvalue.Start()
    43  	email.Start()
    44  
    45  	sm := session.NewSessionManager(false)
    46  	twitchApi := livechat.Start()
    47  
    48  	events.Start(sm)
    49  	livecapture.Start(sm)
    50  	obs.Start(sm)
    51  	vialprofiles.Start(sm)
    52  	scheduler.Start(sm, twitchApi)
    53  
    54  	// Block to prevent early quit
    55  	fmt.Println("finished init, main loop sleeping.")
    56  	for {
    57  		time.Sleep(time.Millisecond * time.Duration(100))
    58  	}
    59  }