diff --git a/README.md b/README.md index 91b2413..213581d 100644 --- a/README.md +++ b/README.md @@ -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.
-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) diff --git a/buttons.py b/buttons.py index d09a58c..7f9138b 100644 --- a/buttons.py +++ b/buttons.py @@ -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) \ No newline at end of file diff --git a/videos/encode.py b/videos/encode.py index 9d6cdb9..5d8daf0 100644 --- a/videos/encode.py +++ b/videos/encode.py @@ -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)]