Vero V remote remapping not working with PY script

Hi Amazing community

I’m gonna try to write this a little slower and provide good context

Summary/Context:
I am a avid skydiver and am trying to help out my local Skydive Dropzone by setting up a way for users easily play back the videos from their Go Pro’s and Action Camera’s I’m hoping to use OSMC to do this.
As part of this we are also hoping to allow skydivers to copy data from their microSD cards to a Local network Storage Server or NAS which is setup as a Samba Share.

Current Setup:
The current setup we have is that we use autofs (which i got working with the help of this awesome community) to automatically mount the NAS as an SMB share to the /mnt directory I have also created and tested python script called (download.py) this python script when run using the
python download.py
Command would scan removable media such as microSD cards and compare the names and sizes of the first 3 files on the microSD to the contents of the NAS and if their is no match it will copy them over.

Ideally Setup:
Ideally we would like to have it so when browsing the videos section or while playing a video if you long press the “i” button the the Vero V remote it will run the “download.py” script and download the videos to the NAS for future generations.

Problem:
The problem I’m running into is that I cannot figure out how to get my script to run off of a button press I have followed this document OSMC Remote - Long Press Keymap Guide - General - OSMC and i am able to get long presses work when mapping a default keypress say “up” to the “i” button using the below keygen which works great and putting it in the .kodi/userdata/keymaps/osmc folder
<keymap><global><keyboard><key id="61480"mod="longpress">up</key></keyboard></global></keymap>
But i cannot get the RunScript keypress when using this gen.xml file in place of the above one
<keymap><global><key id='\"61480\"' mod='\"longpress\"'>RunScript(/home/osmc/scripts/download.py)></key></global></keymap>

Things i have tried:

  • I have enabled every form of logging i can find and i can see when keypresses happen and what they register as when using tail -f ~/kodi/temp/kodi.log

  • i have added logging to my python script so every time it is run it makes an entry in a file with the time and date stamp.

  • I have tried to get the runscript key press to work with both a long and short press and cannot get it to work with either

Please let me know if/what i am doing is even possible or if i should be pursuing a different method entirely

Hi Bryan,

Should be possible to do what you are trying to achieve.

What are the outputs of these three attempts?

Does the script attempt to fire at all?

Cheers

Sam

Hello.
From what i can see the script does not run at all.
When i do a long press on the “i” key with this
<keymap><global><key id="61480" mod="longpress">RunScript(/home/osmc/scripts/download.py)</key></global></keymap> keymapping in the .kodi/userdata/keymaps/osmc/gen.xml location the ~/.kodi/temp/kodi.log file reads the following

PLEASE NOTE i short and long pressed in this file

osmc@SkydiveDanielsonOSMC:~$ tail -f ~/.kodi/temp/kodi.log
2025-05-25 20:48:28.756 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:48:28.756 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:48:28.805 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:48:28.805 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:48:28.876 T:3063    debug <general>: Thread Timer 3673116976 terminating
2025-05-25 20:48:28.880 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:48:28.880 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:48:28.880 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:48:58.881 T:3058    debug <general>: Thread JobWorker 3902288176 terminating (autodelete)
2025-05-25 20:51:28.929 T:2823    debug <general>: ------ Window Init () ------
2025-05-25 20:51:36.196 T:2933    debug <general>: CLibInputKeyboard::ProcessKey - using delay: 750ms repeat: 80ms
2025-05-25 20:51:36.196 T:3066    debug <general>: Thread Timer start, auto delete: false
2025-05-25 20:51:36.230 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:36.231 T:2823    debug <general>: HandleKey: leftbracket (0xf028) pressed, screen saver/dpms woken up
2025-05-25 20:51:36.292 T:3066    debug <general>: Thread Timer 3673116976 terminating
2025-05-25 20:51:36.307 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:37.234 T:2823    debug <general>: ------ Window Deinit () ------
2025-05-25 20:51:37.332 T:2933    debug <general>: CLibInputKeyboard::ProcessKey - using delay: 750ms repeat: 80ms
2025-05-25 20:51:37.332 T:3067    debug <general>: Thread Timer start, auto delete: false
2025-05-25 20:51:37.348 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:37.348 T:2823    debug <general>: HandleKey: leftbracket (0xf028) pressed, window 10000, action is info
2025-05-25 20:51:37.349 T:3068    debug <general>: Thread JobWorker start, auto delete: true
2025-05-25 20:51:37.357 T:3068    debug <general>: [threads] name: 'JobWorker' priority: '3'
2025-05-25 20:51:37.452 T:3067    debug <general>: Thread Timer 3673116976 terminating
2025-05-25 20:51:37.494 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:38.572 T:2933    debug <general>: CLibInputKeyboard::ProcessKey - using delay: 750ms repeat: 80ms
2025-05-25 20:51:38.572 T:3069    debug <general>: Thread Timer start, auto delete: false
2025-05-25 20:51:38.602 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:38.602 T:2823    debug <general>: HandleKey: leftbracket (0xf028) pressed, window 10000, action is info
2025-05-25 20:51:39.330 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.330 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.428 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.428 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.525 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.526 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.575 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.575 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.684 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.684 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.727 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.727 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.838 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.839 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.888 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.888 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:39.980 T:3069    debug <general>: Thread Timer 3673116976 terminating
2025-05-25 20:51:40.007 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:40.008 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info
2025-05-25 20:51:40.008 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0

