-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddon.py
69 lines (61 loc) · 1.95 KB
/
addon.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
import os
import xbmcaddon
import xbmcgui
import subprocess
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
addonpath = addon.getAddonInfo('path').decode("utf-8")
dialog = xbmcgui.Dialog()
ffile = addonpath+"/getedid"
info = "This script will dump the EDID information to simulate a monitor"
info2 = "Select 'Continue' if you want to use it or 'Cancel' to exit"
def intro():
intro = dialog.yesno(addonname, info, info2, "", "Cancel", "Continue")
if intro == True:
selectionWindow()
else:
quit()
def selectionWindow():
choice = dialog.select(addonname, ['create (will create the EDID dump)',
'delete (will delete an existing EDID dump)',
'gpu (will show the GPU in use)',
'help (will show a help-message)'])
choice=str(choice)
if choice == "0":
command(ffile, "create")
elif choice == "1":
command(ffile, "delete")
elif choice == "2":
command(ffile, "gpu")
elif choice == "3":
hhelp()
else:
quit()
def command(comm, arg):
output = subprocess.Popen([(ffile), (arg)], stdout=subprocess.PIPE).communicate()[0]
output=str(output)
if output == "nvidia":
l = dialog.yesno(addonname, "You are using a supported GPU (NVidia)", "Continue?")
if l == True:
selectionWindow()
else:
quit()
if output == "intel":
l = dialog.yesno(addonname, "You are using a supported GPU (Intel)", "Continue?")
if l == True:
selectionWindow()
else:
quit()
if output == "nvidia success":
dialog.ok(addonname, "The script ran successfully", "You don't need to reboot the machine")
quit()
if output == "intel success":
dialog.ok(addonname, "The script ran successfully", "The machine will reboot after you hit 'OK'")
os.system("reboot")
else:
dialog.ok(addonname, "Error", output)
quit()
def hhelp():
dialog.ok(addonname, "'create' will create the EDID dump", "'delete' will revert the changes being done by that script", "'gpu' will show which GPU is in use and if it's supported")
selectionWindow()
intro()