示例#1
0
    def run(self):
        global playerState, identifyFlag
        print ":::::MEDIAPLAYER THREAD RUN METHOD STARTED:::::"
        self.reloadConfig()

        # show player startup image for 3 seconds (+ loading time)
        self.showRaspMediaImage()
        time.sleep(5)

        # enter media player thread loop
        while True:
            # wait until the player flag is set to STARTED
            #while playerState == PLAYER_STOPPED:
            #    time.sleep(0.5)
            self.runevent.wait()
            # remove raspmedia image process
            processtool.killProcesses('fbi')

            if identifyFlag:
                self.showIdentifyImage()
                self.identify_event.wait()
                if playerState == PLAYER_STOPPED:
                    self.showRaspMediaImage()
            else:
                #reload config and process media files
                self.reloadConfig()
                playerState = PLAYER_STARTED
                self.processMediaFiles()
                time.sleep(0.5)
                self.showRaspMediaImage()
示例#2
0
def stop():
    global mp_thread
    global playerState
    playerState = PLAYER_STOPPED
    mp_thread.runevent.clear()
    # check for fbi and omxplayer processes and terminate them
    processtool.killProcesses('fbi')
    # stop omx player instance if running
    subprocess.call([cwd + '/scripts/quitplay.sh'])
    processtool.killProcesses('omxplayer')