forked from BigchillRK/Zoom-Meeting-and-Recording
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathautozoom.py
113 lines (96 loc) · 7.68 KB
/
autozoom.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
"""The entry point for autozoom.py, handles argument parsing"""
import argparse
import logging
import connecting
import scheduling
def join(args):
logging.debug('Running JOIN')
"""Runs the 'join' command given args"""
connecting.connect(args.id, args.password, args.audio, args.video, args.name, args.fixdropdown, args.keytimeout, args.starttimeout, args.jointimeout, args.passtimeout, args.cronlauncher, args.anonymous)
print('Exiting')
def schedule(args):
"""Runs the 'schedule' command given args"""
if args.cron:
logging.debug('Running CRONSCHEDULE')
scheduling.cron_schedule(args.schedulename, args.cron, args.id, args.password, args.audio, args.video, args.record, args.name, args.keytimeout, args.starttimeout, args.jointimeout, args.passtimeout, args.anonymous)
else:
logging.debug('Running DATETIMESCHEDULE')
split = args.datetime.split(' ')
days = split[0]
time = ' '.join(split[1:])
scheduling.day_time_schedule(args.schedulename, days, time, args.id, args.password, args.audio, args.video, args.record, args.name, args.keytimeout, args.starttimeout, args.jointimeout, args.passtimeout, args.anonymous)
def unschedule(args):
"""Runs the 'unschedule' command given args"""
logging.debug('Running UNSCHEDULE')
scheduling.cron_unschedule(args.schedulename)
def listschedule(args):
"""Runs the 'list' command given args"""
logging.debug('Running LIST')
scheduling.list_schedule()
PARSER = argparse.ArgumentParser(description='Join or schedule Zoom calls from the command line')
COMMAND_PARSERS = PARSER.add_subparsers(title='Commands', description='Subcommands', help='Either join, schedule, list, or unschedule')
JOIN_PARSER = COMMAND_PARSERS.add_parser('join', help='Join a Zoom meeting')
JOIN_PARSER.add_argument("id", help="The id of the meeting to join", type=str)
JOIN_PARSER.add_argument("-f", "--fixdropdown", help="Use one less tab when joining. See Meeting ID Dropdown for more info", default=False)
JOIN_PARSER.add_argument("-a", "--audio", help="Whether or not to turn on your audio input. Default is false.", action="store_true", default=False)
JOIN_PARSER.add_argument("-V", "--video", help="Whether or not to turn on your video input. Default is false.", action="store_true", default=False)
JOIN_PARSER.add_argument("-v", "--verbose", help="Enable verbose logging. WIP", action="store_true")
JOIN_PARSER.add_argument("-n", "--name", help="The name to display to others.", type=str, default='')
JOIN_PARSER.add_argument("-p", "--password", help="The password of the meeting to join", type=str, default='')
JOIN_PARSER.add_argument("-r", "--record", help="Whether or not to record the call. Default is false. WIP", action="store_true", default=False)
JOIN_PARSER.add_argument("-kto", "--keytimeout", help="Amount of time to wait between pressing button/keys.", type=int, default=2)
JOIN_PARSER.add_argument("-sto", "--starttimeout", help="Amount of time to wait for Zoom to start. Increase if running on a slow PC.", type=int, default=20)
JOIN_PARSER.add_argument("-jto", "--jointimeout", help="Amount of time to wait after pressing 'Join' button. Increase if slow internet connection.", type=int, default=20)
JOIN_PARSER.add_argument("-pto", "--passtimeout", help="Amount of time to wait after connection to enter password. Increase if slow internet connection.", type=int, default=20)
JOIN_PARSER.add_argument("-cl", "--cronlauncher", help="Only set if launched from cronLauncher.sh, don't use yourself", type=bool, default=False)
JOIN_PARSER.add_argument("-A", "--anonymous", help="Join meetings when not logged into Zoom account", action='store_true')
JOIN_PARSER.set_defaults(func=join)
SCHEDULE_PARSER = COMMAND_PARSERS.add_parser('schedule', help='Schedule Zoom meetings')
SCHEDULE_PARSER.add_argument('schedulename', help='The name of the schedule to add, i.e. HIS101')
SCHEDULE_PARSER.add_argument("id", help="The id of the meeting to join", type=str)
SCHEDULE_PARSER.add_argument("-f", "--fixdropdown", help="Use one less tab when joining. See Meeting ID Dropdown for more info", default=False)
SCHEDULE_PARSER.add_argument("-a", "--audio", help="Whether or not to turn on your audio input. Default is false.", action="store_true", default=False)
SCHEDULE_PARSER.add_argument("-V", "--video", help="Whether or not to turn on your video input. Default is false.", action="store_true", default=False)
SCHEDULE_PARSER.add_argument("-v", "--verbose", help="Enable verbose logging. WIP", action="store_true")
SCHEDULE_PARSER.add_argument("-n", "--name", help="The name to display to others.", type=str, default='')
SCHEDULE_PARSER.add_argument("-p", "--password", help="The password of the meeting to join", type=str, default='')
SCHEDULE_PARSER.add_argument("-r", "--record", help="Whether or not to record the call. Default is false. WIP", action="store_true", default=False)
SCHEDULE_PARSER.add_argument("-kto", "--keytimeout", help="Amount of time to wait between pressing button/keys.", type=int, default=2)
SCHEDULE_PARSER.add_argument("-sto", "--starttimeout", help="Amount of time to wait for Zoom to start. Increase if running on a slow PC.", type=int, default=20)
SCHEDULE_PARSER.add_argument("-jto", "--jointimeout", help="Amount of time to wait after pressing 'Join' button. Increase if slow internet connection.", type=int, default=20)
SCHEDULE_PARSER.add_argument("-pto", "--passtimeout", help="Amount of time to wait after connection to enter password. Increase if slow internet connection.", type=int, default=20)
SCHEDULE_PARSER.add_argument("-A", "--anonymous", help="Join meetings when not logged into Zoom account", action='store_true')
TIME_GROUP = SCHEDULE_PARSER.add_mutually_exclusive_group(required=True)
TIME_GROUP.add_argument("-c", "--cron", help="Custom CRON schedule. (* * * * *). Only use if you know what you're doing. Linux only", type=str)
TIME_GROUP.add_argument("-dt", "--datetime", help="Days of the week (umtwrfs) and the time (24 hour or am/pm). ex. Class at 10:45am on Monday, Wednesday, and Friday (-dt 'mwf 10:45am')")
SCHEDULE_PARSER.set_defaults(func=schedule)
UNSCHEDULE_PARSER = COMMAND_PARSERS.add_parser('unschedule', help='Unschedule Zoom meetings based on the schedulename')
UNSCHEDULE_PARSER.add_argument('schedulename', help='The name of the schedule to remove. Use \'all\' to remove all schedules., i.e. HIS101')
UNSCHEDULE_PARSER.set_defaults(func=unschedule)
LIST_PARSER = COMMAND_PARSERS.add_parser('list', help='List all scheduled Zoom meetings')
LIST_PARSER.set_defaults(func=listschedule)
ROOT_ARGS = PARSER.parse_args()
logging.basicConfig(filename='autozoom.log', level=logging.DEBUG)
try:
ROOT_ARGS.func(ROOT_ARGS)
except Exception as e:
logging.error(e)
logging.error('Please provide a command {join, schedule, unschedule, list}')
exit(1)
#
#action = args.action
#
#if action == 'join':
# connecting.connect(args.id, args.password, args.audio, args.video, args.name)
#
#elif action == 'schedule':
# if args.cron:
# scheduling.cronSchedule(args.schedulename, args.cron, args.id, args.password, args.audio, args.video, args.record, args.name)
# else:
# scheduling.dayTimeSchedule(args.schedulename, args.days, args.time, args.id, args.password, args.audio, args.video, args.record, args.name)
#
#elif action == 'list':
# scheduling.listSchedule()
#
#elif action == 'unschedule':
# scheduling.cronUnschedule(args.schedulename)