Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
These python scripts are used to make the Desktop Simpsons TV work.
Python scripts to make the Desktop Simpsons TV work.<BR>

You can find a complete build guide [here](https://withrow.io/simpsons-tv-build-guide)
A complete build guide can be found [here](https://withrow.io/simpsons-tv-build-guide).

Some small changes I made:

- I used [this TFT screen in my build](https://shop.pimoroni.com/products/pitft-plus-320x240-2-8-tft-resistive-touchscreen-pi-2-and-model-a-b) and didn't hard solder the Pi Zero, instead using headers
- I didn't use a [Micro USB Male Solder Plug](https://amzn.to/3kMflUv), I just [soldered wires directly to the Pi Zero](https://www.msldigital.com/pages/support-for-hub-zero)
- Added a software function to kill Wi-Fi and Bluetooth when the screen is off
- Added .m4v as an input format for `encode.py`

See my build [here](https://twitter.com/notmattjani/status/1436467546090348584)
32 changes: 22 additions & 10 deletions buttons.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,41 @@
GPIO.setup(26, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(18, GPIO.OUT)

def start_network():
os.system('rfkill unblock wifi')
os.system('rfkill unblock bluetooth')

def turnOnScreen():

def stop_network():
os.system('rfkill block wifi')
os.system('rfkill block bluetooth')


def turn_on_screen():
os.system('raspi-gpio set 19 op a5')
GPIO.output(18, GPIO.HIGH)
GPIO.output(18, GPIO.LOW)


def turnOffScreen():
def turn_off_screen():
os.system('raspi-gpio set 19 ip')
GPIO.output(18, GPIO.LOW)
GPIO.output(18, GPIO.HIGH)


turnOffScreen()
turn_off_screen()
screen_on = False


while (True):
# If you are having and issue with the button doing the opposite of what you want
# IE Turns on when it should be off, change this line to:
# input = not GPIO.input(26)
# i.e. it turns on when it should be off, change this line to:
input = GPIO.input(26)
# input = not GPIO.input(26)
if input != screen_on:
screen_on = input
if screen_on:
turnOnScreen()
turn_on_screen()
start_network()
else:
turnOffScreen()
time.sleep(0.3)
turn_off_screen()
stop_network()
time.sleep(0.3)
2 changes: 2 additions & 0 deletions videos/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def isVideo(videofile):
return True
if videofile.lower().endswith('.avi'):
return True
if videofile.lower().endswith('.m4v'):
return True
return False

newFiles = [os.path.join(dp, f) for dp, dn, filenames in os.walk(directory) for f in filenames if isVideo(f)]
Expand Down