HAXXX: Make videos skippable
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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
3
skippable.mpv.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
SPACE quit
|
||||
ESC quit
|
||||
q quit
|
Reference in New Issue
Block a user