Skip to content

Instantly share code, notes, and snippets.

@timsutton
Created June 7, 2019 11:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timsutton/c8d8b526e954da04f6d8497088f6b63e to your computer and use it in GitHub Desktop.
Save timsutton/c8d8b526e954da04f6d8497088f6b63e to your computer and use it in GitHub Desktop.
shell alias to join the currently-scheduled Zoom meeting on my calendar
join_zoom() {
# Joins the first Zoom meeting URL found in events happening now on
# your calendar, by searching their descriptions/locations info for
# "zoom.us" URLs, and opening them using `open`
#
# Another option for launching Zoom is directly, via its own URL handler like
# zoommtg://zoom.us/join?confno=123456789, but not sure how this works
# with static meeting URLs like zoom.us/my/myusername, and seems it
# could change in Zoom app updates, whereas the web URLs will always know
# what to do.
#
# Requires:
# 1. Work GSuite account is configured on macOS for calendar access,
# and calendars are set to refresh automatically
# 2. icalBuddy is installed (can use `brew install ical-buddy`)
#
# The `-ic` (include calendar) option limits the search to specified
# calendars, and can take a comma-separated list if you wish to
# include multiple, or you can also just remove the option to show all.
#
# If desired, there are other timing options for icalBuddy such as:
# icalBuddy eventsFrom:'2019-04-15 12:00:00 -0400' to:'2019-04-16 4:00:00 -0400'
# or other natural language options, see http://hasseg.org/icalBuddy/examples.html
icalBuddy -ic 'tim.sutton@saucelabs.com' eventsNow | \
python -c "
import re, subprocess, sys, time
input = sys.stdin.read()
print input
PATTERN = r'.*(http.*?zoom\.us\/[0-9a-z/]+)'
# re.search should return the first result found
match = re.search(PATTERN, input, re.MULTILINE)
if not match:
sys.exit(\"No Zoom events found\")
url = match.groups()[0]
print \"Opening Zoom URL %s in 3 seconds...\" % url
time.sleep(3)
subprocess.call(['/usr/bin/open', url])
"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment