Created
July 23, 2020 19:35
-
-
Save gourneau/99f76e724d7b681f4e58f68fe2a85db5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import subprocess | |
import os | |
import re | |
import glob | |
import sys | |
from blinkytape import BlinkyTape | |
devices = glob.glob("/dev/cu.usbmodem*") | |
if not devices: | |
print("No tape") | |
sys.exit(1) | |
# To find your COM port number in Windows, run "Pattern Paint -> Help -> System Information" | |
bb = BlinkyTape(devices[0]) | |
# via https://lostdomain.org/2020/06/17/introducing-the-stream-deck-plugin-for-zoom/ | |
""" | |
set zoomStatus to "closed" | |
set muteStatus to "muted" | |
set videoStatus to "stopped" | |
set shareStatus to "stopped" | |
tell application "System Events" | |
if exists (window 1 of process "zoom.us") then | |
set zoomStatus to "open" | |
end if | |
end tell | |
if (zoomStatus contains "open") then | |
tell application "System Events" to tell application process "zoom.us" | |
if exists (menu item "Mute Audio" of menu 1 of menu bar item "Meeting" of menu bar 1) then | |
set muteStatus to "unmuted" | |
else | |
set muteStatus to "muted" | |
end if | |
if exists (menu item "Start Video" of menu 1 of menu bar item "Meeting" of menu bar 1) then | |
set videoStatus to "stopped" | |
else | |
set videoStatus to "started" | |
end if | |
if exists (menu item "Start Share" of menu 1 of menu bar item "Meeting" of menu bar 1) then | |
set shareStatus to "stopped" | |
else | |
set shareStatus to "started" | |
end if | |
end tell | |
end if | |
do shell script "echo mute:" & (muteStatus as text) & ",video:" & (videoStatus as text) & ",zoom:" & (zoomStatus as text) & ",share:" & (shareStatus as text) | |
""" | |
z = os.popen("osascript -e 'set zoomStatus to \"closed\"\nset muteStatus to " | |
"\"muted\"\nset videoStatus to \"stopped\"\nset shareStatus to " | |
"\"stopped\"\ntell application \"System Events\"\nif exists (window 1 of " | |
"process \"zoom.us\") then\nset zoomStatus to \"open\"\nend if\nend " | |
"tell\nif (zoomStatus contains \"open\") then\ntell application \"System " | |
"Events\" to tell application process \"zoom.us\"\nif exists (menu item " | |
"\"Mute audio\" of menu 1 of menu bar item \"Meeting\" of menu bar 1) " | |
"then\nset muteStatus to \"unmuted\"\nelse\nset muteStatus to " | |
"\"muted\"\nend if\nif exists (menu item \"Start Video\" of menu 1 of menu " | |
"bar item \"Meeting\" of menu bar 1) then\nset videoStatus to " | |
"\"stopped\"\nelse\nset videoStatus to \"started\"\nend if\nif exists " | |
"(menu item \"Start Share\" of menu 1 of menu bar item \"Meeting\" of menu " | |
"bar 1) then\nset shareStatus to \"stopped\"\nelse\nset shareStatus to " | |
"\"started\"\nend if\nend tell\nend if\ndo shell script \"echo mute:\" & " | |
"(muteStatus as text) & \",video:\" & (videoStatus as text) & \",zoom:\" & " | |
"(zoomStatus as text) & \",share:\" & (shareStatus as text)'").read() | |
z = z.strip() | |
zoom_dict = {} | |
for item in z.split(","): | |
k,v = item.split(":") | |
zoom_dict[k] = v | |
# {'mute': 'muted', 'video': 'started', 'zoom': 'open', 'share': 'started'} | |
# Now do your thing to show state | |
if zoom_dict["mute"] == "muted": | |
red= 0 | |
green = 0 | |
blue = 0 | |
print("") | |
else: | |
red= 0 | |
green = 0 | |
blue = 255 | |
print("🎙️On Air") | |
for x in range(60): | |
bb.sendPixel(red, green, blue) | |
bb.show() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment