Posts by kmihmisc

    Below are the results:
    [hr]

    It can be done with some modifications:

    /storage/.config/udev.rules.d/99-usb-play.rules

    Code
    IMPORT{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

    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?

    Thanks for your replies. It seems like there are no ready-made solutions for dynamically reading media content and auto-playing after USB drive insertion.

    I am trying to run Kodi/Libreelec on a RP0 using minimal extra hardware. I know I must have the SD-card which by default has 2 Linux ext3/4 partitions and cannot be easily read by Windows. So copying media files directly to that SD-card using Ubuntu etc. and creating a playlist that is auto-executed at startup is an alternate option. However, this option does not work for USB drives when inserted after booting.

    I can add a cheap micro USB OTG adapter on top of a FAT32 formatted USB drive and directly connect it to the micro USB slot on the RP0. Without a mouse, keyboard or Kore remote, I must rely on the Kodi/Libreelec system to automatically play all media upon insertion of the USB drive.

    Is there an easy way to auto-play media files from a FAT32 formatted USB drive while not having any mouse, keyboard or Kore remote to navigate, select and click on media files?


    Apart from DVDs, Kodi has no autoplay support for music or videos from inserted USB sticks, external HDDs and the like.

    Thanks for your response.

    1. If KODI can dynamically auto-play DVDs when inserted, there must be a way to customize that set of codes and make it work for USB drives.

    2. Is there a way to use wild-card characters such as "*" to play all videos in a given folder on the SD-card? As an example, is the following possible:
    "PlayMedia(/home/pi/.xbmc/userdata/playlists/*.MP4)"
    or
    "PlayMedia(/home/pi/.xbmc/userdata/playlists/*.*)"

    I'm using LibreElec on Raspberry Pi Zero (RP0). I have a hub attached to the RP0. I want to know how to automatically play video files from a USB drive upon insertion. I saw sample of an autoexec file that may potentially auto-run a playlist and contents residing in the micro-SD card upon booting. But, I need something that is more versatile and dynamic. I need a way to automatically read the mp4, mp3, avi, mkv contents from the USB drive upon insertion to the hub and start playing those files.