import os, sys import xbmc, xbmcaddon __addon__ = xbmcaddon.Addon() __addonid__ = __addon__.getAddonInfo('id') __addonversion__ = __addon__.getAddonInfo('version') __language__ = __addon__.getLocalizedString __cwd__ = __addon__.getAddonInfo('path').decode("utf-8") __resource__ = xbmc.translatePath( os.path.join( __cwd__, 'resources', 'lib' ).encode("utf-8") ).decode("utf-8") sys.path.append(__resource__) if ( __name__ == "__main__" ): searchstring = sys.argv[1] if not searchstring: keyboard = xbmc.Keyboard( '', __language__(32101), False ) keyboard.doModal() if ( keyboard.isConfirmed() ): searchstring = keyboard.getText() if searchstring: mytitle = searchstring myversion = " [" if mytitle.find(myversion) > 0: searchstring = mytitle[:mytitle.find(myversion)] mytitle = searchstring mylive = " (Live" if mytitle.find(mylive) > 0: searchstring = mytitle[:mytitle.find(mylive)] import gui ui = gui.GUI( "script-globalsearch-main.xml", __cwd__, "Default", searchstring=searchstring ) ui.doModal() del ui sys.modules.clear()