From c6318fd63a8138df25e735981102a5d67c503c65 Mon Sep 17 00:00:00 2001 From: Filip Borum Poulsen Date: Sun, 8 Dec 2024 19:48:31 +0100 Subject: [PATCH] Changed crontab and only play audio on overlay video --- crontab | 16 +++++++++++----- index.js | 11 +++++++++-- play-overlay.sh | 4 ---- 3 files changed, 20 insertions(+), 11 deletions(-) mode change 100644 => 100755 crontab diff --git a/crontab b/crontab old mode 100644 new mode 100755 index 1c54480..e6954cf --- a/crontab +++ b/crontab @@ -1,5 +1,11 @@ -30 16 * * * /home/pi/video-player/start-projector.sh -0 17 * * * /home/pi/video-player/play-overlay.sh -0 18 * * * /home/pi/video-player/play-overlay.sh -0 19 * * * /home/pi/video-player/play-overlay.sh -30 19 * * * /home/pi/video-player/stop-projector.sh +30 16 * * 5,6,0 /home/pi/video-player/start-projector.sh +0 17 * * 5,6,0 /home/pi/video-player/play-overlay.sh +0 18 * * 5,6,0 /home/pi/video-player/play-overlay.sh +0 19 * * 5,6,0 /home/pi/video-player/play-overlay.sh +30 19 * * 5,6,0 /home/pi/video-player/stop-projector.sh + +30 19 * * 5,6,0 /home/pi/video-player/relay-on.sh +30 16 * * 5,6,0 /home/pi/video-player/relay-off.sh + +0 7 * * * /home/pi/video-player/relay-on.sh +0 23 * * * /home/pi/video-player/relay-off.sh diff --git a/index.js b/index.js index b55c46a..f45bdb6 100755 --- a/index.js +++ b/index.js @@ -77,7 +77,7 @@ if (fs.existsSync('/selectedvideo')) { function startVideo(path) { - const newProcess = require('child_process').spawn('ffplay', ['-fs', '-loop', '2147483647', '-hide_banner', '-loglevel', 'error', path]); + const newProcess = require('child_process').spawn('ffplay', ['-fs', '-loop', '2147483647', '-hide_banner', '-an', '-loglevel', 'error', path]); // process.stdout.on('data', (data) => { // console.log(`stdout: ${data}`); @@ -138,7 +138,14 @@ app.post("/select", (req, res) => { }); app.post("/playoverlay", (req, res) => { - require('child_process').spawn('/home/pi/video-player/play-overlay.sh'); + const p = require('child_process').spawn('/home/pi/video-player/play-overlay.sh'); + // p.stdout.on('data', (data) => { + // console.log(`stdout: ${data}`); + // }); + + // p.stderr.on('data', (data) => { + // console.error(`stderr: ${data}`); + // }); res.json({ status: 'ok' }); }); diff --git a/play-overlay.sh b/play-overlay.sh index 990a4b8..8cacac7 100755 --- a/play-overlay.sh +++ b/play-overlay.sh @@ -1,9 +1,5 @@ #!/bin/bash -/home/pi/video-player/relay-on.sh & - export DISPLAY=:0 ffplay -fs -autoexit $(cat /overlayvideo) - -/home/pi/video-player/relay-off.sh &