@sinibomb
This was just a simple change to the popular shutdown button script
But this played two audio files and displays an image on Shutdown, change .wav and .PNG file names to suit
shutdown.py
#!/usr/bin/python import RPi.GPIO as GPIO import time import subprocess # we will use the pin numbering to match the pins on the Pi, instead of the # GPIO pin outs (makes it easier to keep track of things) GPIO.setmode(GPIO.BOARD) # use the same pin that is used for the reset button (one button to rule them all!) GPIO.setup(5, GPIO.IN, pull_up_down = GPIO.PUD_UP) oldButtonState1 = True while True: #grab the current button state buttonState1 = GPIO.input(5) # check to see if button has been pushed if buttonState1 != oldButtonState1 and buttonState1 == False: # start playing silence to keep audio channel open to prevent missing beginning audio myinput = open('/dev/zero') subprocess.Popen(['/usr/bin/aplay', '-c2', '-r48000', '-fS16_LE', '-N' ], stdin=myinput ) # start showing screen (underneath emulationstation) subprocess.call("/home/pi/scripts/showImg.sh", shell=True) time.sleep(1) # play audio 1
subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_1.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(2) # quit emulation station subprocess.call("killall -SIGQUIT emulationstation", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(1) # play audio 2 subprocess.call("/usr/bin/aplay /home/pi/scripts/audio_2.wav", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) time.sleep(3) # shutdown subprocess.call("shutdown -h now", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) oldButtonState1 = buttonState1 time.sleep(.5)
showImg.sh
#!/bin/sh sudo /usr/bin/fbi -T 2 -once -t 30 -noverbose -a "/home/pi/scripts/image.png" &