I'm creating a program that plays a video when a GPIO button is pressed and once the selected video ends and closes I want to play a filler video while no button is pressed. To do this, I was wondering how one would check if a certain program is running programmatically?
import RPi.GPIO as gpio
import time, sys, os
gpio.setmode(gpio.BCM)
gpio.setup(23, gpio.IN)
gpio.setup(25, gpio.IN)
os.system('pkill omxplayer')
os.system('omxplayer -b Shopping.mp4 &')
while True:
if gpio.input(23):
os.system('pkill omxplayer')
os.system('omxplayer -b Shopping.mp4 &')
if gpio.input(25):
os.system('pkill omxplayer')
os.system('omxplayer -b Dodgeball.mp4 &')
# if omxplayer is not running, then run the filler video