diff --git a/internal/wh40k/videos.go b/internal/wh40k/videos.go index 0cd9e0b..c861bcd 100644 --- a/internal/wh40k/videos.go +++ b/internal/wh40k/videos.go @@ -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) } diff --git a/internal/wh40k/wh40k.go b/internal/wh40k/wh40k.go index d8cf474..08a75e5 100644 --- a/internal/wh40k/wh40k.go +++ b/internal/wh40k/wh40k.go @@ -24,7 +24,8 @@ func Run(configFile string) error { Config: cfg, } - wh40k.PlayUnskippableVideo("LOGOS") + wh40k.PlaySkippableVideo("LOGOS") + wh40k.PlaySkippableVideo("movie1") return nil } diff --git a/skippable.mpv.conf b/skippable.mpv.conf new file mode 100644 index 0000000..c8a55be --- /dev/null +++ b/skippable.mpv.conf @@ -0,0 +1,3 @@ +SPACE quit +ESC quit +q quit