commit 5ae6430d0ef201fad82e679a6495eb3d9e38f732 Author: jimmy Date: Sat Jul 16 23:13:36 2022 +1200 inital commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d714b65 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +audio +videos +images \ No newline at end of file diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..92ad5b0 --- /dev/null +++ b/Pipfile @@ -0,0 +1,14 @@ +[[source]] +url = "https://pypi.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +python-vlc = "*" +opencv-python = "*" +screeninfo = "*" + +[dev-packages] + +[requires] +python_version = "3.10" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..44aa189 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,78 @@ +{ + "_meta": { + "hash": { + "sha256": "d72464444b1b004eb4741f9b93e3e91f495577de972178bcc007fb5417876453" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.10" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "numpy": { + "hashes": [ + "sha256:1408c3527a74a0209c781ac82bde2182b0f0bf54dea6e6a363fe0cc4488a7ce7", + "sha256:173f28921b15d341afadf6c3898a34f20a0569e4ad5435297ba262ee8941e77b", + "sha256:1865fdf51446839ca3fffaab172461f2b781163f6f395f1aed256b1ddc253622", + "sha256:3119daed207e9410eaf57dcf9591fdc68045f60483d94956bee0bfdcba790953", + "sha256:35590b9c33c0f1c9732b3231bb6a72d1e4f77872390c47d50a615686ae7ed3fd", + "sha256:37e5ebebb0eb54c5b4a9b04e6f3018e16b8ef257d26c8945925ba8105008e645", + "sha256:37ece2bd095e9781a7156852e43d18044fd0d742934833335599c583618181b9", + "sha256:3ab67966c8d45d55a2bdf40701536af6443763907086c0a6d1232688e27e5447", + "sha256:47f10ab202fe4d8495ff484b5561c65dd59177949ca07975663f4494f7269e3e", + "sha256:55df0f7483b822855af67e38fb3a526e787adf189383b4934305565d71c4b148", + "sha256:5d732d17b8a9061540a10fda5bfeabca5785700ab5469a5e9b93aca5e2d3a5fb", + "sha256:68b69f52e6545af010b76516f5daaef6173e73353e3295c5cb9f96c35d755641", + "sha256:7e8229f3687cdadba2c4faef39204feb51ef7c1a9b669247d49a24f3e2e1617c", + "sha256:8002574a6b46ac3b5739a003b5233376aeac5163e5dcd43dd7ad062f3e186129", + "sha256:876f60de09734fbcb4e27a97c9a286b51284df1326b1ac5f1bf0ad3678236b22", + "sha256:9ce242162015b7e88092dccd0e854548c0926b75c7924a3495e02c6067aba1f5", + "sha256:a35c4e64dfca659fe4d0f1421fc0f05b8ed1ca8c46fb73d9e5a7f175f85696bb", + "sha256:aeba539285dcf0a1ba755945865ec61240ede5432df41d6e29fab305f4384db2", + "sha256:b15c3f1ed08df4980e02cc79ee058b788a3d0bef2fb3c9ca90bb8cbd5b8a3a04", + "sha256:c2f91f88230042a130ceb1b496932aa717dcbd665350beb821534c5c7e15881c", + "sha256:d748ef349bfef2e1194b59da37ed5a29c19ea8d7e6342019921ba2ba4fd8b624", + "sha256:e0d7447679ae9a7124385ccf0ea990bb85bb869cef217e2ea6c844b6a6855073" + ], + "markers": "python_version >= '3.10'", + "version": "==1.23.1" + }, + "opencv-python": { + "hashes": [ + "sha256:0dc82a3d8630c099d2f3ac1b1aabee164e8188db54a786abb7a4e27eba309440", + "sha256:5af8ba35a4fcb8913ffb86e92403e9a656a4bff4a645d196987468f0f8947875", + "sha256:6e32af22e3202748bd233ed8f538741876191863882eba44e332d1a34993165b", + "sha256:c5bfae41ad4031e66bb10ec4a0a2ffd3e514d092652781e8b1ac98d1b59f1158", + "sha256:dbdc84a9b4ea2cbae33861652d25093944b9959279200b7ae0badd32439f74de", + "sha256:e6e448b62afc95c5b58f97e87ef84699e6607fe5c58730a03301c52496005cae", + "sha256:f482e78de6e7b0b060ff994ffd859bddc3f7f382bb2019ef157b0ea8ca8712f5" + ], + "index": "pypi", + "version": "==4.6.0.66" + }, + "python-vlc": { + "hashes": [ + "sha256:92f98fee088f72bd6d063b3b3312d0bd29b37e7ad65ddeb3a7303320300c2807", + "sha256:c409afb38fe9f788a663b4302ca583f31289ef0860ab2b1668da96bbe8f14bfc" + ], + "index": "pypi", + "version": "==3.0.16120" + }, + "screeninfo": { + "hashes": [ + "sha256:9501bf8b8458c7d1be4cb0ac9abddddfa80b932fb3f65bfcb54f5586434b1dc5", + "sha256:dac455fbed79e82c481d59a00962f543e5a9bf3c2cc9f0e48e2714eb8d3cec23" + ], + "index": "pypi", + "version": "==0.8" + } + }, + "develop": {} +} diff --git a/audio.py b/audio.py new file mode 100755 index 0000000..aabda57 --- /dev/null +++ b/audio.py @@ -0,0 +1,8 @@ +import pygame +pygame.mixer.init() +pygame.mixer.music.load("morninggarden.mp3") +pygame.mixer.music.set_volume(0.5) +pygame.mixer.music.play() +while pygame.mixer.music.get_busy() == True: + continue + \ No newline at end of file diff --git a/led.py b/led.py new file mode 100755 index 0000000..c2e28f1 --- /dev/null +++ b/led.py @@ -0,0 +1,18 @@ + +from gpiozero import LED, Button +from time import sleep +import random + +count = 0 + +leds = [LED(19), LED(26), LED(13)] +button = Button(5) + +def b(): + print("pressed") + +button.when_pressed = b + +while True: + leds[random.randint(0,2)].toggle() + sleep(0.2) diff --git a/main.py b/main.py new file mode 100644 index 0000000..e69de29 diff --git a/printer.py b/printer.py new file mode 100755 index 0000000..a3debd0 --- /dev/null +++ b/printer.py @@ -0,0 +1,12 @@ +import StarTSPImage +from PIL import Image, ImageDraw + +image = Image.new('RGB', (500, 500), color='White') +draw = ImageDraw.Draw(image) +draw.ellipse((0, 0, 500, 500), fill='Black') +draw.ellipse((10, 10, 490, 490), fill='White') + +raster = StarTSPImage.imageToRaster(image, cut=True) + +printer = open('/dev/usb/lp0', "wb") +printer.write(raster) \ No newline at end of file diff --git a/video.py b/video.py new file mode 100644 index 0000000..93ad05c --- /dev/null +++ b/video.py @@ -0,0 +1,56 @@ +from random import randint +import cv2 +import numpy as np +import os + +class Video: + def __init__(self, x, y): + self.x = x + self.y = y + + def setVideo(self, path): + self.path = path + + def start(self): + self.run = True + self.cap = cv2.VideoCapture(self.path) + # Check if camera opened successfully + if (self.cap.isOpened()== False): + print("Error opening video file") + + totalframecount= int(self.cap.get(cv2.CAP_PROP_FRAME_COUNT)) + + print("The total number of frames in this video is ", totalframecount) + + self.cap.set(cv2.CAP_PROP_POS_FRAMES, randint(0, totalframecount* 0.9)) + + # Read until video is completed + while(self.cap.isOpened() and self.run): + + # Capture frame-by-frame + ret, frame = self.cap.read() + if ret == True: + + # Display the resulting frame + + cv2.namedWindow("window", cv2.WND_PROP_FULLSCREEN) + cv2.moveWindow("window", self.x, self.y) + cv2.setWindowProperty("window",cv2.WND_PROP_FULLSCREEN,cv2.WINDOW_FULLSCREEN) + + cv2.imshow("window", frame) + + + # Press Q on keyboard to exit + if cv2.waitKey(25) & 0xFF == ord('q'): + break + + # Break the loop + else: + break + + def stop(self): + self.run = False + self.cap.release() + + # Closes all the frames + cv2.destroyAllWindows() \ No newline at end of file