aboutsummaryrefslogtreecommitdiff
path: root/scripts/.local/bin/personal/external/helpdesk
blob: 1a7f03c8b6926e55e52bf6c463cff2dcde2f25e6 (plain)
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
#!/usr/bin/env python

# Made for GNU/Linux
# License: MIT

import sys
import signal
import subprocess

from datetime import datetime

fps = 10
res = "2880x1800"
name = "Analysis 2 Helpdesk"
date = datetime.today().strftime('%a_%d.%m._')
link = "https://uni-luebeck.webex.com/meet/peter.haubold"
file = f"{date}{name.replace(' ', '_')}.mkv"

web_cmd = f"/usr/bin/brave --app='{link}'"
rec_cmd = f"ffmpeg -y -video_size {res} -framerate {fps} -f x11grab -i :0.0 -f pulse -ac 2 -i default {file}"


def log(str, lines=1):
    for i in range(1, lines):
        print("")
    print(str)


def end():
    global rec, cisco

    rec.send_signal(signal.SIGINT)
    cisco.send_signal(signal.SIGTERM)
    subprocess.call("killall CiscoCollabHost", shell=True)
    subprocess.call(f"rm -rf /home/{os.getlogin()}/Downloads", shell=True)


def handler(sig, frame):
    log("> Interrupt signal recieved.", 2)
    end()

    sys.exit(0)


def main():
    global web, rec, cisco

    log(f"> Joining: {name} @ {link} ...", 2)
    log("> Session recording starting ...\n", 0)

    cisco = subprocess.Popen("webex", shell=True)

    web = subprocess.Popen(web_cmd, shell=True)
    rec = subprocess.Popen(rec_cmd, shell=True)

    signal.signal(signal.SIGINT, handler)
    web.wait()
    end()

    log(f"> Finished recording session for '{file}'. Finalization may fart.", 3)


if __name__ == "__main__":
    main()