adept/adept.go

35 lines
779 B
Go
Raw Normal View History

2022-08-31 19:56:06 -04:00
package main
import (
2022-09-01 00:17:29 -04:00
"time"
2022-08-31 19:56:06 -04:00
"github.com/spf13/viper"
"git.metaunix.net/BitGoblin/adept/config"
"git.metaunix.net/BitGoblin/adept/transcoder"
)
func main() {
config.LoadConfig()
r := transcoder.NewRepository(viper.GetString("transcoder.repository"))
2022-09-01 00:17:29 -04:00
// main program loop - runs infinitely until externally terminated
for {
ingestFiles := r.SearchIngest()
for _, i := range ingestFiles {
// archive file
r.ArchiveFile(i.Name())
// transcode file
transcoder.Transcode(i.Name())
// clean up source file
r.CleanupFile(i.Name())
}
// sleep for X minutes - specified in the adept.toml config file
interval := viper.GetInt("transcoder.interval")
time.Sleep(time.Duration(interval) * time.Minute)
}
2022-08-31 19:56:06 -04:00
}