2015-12-30, 14:22
(2015-12-30, 12:41)leonardder Wrote: Have created a service.xbmc.tts.pre addon which succesfully loads when in /usr/share/kodi/addons. Also tried putting service.xbmc.tts in /usr/share/kodi/addons, but observed the following. It seems that the addon sounds don't play and the keymap doesn't load correctly. Now, util.py contains:
def playSound(name,return_duration=False):
wavPath = os.path.join(xbmc.translatePath('special://home'),'addons','service.xbmc.tts','resources','wavs','{0}.wav'.format(name))
#wavPath = os.path.join(xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('path')).decode('utf-8'),'resources','wavs','{0}.wav'.format(name))
xbmc.playSFX(wavPath)
I wonder whether the second wavPath is commented out? This way, playing of sounds is hard coded to the addon in the home directory, which shouldn't be the case I think.
I don't remember precisely why at the moment, but for whatever reason this method can be called when the add-on is disabled, which is why the commented out method doesn't work. I should probably have a comment here explaining this. To make this work when the add-on is pre-installed, I'll probably need to verify the path exists and if not check with the system add-ons because unfortunately (iirc) getAddonInfo() doesn't work unless the add-on is enabled.