Automatically adds the previous and next track from the same directory to the VLC playlist as soon as a file starts playing. Supports wrap‑around (with ≥3 files, cycling at the beginning/end).
- Automatically adds neighbors of the currently playing file
- Wrap‑around when there are at least 3 files
- Cross‑platform (Windows, Linux, macOS)
- No GUI interaction required (loads as an interface at VLC startup)
- VLC 3.0.x (tested with 3.0.21)
-
Copy
auto_dir_enqueue.luato your user interface folder (create the folder if needed):- Windows:
%APPDATA%\vlc\lua\intf\ - Linux:
~/.local/share/vlc/lua/intf/(alternatively~/.config/vlc/lua/intf/) - macOS:
~/Library/Application Support/org.videolan.vlc/lua/intf/
- Windows:
-
Enable the interface (choose one):
- Option A: persistently via VLC config
vlcrc(user file)- Windows:
%APPDATA%\vlc\vlcrc - Linux:
~/.config/vlc/vlcrc - macOS:
~/Library/Preferences/org.videolan.vlc/vlcrc - Set/add the following lines:
extraintf=luaintf lua-intf=auto_dir_enqueue
- Windows:
- Option B: for testing via command line/shortcut
- Start parameters:
--intf luaintf --lua-intf auto_dir_enqueue
- Start parameters:
- Option A: persistently via VLC config
- Simply open a media file (e.g., double‑click). The interface automatically adds:
- Previous track: alphanumerically previous file (at index 1 and ≥3 files: last file)
- Next track: alphanumerically next file (at last index and ≥3 files: first file)
- With exactly 2 files, only the other file is added
- Enable in
vlcrc(adjust paths):file-logging=1 log-verbose=2 logfile=<path to log file> - After startup you will find diagnostic lines prefixed with
auto_dir_enqueue:
- Interface does not auto‑load:
- Ensure
extraintf=luaintfandlua-intf=auto_dir_enqueueare set invlcrc - Try starting VLC with
--no-one-instance --intf luaintf --lua-intf auto_dir_enqueue
- Ensure
- Playlist remains at 1 item:
- Ensure there are other media files with supported extensions in the same folder
- Check the log (lines with
auto_dir_enqueue:), especially path/URI conversion and directory listing
- Wrap‑around does not apply:
- Wrap‑around is only enabled with at least 3 files
- Remove or comment out
extraintf/lua-intfinvlcrc - Delete
auto_dir_enqueue.luafrom the interface folder
- Idea for robust file selection/playlist manipulation inspired by a VLC Lua extension (neighbor logic, move trick for “previous track”) https://github.com/djomlastic/vlc-prev-next