Repository navigation
Expand file tree
/
Copy pathconfigwizard.py
More file actions
139 lines (124 loc) · 4.91 KB
/
Copy pathconfigwizard.py
File metadata and controls
139 lines (124 loc) · 4.91 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Config Wizard By: Blazetamer 2013-2016
import downloader
import extract
import os
import re
import sys
import urllib
import urllib2
import xbmc
import xbmcgui
import xbmcplugin
from libs import addon_able
from libs import kodi
AddonTitle = kodi.addon.getAddonInfo('name')
SiteDomain = 'TVADDONS.CO'
wizlink = "http://indigo.tvaddons.co/wizard/updates.txt"
cutslink = "http://indigo.tvaddons.co/wizard/shortcuts.txt"
# ========================== Help WIZARD ===============================================================================
def HELPCATEGORIES():
filetype = 'main'
link = OPEN_URL(wizlink).replace('\n', '').replace('\r', '').replace('\a', '').strip()
HELPWIZARD('configwiz', link, '', 'main', )
# # ### ##
def HELPWIZARD(name, url, description, filetype):
path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
confirm = xbmcgui.Dialog().yesno("Please Confirm",
" Please confirm that you wish to automatically",
" configure Kodi with all the best addons and tweaks!",
" ", "Cancel", "Install")
filetype = filetype.lower()
if confirm:
path = xbmc.translatePath(os.path.join('special://home', 'addons', 'packages'))
dp = xbmcgui.DialogProgress()
dp.create(AddonTitle, " ", 'Downloading and Configuring ', 'Please Wait')
lib = os.path.join(path, name + '.zip')
try:
os.remove(lib)
except:
pass
# ## ## ... ##
# kodi.log(url)
if str(url).endswith('[error]'):
print url
dialog = xbmcgui.Dialog()
dialog.ok("Error!", url)
return
if '[error]' in url:
print url
dialog = xbmcgui.Dialog()
dialog.ok("Error!", url)
return
downloader.download(url, lib, dp)
if not os.path.exists(lib):
return
if filetype == 'main':
addonfolder = xbmc.translatePath('special://home')
elif filetype == 'addon':
addonfolder = xbmc.translatePath(os.path.join('special://home', 'addons'))
else:
print {'filetype': filetype}
dialog = xbmcgui.Dialog()
dialog.ok("Error!", 'filetype: "%s"' % str(filetype))
return
xbmc.sleep(4000)
extract.all(lib, addonfolder, dp)
xbmc.executebuiltin("XBMC.UpdateLocalAddons()")
addon_able.setall_enable()
try:
addon_able.set_enabled("inputstream.adaptive")
except:
pass
xbmc.sleep(4000)
try:
addon_able.set_enabled("inputstream.rtmp")
except:
pass
try:
os.remove(lib)
except:
pass
if filetype == 'main':
link = OPEN_URL(cutslink)
shorts = re.compile('shortcut="(.+?)"').findall(link)
for shortname in shorts:
xEB('Skin.SetString(%s)' % shortname)
enableBG16 = "UseCustomBackground,true"
enableBG17 = "use_custom_bg,true"
xEB('Skin.SetBool(%s)' % enableBG16)
xEB('Skin.SetBool(%s)' % enableBG17)
xbmc.sleep(4000)
xbmc.executebuiltin('XBMC_UpdateLocalAddons()')
addon_able.setall_enable()
try:
addon_able.set_enabled("inputstream.adaptive")
except:
pass
xbmc.sleep(4000)
try:
addon_able.set_enabled("inputstream.rtmp")
except:
pass
kodi.set_setting("wizardran", 'true')
dialog = xbmcgui.Dialog()
dialog.ok(AddonTitle, "Installation Complete!", "", "Click OK to exit Kodi and then restart to complete .")
xbmc.executebuiltin('ShutDown')
def addHELPDir(name, url, mode, iconimage, fanart, description, filetype):
u = sys.argv[0] + "?url=" + urllib.quote_plus(url) + "&mode=" + str(mode) + "&name=" + urllib.quote_plus(
name) + "&iconimage=" + urllib.quote_plus(iconimage) + "&fanart=" + urllib.quote_plus(
fanart) + "&description=" + urllib.quote_plus(description) + "&filetype=" + urllib.quote_plus(filetype)
ok = True
liz = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=iconimage)
liz.setInfo(type="Video", infoLabels={"title": name, "Plot": description})
liz.setProperty("Fanart_Image", fanart)
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=liz, isFolder=False)
return ok
def OPEN_URL(url):
req = urllib2.Request(url)
req.add_header('User-Agent',
'Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; AFTB Build/JDQ39) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30')
response = urllib2.urlopen(req)
link = response.read()
response.close()
return link
def xEB(t): xbmc.executebuiltin(t)