turingmachine / omxplayer-sync

OMXPlayer-Sync facilitates synchronization of multiple OMXPlayer instances over the network in a master/slave fashion.
194 stars 70 forks source link

kill omxplayer-sync #99

Closed SebDominguez closed 4 years ago

SebDominguez commented 4 years ago

I want to be able to start and stop omxplayer-sync from a python script.

with the following class I can successfully start the slave player but nothing I tried to stop it worked.


class Player:
    p = None

    def play(self, video):
        if self.p is not None:
            print("There is already an omxplayer-sync instance running. Doing nothing. Stop first")
        elif self.p is None:
            print("No video playing, creating a omxplayer-sync instance")
            self.p = Popen(['omxplayer-sync', '-l', VIDEO_PATH + video])

    def stop(self):
        if self.p is not None:
            print("Killing omxplayer-sync process")
            self.p.terminate()
            self.p.kill()
            self.p.send_signal(signal.SIGTERM)
            os.kill(self.p.pid, signal.SIGTERM)
            self.p = None
        elif self.p is None:
            print("There is no video to stop")
magdesign commented 4 years ago

you can stop stop it with:

sudo pkill -9 -f omxplayer-sync
sudo pkill -9 -f omxplayer
sudo pkill -9 -f omxplayer.bin

https://github.com/magdesign/PocketVJ-CP-v3/blob/master/sync/omxkill