Scripts in Keymaps.xml not running on Amazon Fire TV
#1
I want to increase the user rating by pressing a button on my Fire TV remote when a movie is selected in the movie list of Kodi library.

I created a keymap.xml

keymap.xml:
<keymap>
<global>
<keyboard>
<key id="61589">runscript(special://masterprofile/scripts/increase_rating.py)</key>
</keyboard>
</global>
</keymap>

and a script increase_rating.py

increase_rating.py:
import xbmc

xbmc.executebuiltin("Action(Info)")
xbmc.executebuiltin("Action(IncreaseRating)")
xbmc.executebuiltin("Action(Info)")

When I test this on my Windows PC it works as expected. When a movie is selected in the movie list Kodi shortly switches to the Info window, increases the user rating by 1 and then goes back to the movie list.

However, when I test this on my Fire TV Cube nothing happens. When I replace the "runscript(special://masterprofile/scripts/increase_rating.py)" in the xml file with the Kodi action "IncreaseRating" and manually switch to the info window the user rating is correctly increased by 1 when pressing the remote button. So it seems that running the script from the xml file does not work.

I read in older postings that Android does not allow to run executables from sdcard but do not know if this is the problem and if yes how I can overcome this restriction.

Any help would be very much appreciated.
Reply
#2
No idea from anybody how this could be fixed?  Sad
Reply
#3
(2024-02-26, 00:24)dipvideo Wrote: No idea from anybody how this could be fixed?

i don't see enough information in order to help you
you went in length of explaining what you are "trying" to do but do not state what it "actually" does

does kodi see the button press? does kodi attempt to do anything? is that key number even correct for firetv or does it only work on windows? are these 2 different versions of kodi?

honestly more questions than answers

try creating a Debug Log and see if the keypress is even registering in the log
if you're not sure where to locate that information then share the log here via https://paste.kodi.tv but ensure it shows an attempt to press the button/run the script
Reply
#4
Many thanks for your answer.

The button press is correctly recognized by Kodi and the key number is correct. To prove this I have replaced the "runscript" command in the xml file with a direct call of the Kodi action "IncreaseRating". When I then enter manually the info window of a movie and press the defined button the user rating is correctly increased by one. This means the button press is recognized and the Kodi action "IncreaseRating" is correcly executed on my Fire TV.

Only when I try to run a script (by runscript(special://masterprofile/scripts/increase_rating.py) instead of directly calling a Kodi action nothing happens.

And the runscript command as well as the py script should be okay since they work on my Windows system. Only on the Fire TV it seems that the script does not work.

I hope this answers some of your questions.
I will also try to create a debug log.
Reply
#5
(2024-02-26, 01:08)dipvideo Wrote: I will also try to create a debug log.

from there my only thought was to look up the location of master profile https://kodi.wiki/view/Special_protocol
if you are using special://masterprofile/scripts/increase_rating.py in kodi you should have your py script in /sdcard/Android/data/org.xbmc.kodi/files/.kodi/userdata/scripts/ in the filesystem, is that where it is?

otherwise if there's an error generated when it tries to run the script it will show in the log
Reply
#6
Yes, the py script is in /sdcard/Android/data/org.xbmc.kodi/files/.kodi/userdata/scripts/

In order to create a debug log I have now reintroduced the "runscript" command in my xml file (that means I have replaced the direct call of the Kodi action "IncreaseRating" with "runscript(special://masterprofile/scripts/increase_rating.py)"). And suddenly the script works as expected! I have no idea why it was not working before.

I tried hours using different commands and nothing worked but now it works as is shold have done from the beginning.

There must have been an error on my side which I never realized.

Anyway, the script works now and I really thank you for your support which pushed me to try again and finally brought the solution.
Reply
#7
glad to hear, you're welcome
Reply

Logout Mark Read Team Forum Stats Members Help
Scripts in Keymaps.xml not running on Amazon Fire TV0