HAXXX: Make videos skippable

This commit is contained in:
2020-03-21 12:05:22 +00:00
parent 8d48da1999
commit 4c0355ac4f
3 changed files with 12 additions and 9 deletions

View File

@@ -6,13 +6,6 @@ import (
)
func (w *WH40K) PlayVideo(name string, skippable bool) {
// TODO: allow the video to be skipped by pressing the ESC key or so. For
// now, skip unconditionally
if skippable {
log.Printf("TODO: Make videos conditionally skippable")
return
}
filename := w.Config.DataFile("SMK/" + name + ".smk")
if len(w.Config.VideoPlayer) == 0 {
@@ -21,7 +14,13 @@ func (w *WH40K) PlayVideo(name string, skippable bool) {
}
argc := w.Config.VideoPlayer[0]
argv := append(w.Config.VideoPlayer[1:], filename)
argv := append(w.Config.VideoPlayer[1:])
if skippable {
argv = append(argv, "--input-conf=skippable.mpv.conf")
}
argv = append(argv, filename)
if err := exec.Command(argc, argv...).Run(); err != nil {
log.Printf("Error playing video %v: %v", filename, err)
}

View File

@@ -24,7 +24,8 @@ func Run(configFile string) error {
Config: cfg,
}
wh40k.PlayUnskippableVideo("LOGOS")
wh40k.PlaySkippableVideo("LOGOS")
wh40k.PlaySkippableVideo("movie1")
return nil
}

3
skippable.mpv.conf Normal file
View File

@@ -0,0 +1,3 @@
SPACE quit
ESC quit
q quit