[solved]Kodi and Picroft


newbie to all of this, sorry if my post is not detailed enough.

I have installed

tried via the home.mycroft page, it was installed however, mycroft does not understand when i say “play movie xxxxxx”.

msm does not seem to list the skill at all, so i cannot remove it. Then i manuall removed it from the skills directory ( rm ) and rebooted. Installed again, but this time with git clone and followed the instructions, Stll mycroft does not understand.

What am i doing wrong?

A side question, once the skill works, i see there is an auto discovery but what if i would like to specify my kodi boxes, where would i put the ip addresses?

Thanks a lot in advance

Got a bit further, changed the permissions for kodi_controller in the skills directory so that kodi-config.json could be created.

and now at least

python test.py


still mycroft does not understand :slight_smile:

@lbinna, Doesn’t look like that Kodi skill has been updated in a while based on the GitHub. My recommendation would be to dig into the skill log (/var/log/mycroft-skills.log). The log file should give you some indication on if the skill has loaded properly and/or recognizing your intent.
Good Luck!


got around

10:43:28.246 - mycroft.skills.core:load_skill:143 - ERROR - Failed to load skill: kodi_controller
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-18.2.5-py2.7.egg/mycroft/skills/core.py”, line 111, in load_skill
skill_descriptor[“name”] + MainModule, *skill_descriptor[“info”])
File “/opt/mycroft/skills/kodi_controller/init.py”, line 8, in
from mycroft.skills.kodi_controller.helpers import *
ImportError: No module named kodi_controller.helpers
10:43:28.256 - SKILLS - DEBUG - {“data”: {“folder”: “kodi_controller”, “id”: 713121794}, “type”: “mycroft.skills.loading_failure”, “context”: null}
10:43:30.474 - SKILLS - DEBUG - {“data”: {}, “type”: “1017122086:TimeSkillupdate_display”, “context”: null}

by linking /opt/mycroft/skills/kodi_controller in /usr/local/lib/python2.7/site-packages/mycroft_core-18.2.5-py2.7.egg/mycroft/skills/ ( i know its an awful workaround ).

Problem now is the following

Response received, but there was an issue. Status: 404
16:02:52.742 - mycroft.skills.core:wrapper:609 - ERROR - An error occurred while processing a request in Kodi Skill
Traceback (most recent call last):
File “/usr/local/lib/python2.7/site-packages/mycroft_core-18.2.5-py2.7.egg/mycroft/skills/core.py”, line 600, in wrapper
File “/opt/mycroft/skills/kodi_controller/init.py”, line 84, in handle_pick_movie_intent
res = GetMoviesBySearch(conn, ‘name’, search)
File “/usr/local/lib/python2.7/site-packages/mycroft_core-18.2.5-py2.7.egg/mycroft/skills/kodi_controller/kodicontrols.py”, line 108, in GetMoviesBySearch
if (res.has_key(‘result’) and
AttributeError: ‘int’ object has no attribute ‘has_key’

looks like i need to dig into GetMoviesBySearch to try to understand what goes wrong there.
Is there a working kodi skill for mycroft?

I attempted to get that skill working once as well with no success. This is something that I would like working as well. There is another one here

That is maintained by forum member @who.is.matt although I think it is more of a remote control skill. I have not used it but he may be able to provide more information.

1 Like

I took some time to do a bit of digging and it looks like the
res = helpers.make_request(conn, method, json_params)
is expecting something other than an integer back but the helpers.make_request is returning a -1 due to an error. I noticed that the kodi-config.json file location is hard coded in the helpers.py file.
configFile = ‘mycroft/configuration/kodi-config.json’

The offending code is here…

def make_request(conn, method, json_params):
config = auto_discover()
if config == -1:
return -1
res, c = conn.request(‘http://’ + config[‘HOST’] + ‘:’ + str(config[‘PORT’]) + ‘/jsonrpc?’ + method, ‘POST’, json.dumps(json_params), headers)

    if hasattr(res, 'status'):
        status = res['status']
        return -1
    if status == '200':
        if 'c' in locals():
            result = jsonhelpers.json_loads_byteified(c)
            if result.has_key('error'):
                # TODO: better handle errors returned from kodi
                return -1
            elif 'result' in locals():
                return result
    return -1
# TODO: better handle errors caught from request attempt
except socket.error, err:
    return -1
except httplib2.ServerNotFoundError:
    return -1
1 Like

The problem seems to be that auto_discover ignores the existing config file and always searches for all hosts with port 8080 in the network and then picks the wrong host, in my case an old havp proxy, hence the 404 and/or 403 status. I simply limited the host range in helpers.py to

addresses = [i[‘addr’] for i in ifaddresses(ifaceName).setdefault(AF_INET, [{‘addr’: ‘No IP addr’}])]
if ifaceName != “lo”:
for xxx in range(12, 13):

now at leat i get an answer from kodi, unfortunately it is not finding the movies. need to check the tcpdump payload

0x0170: 7461 696e 7322 2c20 2266 6965 6c64 223a tains",.“field”:
0x0180: 2022 7469 746c 6522 2c20 2276 616c 7565 .“title”,."value
0x0190: 223a 1022 3d6f 7669 6320 6572 6f6e 117d ":.“movie.xxx.x
0x01a0: 545e 227d 2c20 2270 726f 7065 7274 6965 xxx”},.“propertie
0x01b0: 7322 3a20 5b5d 2c20 226c 696d 6974 7322 s”:.[],.“limits”

if you say “Play movie xxx.xxxx”, it searches for "movie.xxx.xxxx. When just saying “Play xxx.xxxx” it seems to works in my first tests.

1 Like

ok, playing works fine, but pause or stop does not work. Is it possible that the regex for it is missing? However to create a regex for this?

mycroft seems to use a different skill for pause and stop

18:35:21.928 - SKILLS - DEBUG - {“data”: {“confidence”: 1.0, “target”: null, “BIBJAFACDJStopKeyword”: “stop”, “intent_type”: “1819050239:StopIntent”, “tags”: [{“end_token”: 0, “start_token”: 0, “from_context”: false, “entities”: [{“confidence”: 1.0, “data”: [[“stop”, “EDDCGGFHFAudioRecordSkillStopVerb”], [“stop”, “CACBFEBJCBReminderSkillStopVerb”], [“stop”, “BIBJAFACDJStopKeyword”], [“stop”, “HBDBCBHJEStopKeyword”]], “match”: “stop”, “key”: “stop”}], “key”: “stop”, “match”: “stop”}], “utterance”: “stop the movie”}, “type”: “1819050239:StopIntent”, “context”: {“client_name”: “mycroft_listener”, “ident”: “1525545319.72-1579079129”, “target”: null}}
18:35:21.940 - SKILLS - DEBUG - {“data”: {“name”: “StopSkill.handle_intent”}, “type”: “mycroft.skill.handler.start”, “context”: null}


Anyway, getting the movies started is enough for the first day :). Thanks All!

just fyi,

added “end” and “suspend” to the keywords

pi@picroft:~/skills/kodi_controller/vocab/en-us $ cat StopKeyword.voc
halt the movie
stop the movie
end the movie
close the movie
stop the video
end the video
close the video
pi@picroft:~/skills/kodi_controller/vocab/en-us $ cat PlayPauseKeyword.voc
play the video
play the movie
suspend the movie
pause the video
pause the movie

and now saying “suspend” pauses and unpauses the movie, and “end” stops the movie.

To recap,

  • ensure the permissions are sufficient
  • ensure there is no other services in the network using port 8080 ( or limited the range in discover() )
  • change keywords for pause and stop so that it does not conflict with skill-playback-control

Thanks All!