-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script.autoruns 1.0.1 (original version from fightnight)
- Loading branch information
0 parents
commit 9f21ced
Showing
7 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<addon id="script.autoruns" | ||
name="Autoruns" | ||
version="1.0.1" | ||
provider-name="fightnight"> | ||
<requires> | ||
<import addon="xbmc.python" version="2.1.0"/> | ||
</requires> | ||
<extension point="xbmc.python.pluginsource" library="default.py"> | ||
<provides>executable</provides> | ||
</extension> | ||
<extension point="xbmc.addon.metadata"> | ||
<platform>all</platform> | ||
<forum>http://forum.kodi.tv/showthread.php?tid=223015</forum> | ||
<source>https://github.com/fightnight/fightnight-addons/tree/master/script.autoruns</source> | ||
<summary lang="en">Disable startup services on Kodi</summary> | ||
<summary lang="pt">Desactive serviços do arranque no Kodi</summary> | ||
<description lang="en">You can disable startup services, improving Kodi internal speed.</description> | ||
<description lang="pt">Pode desactivar serviços do arranque, melhorando a velocidade interna do Kodi.</description> | ||
<disclaimer lang="en">Opensource addon not endorsed with Team Kodi.</disclaimer> | ||
<disclaimer lang="pt">Addon opensource não afliado com a Equipa Kodi.</disclaimer> | ||
</extension> | ||
</addon> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[B]v1.0.1 (31 March 2015):[/B] | ||
- Little tweaks. | ||
- Submittion to Kodi official Kodi repository. | ||
- Cosmetic changes. | ||
|
||
[B]v1.0.0 (28 de Marco de 2015):[/B] | ||
- Limpeza de codigo. | ||
- Novo addon_id. | ||
- Outras correccoes. | ||
|
||
[B]v0.1.00 (13 de Novembro de 2014):[/B] | ||
- Melhorias de performance. | ||
- Adicionado logotipo do addon a cada pasta. | ||
- Outras correccoes. | ||
|
||
[B]v0.0.02 (21 de Dezembro de 2013):[/B] | ||
- Logotipo adicionado. | ||
|
||
[B]v0.0.01 (5 de Dezembro de 2013):[/B] | ||
- Release inicial. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
""" Autoruns | ||
2015 fightnight""" | ||
|
||
import xbmc,xbmcaddon,xbmcgui,xbmcplugin,urllib,os,re,sys | ||
|
||
def list_addons(): | ||
#info directory | ||
addDir('[COLOR blue][B]%s[/B][/COLOR]' % (translate(30001)),'None',None,os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'icon.png')) | ||
|
||
#get the path of addons | ||
pathofaddons = xbmc.translatePath('special://home/addons').decode('utf-8') | ||
|
||
#list with addons | ||
listofaddons = os.listdir(pathofaddons) | ||
for individual_addon in listofaddons: | ||
#path to individual addon, cycle for all the addons | ||
path_to_addon = os.path.join(pathofaddons, individual_addon) | ||
|
||
#define addon.xml path | ||
addon_xml_path=os.path.join(path_to_addon,'addon.xml') | ||
|
||
#check the existence of addon.xml, if true, we continue | ||
if os.path.exists(addon_xml_path): | ||
|
||
#get addon.xml content | ||
xml_content=openfile(addon_xml_path) | ||
|
||
if re.search('point="xbmc.service"',xml_content): | ||
#addon with service on | ||
addDir('%s (on)' % (individual_addon),path_to_addon,1,os.path.join(path_to_addon,'icon.png')) | ||
elif re.search('point="xbmc.pass"',xml_content): | ||
#addon with service off | ||
addDir('[B][COLOR gold]%s[/B] (off)[/COLOR]' % (individual_addon),path_to_addon,1,os.path.join(path_to_addon,'icon.png')) | ||
else: | ||
#addon with no service | ||
pass | ||
|
||
def change_state(name,path): | ||
#define addon.xml path to change | ||
addon_xml_path=os.path.join(path,'addon.xml') | ||
|
||
#get addon.xml content | ||
content=openfile(addon_xml_path) | ||
|
||
if re.search('COLOR gold',name): | ||
#service off to on, so we change from fake variable to service variable | ||
content=content.replace('point="xbmc.pass"','point="xbmc.service"') | ||
else: | ||
#service on to off, so we change from service variable to fake variable | ||
content=content.replace('point="xbmc.service"','point="xbmc.pass"') | ||
|
||
#change state on addon.xml | ||
savefile(addon_xml_path,content) | ||
|
||
#refresh the list | ||
xbmc.executebuiltin("Container.Refresh") | ||
|
||
|
||
def openfile(path_to_the_file): | ||
try: | ||
fh = open(path_to_the_file, 'rb') | ||
contents=fh.read() | ||
fh.close() | ||
return contents | ||
except: | ||
print "Wont open: %s" % filename | ||
return None | ||
|
||
def savefile(path_to_the_file,content): | ||
try: | ||
fh = open(path_to_the_file, 'wb') | ||
fh.write(content) | ||
fh.close() | ||
except: print "Wont save: %s" % filename | ||
|
||
def addDir(name,path,mode,iconimage): | ||
return xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="%s?path=%s&mode=%s&name=%s" % (sys.argv[0],urllib.quote_plus(path),mode,urllib.quote_plus(name)),listitem=xbmcgui.ListItem(name,iconImage="DefaultFolder.png", thumbnailImage=iconimage),isFolder=False) | ||
|
||
def get_params(): | ||
param=[] | ||
paramstring=sys.argv[2] | ||
if len(paramstring)>=2: | ||
params=sys.argv[2] | ||
cleanedparams=params.replace('?','') | ||
if (params[len(params)-1]=='/'): | ||
params=params[0:len(params)-2] | ||
pairsofparams=cleanedparams.split('&') | ||
param={} | ||
for i in range(len(pairsofparams)): | ||
splitparams={} | ||
splitparams=pairsofparams[i].split('=') | ||
if (len(splitparams))==2: | ||
param[splitparams[0]]=splitparams[1] | ||
return param | ||
|
||
def translate(text): | ||
return xbmcaddon.Addon().getLocalizedString(text).encode('utf-8') | ||
|
||
params=get_params() | ||
path=None | ||
name=None | ||
mode=None | ||
|
||
try: path=urllib.unquote_plus(params["path"]) | ||
except: pass | ||
try: name=urllib.unquote_plus(params["name"]) | ||
except: pass | ||
try: mode=int(params["mode"]) | ||
except: pass | ||
|
||
if mode==None: list_addons() | ||
elif mode==1: change_state(name,path) | ||
|
||
xbmcplugin.endOfDirectory(int(sys.argv[1])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<strings> | ||
<string id="30000">Autoruns</string> | ||
<string id="30001">You can disable services from Kodi startup</string> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<strings> | ||
<string id="30000">Autoruns</string> | ||
<string id="30001">Pode desactivar serviços do arranque do Kodi</string> | ||
</strings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<strings> | ||
<string id="30000">Autoruns</string> | ||
<string id="30001">Pode desactivar serviços do arranque do Kodi</string> | ||
</strings> |