Sep 082017
 Posted by on UTC 2017.09.08Fri at 07:25 Uncategorized Tagged with: , ,  Add comments

Intent is to create a USB thumb drive for PCs that auto-play movies and photos on that thumb drive. Open source is preferred.

Research of photo frame options made me think of Kodi, and research on ready-to-run Kodi distros led me to LibreELEC. (FYI OpenELEC is for gadgets (PI, custom hardware; LibreELEC is for PC and bigger things.)

Note that this is a very technical process. You need to know how to work with partitions and edit scripts. We’re making LibreELEC do things it doesn’t really want to, so there’s no easy way around this.

  • Install LibreELEC on thumb drive
    • Use their “LibreELEC.USB-SD.Creator.Win32.exe”
      • Ensure thumb contains only one partition. Windows must assign a letter for SD Creator to see it; Windows will do this for unformatted partitions.
      • Download and latest LibreELEC from within Creator, then install to thumb.
      • Do not boot until instructed below.
      • Note: To log in to Linux directly, user is “root”, password is “libreelec”. You need to enable SSH from within Kodi and log in from another machine; there is no terminal app installed in Kodi itself.
    • Hack the partitions and boot LibreELEC
      • Partition config is unacceptable for Windows. SD.Creator creates two partitions, neither of which can be used by Windows for files (boot part too small for files; media part is ext4 and cannot be accessed). A third partition must be created.
      • SD.Creator creates a small placeholder partition that LibreELEC will expand to full drive. Messing with partitions always seems to break this, so there’s a few steps to get this working.
      • Use your favorite partition util to examine thumb drive.
        • 1st part is FAT with boot files; 2nd part is a 32mb placeholder part; rest of drive is unallocated. On first boot, LibreELEC will expand that 32mb part to full drive.
        • Create a new FAT partition at end of drive, and leave enough space between 32mb part and new part so 32mb can be expanded to total 512 mb. You can make smaller if you want, but this is where Kodi’s config and add-ons will go.
        • Format your new partition, and give it a meaningful label.
      • Boot the thumb drive.
        • Note: At boot menu, enter “run” this one time. The default is “installer” which we don’t want. After this step, bootup will work correctly automatically.
        • LibreELEC will boot, and normally it will expand the 32mb part to fill drive. However for me, it simply deleted the 32mb part.
        • Whatever it does, it will auto reboot.
        • If Kodi boots up, you’re done! Skip the remaining steps below.
        • If fails to boot, enter poweroff.
      • Run your partition editor on the thumb drive again.
        • Create an ext2 partition in the now-empty 512 mb hole. If there’s already a partition in that hole, I don’t know what to do.
      • Boot thumb drive. Will fail to boot, but will drop you to a single-user command prompt.
        • mount -o remount,rw /dev/sda1 /flash
        • blkid >> /flash/syslinux.cfg
        • poweroff
      • Edit that syslinux.cfg file.
        • Add # in front of the new lines to keep them as comments.
        • Find the ‘run’ config, and edit the UUID to match the new ext2 partition created above. Should be sda2.
      • Boot thumb drive. At this point, everything was working for me.
  • Configure LibreELEC
    • Note: This uses skin “Estuary” by default; may affect locations of settings.
    • Note: Right-click to go back a level. Sometimes need to double-right-click, or right-click on some other button.
    • Settings/Player/Videos: Play next video automatically = ON
    • Settings/Player/Music: Play next song automatically = ON
    • Settings/Player/Discs: Play DVDs automatically = OFF
    • Settings/Player/Pictures: Show EXIF = OFF
    • Settings/Player/Pictures: High quality downscaling = ON
    • Settings/Media/Library: (Video and Music sections) Update library on startup = ON; Hide progress = On
    • Settings/Services/General: Device name = (set this)
    • Settings/Services/Control: Password = libreelec
    • Settings/Services/UPnP: Share = OFF
    • Settings/Services/AirPlay: Enable = OFF
    • Settings/Interface/Screensaver: Screensaver mode = None
    • Settings/Skin/Main menu items: (turn off everything but Videos, Music, Pictures)
  • Set up auto-play.
    • Simply create “” under Userdata. You can access this via SAMBA (enable in config): edit it, save it, then reboot LibreELEC to test it.
    • Note you must reboot to startup autoplay; there’s no way to run it by hand. Though you can navigate to your video under Videos and start playing; it will loop through all in that directory.
    • My auto-play script is below:
import os, xbmc

#Thanks be to:



videoList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)

#for fname in dirList:
# videoList.add(os.path.join(path, fname))

for dirpath,dirs,files in os.walk(path):
for file in files:
  b,e = os.path.splitext(file)
  # only add video files; kodi won't play anything else, and brings up gui over playback
  if e.lower() in [".mp4", ".avi", ".mov"]:

  • Configure PC as photo frame
    • Unplug hard drive to reduce noise and power consumption.
    • Edit BIOS to boot computer whenever power is applied.
    • Enable boot from USB. Boot order not critical; nothing but USB is available.
    • Disable error messages for missing keyboard and HD.