Able to ignore low idle time (in case I'm not alone and write on my computer)
This commit is contained in:
parent
0057ca3479
commit
32fb349db7
7
main.go
7
main.go
@ -159,6 +159,7 @@ func loadFile(path string) (s beep.StreamSeekCloser, format beep.Format, err err
|
|||||||
func main() {
|
func main() {
|
||||||
var weatherTime = flag.Duration("weather", -1, "Speak weather?")
|
var weatherTime = flag.Duration("weather", -1, "Speak weather?")
|
||||||
var noshuffle = flag.Bool("noshuffle", false, "Don't shuffle music order")
|
var noshuffle = flag.Bool("noshuffle", false, "Don't shuffle music order")
|
||||||
|
var ignoreidle = flag.Bool("ignoreidle", false, "Don't stop the reveil on idle detection change")
|
||||||
var sr = flag.Int("samplerate", 44100, "Samplerate for unifying output stream")
|
var sr = flag.Int("samplerate", 44100, "Samplerate for unifying output stream")
|
||||||
var claironTime = flag.Duration("clairon", -1, "Time before running the wake up clairon song")
|
var claironTime = flag.Duration("clairon", -1, "Time before running the wake up clairon song")
|
||||||
flag.DurationVar(&MaxRunTime, "maxruntime", MaxRunTime, "Maximum duration before auto exit")
|
flag.DurationVar(&MaxRunTime, "maxruntime", MaxRunTime, "Maximum duration before auto exit")
|
||||||
@ -278,9 +279,13 @@ loop:
|
|||||||
volume.Volume = -2 - math.Log(5/float64(ntick))/3
|
volume.Volume = -2 - math.Log(5/float64(ntick))/3
|
||||||
}
|
}
|
||||||
|
|
||||||
if xPrintIdle() < idle {
|
if ignoreidle == nil || !*ignoreidle {
|
||||||
|
if idle < 60000 {
|
||||||
|
idle = xPrintIdle()
|
||||||
|
} else if xPrintIdle() < idle {
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
|
}
|
||||||
case <-interrupt:
|
case <-interrupt:
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user