Skip to content

Instantly share code, notes, and snippets.

@miyagawa

miyagawa/zoom.pl Secret

Last active December 10, 2020 04:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miyagawa/986e4034a09e6c822a832a4e283f331f to your computer and use it in GitHub Desktop.
Save miyagawa/986e4034a09e6c822a832a4e283f331f to your computer and use it in GitHub Desktop.
Open Zoom (or whatever video conference) URL in the current calendar event with gcalcli (https://github.com/insanum/gcalcli)
#!/usr/bin/env perl
use strict;
my $calendar = 'your-calendar@example.com';
my $regex = qr!https?://\w+\.zoom\.us/j/\d+(?:\?pwd=[\w\-_]+)?!; # change to your conference software
my $now = localtime();
my $end = localtime(time + 3600);
my $cal = `gcalcli --refresh --calendar=$calendar agenda --nodeclined "$now" "$end" --details all --tsv`;
for my $event (split /\n/, $cal) {
my @data = split /\t/, $event;
if ($event =~ /($regex)/) {
print "$data[8]\n"; # title
warn "Opening $1\n";
system "open", $1;
exit;
}
}
print "No event or Zoom URL found.\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment