2021-12-19, 07:01
Hi there,
I have an annoying issue I hope someone can help with.
I wrote a small piece of code to enable and disable an addon. Works great, however when I click the back key or the escap key the box comes up for a second time.
Any idea what needs to go in after the ENABLEADDON(): because thats the only time it does it. When im calling the addon I guess.
Only happens when I call the opening of the other addon.
I have an annoying issue I hope someone can help with.
I wrote a small piece of code to enable and disable an addon. Works great, however when I click the back key or the escap key the box comes up for a second time.
Any idea what needs to go in after the ENABLEADDON(): because thats the only time it does it. When im calling the addon I guess.
Only happens when I call the opening of the other addon.
python:# -*- coding: utf-8 -*-
import xbmcvfs
import time
import xbmc
import os
import xbmc, xbmcgui, xbmcvfs
import time, datetime
def main():
choice = xbmcgui.Dialog().yesno('INSTALL', 'Would you like to enable the addon?', nolabel='NO',yeslabel='YES')
if choice == 0:
DISABLEADDON()
elif choice == 1:
ENABLEADDON()
def ENABLEADDON():
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","id":7,"params":{"addonid": "plugin.video.youtube","enabled":true}}')
xbmc.sleep(200)
xbmc.executebuiltin('Dialog.Close(busydialog)')
xbmc.executebuiltin('RunAddon(plugin.video.youtube)')
def DISABLEADDON():
xbmc.sleep(200)
xbmc.executeJSONRPC('{"jsonrpc":"2.0","method":"Addons.SetAddonEnabled","id":7,"params":{"addonid": "plugin.video.youtube","enabled":false}}')
##########################################################################################################################################
if __name__ == "__main__":
main()