I am attempting to start a playlist after OSMC finishes booting on my Raspberry Pi 3B+
I have a script called mainplaylists.sh:
The script works if I call it by hand, and it writes to the log every time it boots, so SOMETHING is working.
#!/bin/bash
now=$(date +"%Y %b %d %H:%M:%S")
echo "Stream Launched at $now" >> /home/osmc/scripts/logs/oofstream.log
/usr/bin/kodi-send --action=PlayerControl"(repeatall)"
/usr/bin/kodi-send --action=PlayerControl"(RandomOn)"
#kodi-send --action=PlayMedia"(/home/osmc/ooftv/broadcast/musicvideos , isdir)"
/usr/bin/kodi-send --action=PlayMedia"(/home/osmc/ooftv/broadcast/playlists/today.m3u)"
Here’s the contents of my /lib/systemd/system/mainplaylist.service
[Unit]
Description = Launch the main playlist at boot
After = paths.target
[Service]
Type = oneshot
ExecStart = /home/osmc/scripts/mainplaylist.sh
[Install]
WantedBy = multi-user.target
So I know it’s running, but the videos never start playing. I’m thinking that the script is run too quickly, so the commands just get ignored. Any ideas what I’m doing wrong? Should I just put a delay in the shell script? That seems kind of sloppy so wondering if there was a better way to do it.