Also the log my script makes is empty

Try something like a Toast and see if you get a pop-up.

Is default keymap active?

@darwindesign you’re the keymap guy… Any pointers?

Sorry i do apologize but how do i make sure that the default keymap is not active other then making sure that the long press keymap is in .kodi/userdata/keymaps/osmc/gen.xml and then doing a system reboot.

Also looks like i was able to get a little bit of change now when long pressed i get

2025-05-25 21:19:56.702 T:2829    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 21:19:56.702 T:2829    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10025, action is noop

which looks a little different then the last time which gave me

2025-05-25 20:51:39.684 T:2823    debug <general>: Keyboard: scancode: 0xb3, sym: 0x28 (leftparen), unicode: 0x28, modifier: 0x0
2025-05-25 20:51:39.575 T:2823    debug <general>: HandleKey: long-leftbracket (0x100f028) pressed, window 10000, action is info

What comes to mind is possibly there is an error in your keymaps syntax that would prevent it form loading (that should show up in a Kodi debug log) or possibly your trying it either without restarting Kodi/reloading keymaps, or else you are in a window that has a window specific mapping for that button which would override your global mapping. You can see the OSMC remote keymap for reference [HERE]. The following removes all window specific mappings for “i” long-press…

<?xml version="1.0" encoding="UTF-8"?>
<keymap>
	<global>
		<keyboard>
			<leftbracket mod="longpress">RunScript(/home/osmc/scripts/download.py)</leftbracket>
		</keyboard>
	</global>
	<FullscreenVideo>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</FullscreenVideo>
	<FullscreenGame>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</FullscreenGame>
	<FullscreenInfo>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</FullscreenInfo>
	<Visualisation>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</Visualisation>
	<MusicOSD>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</MusicOSD>
	<VisualisationPresetList>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</VisualisationPresetList>
	<VideoOSD>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</VideoOSD>
	<VideoMenu>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</VideoMenu>
	<OSDVideoSettings>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</OSDVideoSettings>
	<OSDAudioSettings>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</OSDAudioSettings>
	<osdsubtitlesettings>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</osdsubtitlesettings>
	<MusicInformation>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</MusicInformation>
	<SongInformation>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</SongInformation>
	<MovieInformation>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</MovieInformation>
	<PictureInfo>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</PictureInfo>
	<FullscreenLiveTV>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</FullscreenLiveTV>
	<AddonInformation>
		<keyboard>
			<leftbracket mod="longpress"/>
		</keyboard>
	</AddonInformation>
	</keymap>

Thanks looks like that keygen worked amazingly as long as i am in a file navigation window thanks so much.

i have one more question would i change all the

<leftbracket mod="longpress"/>

to

<leftbracket mod="longpress">RunScript(/home/osmc/scripts/download.py)</leftbracket>

if i want all the long press to work in all area’s or are their certain areas you would recommend NOT doing this?

If you want an action id to work in all areas you would add it to global. If you wanted it only in a specific window then you would put it in a section with that window name. There is numerous keymaps that are loaded in order by location and then alphabetically, and any overlapping mapping gets replaced by the last keymap loaded. If you want to remove a mapping without specifying a different action (ie remove a window specific mapping that was added with a previously loaded keymap so the mapping for that window then uses the global action) you would add a mapping with an empty tag which is what I was doing with <button/> as it is shorthand for <button></button> and as such the keymap I posted was just removing all the long-press “i” window specific mappings so you only needed to add your RunScript action in global to have it work in all windows.

I can’t see any reason why there would be any issues running that kind of a script in any particular area of Kodi necessitating any kind of window specific mapping. The script isn’t interacting with Kodi so I doubt there should be any issues. If you happened to find some specific window that you didn’t want that to run in you would just do a window specific mapping using a “noop” action id to have it do nothing or some other action id to have it perform a different function in that specific window.

1 Like

Thank you SO MUCH you folks are all so awesome i appreciate your help so much

2 Likes