-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.pyw
82 lines (59 loc) · 2.19 KB
/
main.pyw
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
import pyautogui as autogui
import json
import tkinter as tk
import os
import subprocess
import platform
class ZoomData:
def __init__(self, meetingId, abbreviation, professor, pwd):
self.meetingId = meetingId
self.pwd = pwd
self.abbreviation = abbreviation
self.professor = professor
def getZoomDataEntries():
with open(os.path.abspath('meeting-data.json')) as f:
content = json.load(f)["zoom_data"]
zoomData = []
for item in content:
zoomData.append(ZoomData(
item["meeting_id"], item["abbreviation"], item["professor"], item["password"]))
return zoomData
def createCourseTitle(course):
return course.abbreviation + " by " + course.professor
def getPlatfromCommand(x, zoomData):
switcher = {
'Windows':"%APPDATA%\Zoom\\bin\Zoom.exe --url=\"zoommtg://zoom.us/join?action=join&confno=" + zoomData.meetingId + "\"",
'Linux':"zoom --url=\"zoommtg://zoom.us/join?action=join&confno=" + zoomData.meetingId + "\"",
}
val = switcher.get(x)
if val == None:
raise Exception("Unsupported platfrom!")
return val
def joinMeeting(zoomData):
subprocess.Popen(getPlatfromCommand(platform.system(), zoomData), shell=True)
# enter passcode
enter_meeting_passcode = autogui.locateCenterOnScreen('img/enter-meeting-passcode.png', confidence=0.7)
while enter_meeting_passcode == None:
enter_meeting_passcode = autogui.locateCenterOnScreen('img/enter-meeting-passcode.png', confidence=0.7)
autogui.write(zoomData.pwd)
zoomDataEntries = getZoomDataEntries()
entries = {}
for entry in zoomDataEntries:
entries[createCourseTitle(entry)] = entry
# ui for selecting course
window = tk.Tk()
window.title('Select a meeting')
window.geometry('1000x800')
selectedVal = tk.StringVar()
def print_selection():
key = lb.get(lb.curselection())
joinMeeting(entries[key])
titles = list(entries.keys())
meetingsList = tk.StringVar()
meetingsList.set(titles)
lb = tk.Listbox(window, listvariable=meetingsList, width=80, height=25)
lb.pack()
b1 = tk.Button(window, text='Enter meeting data',
width=15, height=2, command=print_selection)
b1.pack()
window.mainloop()