Hi,
I don't know if this belongs in the Beginners, Troubleshooting or Advanced Users subforum. When my raspberry pi boots I would like it to look for all the video files in a particular directory then launch VLC with those videos playing as a playlist, on a loop. I wrote a python script that does this, with VLC being launched at the end using subprocess.Popen(). The final step was to get this to autostart when the pi boots. I tried editing /etc/rc.local, adding the command "/usr/bin/python" "/home/pi/Documents/Autoplay VLC.py" but nothing seemed to happen. After some Googling I tried editing /home/pi/.config/lxsession/LXDE-pi/autostart and added sleep 5 @"/usr/bin/python" "/home/pi/Documents/Autoplay VLC.py" so that it was only run once the GUI had been initialized. Still no dice. I tried making it run through the lxterminal @lxterminal -e "/usr/bin/python" "/home/pi/Documents/Autoplay VLC.py" but I'm left with a blank terminal on boot. I tried running the same command in a normal terminal and it ran fine. I tried adding sudo at the start and it didn't run. I don't know for sure, but I am image that commands in the autostart file are run as root. More Googling and I have found that no GUI applications can be run as root.
How can I get my script to autorun as the local user, so it actually opens the VLC window?
I've been pulling my hair out for a number of hours and this is as far as I have gotten.