Below are the results:
[hr]
It can be done with some modifications:
/storage/.config/udev.rules.d/99-usb-play.rules
CodeIMPORT{builtin}="blkid" ACTION=="add", SUBSYSTEM=="block", KERNEL=="sd*|mmc*", ENV{ID_FS_USAGE}=="filesystem", \ RUN+="/usr/bin/systemd-run /storage/autoplay.sh /dev/%k"
/storage/autoplay.sh
Bash Display More#!/bin/sh sleep 5 MP=$(grep "^${1} " /proc/self/mounts | cut -d ' ' -f 2) if [ -f "${MP}/kodi.playme" ] then /usr/bin/kodi-send --action="PlayMedia(\"${MP}\", isdir)" fi
I created the 99-usb-play.rules and autoplay.sh files as they did not exist before. I added the codes which you shared - exactly - for both files. Rebooted the system and inserted a USB drive. It did not auto-play the USB contents. The sub-window shows up as usual with "Browse videos" and "Browse music" etc. as options, but no auto-play of contents within the USB drive.
Is there anything else that I need to do to make this code work?