Kodi Community Forum

Full Version: Hello World Service Addon?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to combine the Hello World Addon and the service tutorial and just trying to get it installed and see the log output in the kodi.log. Getting the standard 'Addon Failed to Install' Error. Below is the error from the kodi.log (I set it to debug log output prior to attempting this install run):

Quote:23:38:11 40654.023438 T:1963433984 DEBUG: CAddonInstaller: installing from zip 'smb://MYSERVER/Public/script.hello.world-master.zip'
23:38:11 40654.035156 T:1963433984 DEBUG: CSMBFile::Open - opened smb://MYSERVER/Public/script.hello.world-master.zip, fd=10001
23:38:11 40654.078125 T:1963433984 DEBUG: CSMBFile::Close closing fd 10001

Which doesn't seem to give me any information as to why it failed to install. Couldn't find anything in the kodi.log that indicated any issue with the xml or python files. I'm wondering if it has anything to do with how I'm zip-ing up the addon. The directory structure in the zip file is as follows:

script.hello.world-master
-addon.xml
-addon.py
-service.py
-reousrce directory

The code is ripped from the github copy of the hello-world addon which on its own installs fine. All I did was add the serivce python file and line to the addon.xml. Is there any special settings I need when zipping it up (compression level, etc)? Or is there something fundamentally wrong with my code? Thanks in advance for any help![/quote]

Below are the addon files:

addon.xml
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.hello.world" name="Hello World" version="1.0.0" provider-name="zag">
    <requires>
        <import addon="xbmc.python" version="2.1.0"/>
    </requires>
    <extension point="xbmc.python.script" library="addon.py">
        <provides>executable</provides>
    </extension>
    <extension point="xbmc.service" library="service.py" />
    <extension point="xbmc.addon.metadata">
        <platform>all</platform>
        <summary lang="en">Popup Hello World</summary>
        <description lang="en">Example Script to show hello world</description>
        <license>GNU General Public License, v2</license>
        <language></language>
        <forum>http://forum.kodi.tv/showthread.php?tid=209948</forum>
        <source>https://github.com/zag2me/script.hello.world</source>
        <website>Kodi.tv</website>
        <email>[email protected]</email>
        <assets>
            <icon>resources/icon.png</icon>
            <fanart>resources/fanart.jpg</fanart>
            <screenshot>resources/screenshot-01.jpg</screenshot>
        </assets>
        <news>Updated the addon to use new addon.xml metadata</news>
    </extension>
</addon>

addon.py
Code:
import xbmcaddon
import xbmcgui

addon       = xbmcaddon.Addon()
addonname   = addon.getAddonInfo('name')

line1 = "Hello World!"
line2 = "We can write anything we want here"
line3 = "Using Python"

xbmcgui.Dialog().ok(addonname, line1, line2, line3)

service.py
Code:
import time
import xbmc

if __name__ == '__main__':
    monitor = xbmc.Monitor()

    while not monitor.abortRequested():
        # Sleep/wait for abort for 10 seconds
        if monitor.waitForAbort(10):
            # Abort was requested while waiting. We should exit
            break
        xbmc.log("hello addon! %s" % time.time(), level=xbmc.LOGDEBUG)
P.S. I tried adding the start="login" line to the service registration in the android.xml file but still has the same issues.
Trying changing the zip file name, dropping the branch reference from the name; i.e. "-master".

Then drop the xbmc.python.script extension point if you arent going to use it. Kodi can handle an addon being a script and a service, but the correct order of the extension points is vital. If you want to keep both, and the script fails to run, swap the positions of the two extension points in the addon.xml file.
copy the addon to your system and install it from there.
smb installs have never worked afaik.
So it turns out it's an issue with the specific Kodi installation I was using. I had LibreElec installed on a Raspberry Pi and I don't think it has full support for python/zip functionality. To give you an idea if you ssh into the box and try to change the root password from default...you can't. The 'passwd' command isn't even there. Was able to install the plugin without issue on a Windows version of Kodi and will develop on that instead of my TV boxes until I can swap out with OpenElec or a similar build for Raspberry Pi.

Thanks for all the responses though regardless!
None of the Pi variants (OE, LE or OSMC) allow the root password to be changed. It's fixed in all of them.

All three have full support for python and zip though.