测试当前流程

时间:2015-02-04 00:28:07

标签: python raspberry-pi

我创建了一个程序,当按下GPIO按钮时播放视频,一旦所选视频结束和关闭,我想在没有按下按钮的情况下播放填充视频。为此,我想知道如何检查某个程序是否以编程方式运行?

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

0 个答案:

没有答案