-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebinarListener.py
More file actions
29 lines (22 loc) · 792 Bytes
/
webinarListener.py
File metadata and controls
29 lines (22 loc) · 792 Bytes
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
import pyscreenshot as ImageGrab
import numpy
from PIL import Image
import sched, time
strName = "WebinarName"
numDelaySec = 5
numBorder = 0.8
numScreenShot = 0
s = sched.scheduler(time.time, time.sleep)
imScreenShot=ImageGrab.grab()
imScreenShot.save(strName+str(numScreenShot)+'.png')
def scrGrabber(sc,imScreenShot,numScreenShot):
print("Grabbing screenshot")
imScreenShotNew=ImageGrab.grab()
if (numpy.mean(numpy.array(imScreenShotNew)==numpy.array(imScreenShot))<numBorder):
print("Saving screenshot")
numScreenShot = numScreenShot + 1
imScreenShotNew.save(strName+str(numScreenShot)+'.png')
imScreenShot = imScreenShotNew
s.enter(numDelaySec, 1, scrGrabber, (sc,imScreenShot,numScreenShot))
s.enter(numDelaySec, 1, scrGrabber, (s,imScreenShot,numScreenShot))
s.run()