A cross-platform command-line tool for finding and playing video files in large collections
- π Fast file search - Uses vendored
fdbinary with automatic fallback to Python scanning - π― Flexible pattern matching - Glob-based search patterns with automatic wildcard wrapping
- π Quick access to search results - Access found files by index number
- πΎ Caching of library metadata - Cache library metadata for fast file lookups in network storage
- π Multi-path scanning - Search across multiple configured directories simultaneously
- π Latest additions - Find newest files by modification time
- π¬ Media player integration - Launch files directly in VLC
- π IMDB lookup - Automatically open IMDB pages for media files
- βοΈ Flexible configuration - TOML-based config with extension filtering and path management
- π₯οΈ Cross-platform - Works on Windows, Linux, and macOS
Install with uv:
uv tool install mediafinder
Note
If mf is shadowed by another command on your system (e.g., Metafont), use mediafinder instead β it's already installed and works exactly the same way.
- Configure search paths where your media files are located:
mf config set search_paths "/path/to/movies" "/path/to/tv-shows"- Optional: Activate library caching
If your collection is stored on the network, activate caching for fast file searches:
mf config set cache_library true- Find media files matching a filename pattern:
mf find "batman" # Finds files containing "batman"
mf find "*.mp4" # Finds all MP4 files
mf find "2023" # Finds files from 2023- Play a file from search results:
mf play 1 # Play first result
mf play # Play random file- Find latest additions:
mf new # Show 20 newest files
mf new 50 # Show 50 newest filesmf find [pattern]- Search for media files matching the glob patternmf new [n]- Show latest additions (default: 20 files)mf play [index]- Play a file by index, or random file if no index givenmf imdb <index>- Open IMDB page for a media filemf filepath <index>- Print full path of a search resultmf config- Configuremfmf version- Print version informationmformf --help- Print help
mf last/mf last show- Show indexed results from the last file searchmf last file- Print search result file locationmf last clear- Clear last search results
Cached indices remain valid until you run another find or new command that overwrites the last search.
Configuration:
mf config set cache_library <true/false>- Turn library caching on or offmf config set library_cache_interval <interval>- Set auto-rebuild interval (0 to disable)
Manual control:
mf cache rebuild- Trigger a library cache rebuildmf cache file- Print cache locationmf cache clear- Clear the cache
mf can be configured directly on the command line:
mf config set <key> <values>- Set configuration valuesmf config add <key> <values>- Add values to list settingsmf config remove <key> <values>- Remove values from list settingsmf config get <key>- Get configuration valuemf config list- Show the current configurationmf config edit- Edit config file in default editormf config file- Print config file locationmf config settings- Print a table of all available settings
Add multiple paths of a (scattered) collection:
mf config set search_paths "/movies" "/tv-shows" "/documentaries"Control which file types are considered media files:
mf config set media_extensions ".mp4" ".mkv" ".avi" ".mov" ".wmv"
Toggle whether to filter results by media extensions:
mf config set match_extensions true # Only return configured media types
mf config set match_extensions false # Return all files matching patternfullscreen_playback(bool): If true,mf playlaunches VLC with--fullscreen --no-video-title-show.prefer_fd(bool): Use the bundledfdscanner when possible. Automatically ignored for mtime-sorted searches (mf new) which always use the Python scanner.
mf config edit resolves an editor in this order:
$VISUALor$EDITOR- Windows: Notepad++ if present else Notepad
- POSIX: first available of
nano,vim,vi
If no editor is found, it prints the path so you can edit manually.
- Boolean values accept:
true,false,yes,no,y,n,on,off,1,0(case-insensitive; synonyms normalized to true/false). - Media extensions are normalized to lowercase with a leading dot (
mkvβ.mkv). - Paths are stored as absolute POSIX-style strings.
- Use quotes around patterns with wildcards to prevent shell expansion
- Patterns without wildcards are automatically wrapped:
batmanbecomes*batman* - Automatic wildcard wrapping only happens if the pattern contains none of:
* ? [ ]. - Examples:
mf find "*.mp4"- All MP4 filesmf find batman- Files containing "batman"mf find "*2023*1080p*"- 2023 releases in 1080pmf find "s01e??"- Season 1 episodes
- VLC Integration: Automatically launches VLC media player
- IMDB Lookup: Uses filename parsing to find matching IMDB entries
- Smart Caching: Search results are cached for quick index-based access
- Cross-platform paths: Handles Windows and Unix path conventions
- Random Playback:
mf play(without index) randomly selects a file by scanning all configured paths (not just the last cached search).
- Uses bundled
fdbinary for fast file scanning when possible - Automatic fallback to Python scanning if
fdunavailable - Parallel scanning across multiple search paths
- All tests with
hyperfineand warm caches:hyperfine --warmup 3 --runs 10 "mf find test". - Media collection on two separate, mechanical USB drives in a file server on the local network, served via SMB for Windows and NFS for Linux clients, 16.3 TiB / 3540 files total.
- Tested on the file server itself with local file access as well as on a Linux and a Windows desktop with network file access.
mf findcan use both thefdscanner as well as the pure python one. First run was with the default settingprefer_fd = true. After that I switched to the python scanner viamf config set prefer_fd falseand tested again.
| Platform | Pure Python (ms) | fd Scanner (ms) |
Improvement |
|---|---|---|---|
| Linux Server (local file access) | 697.9 Β± 17.1 | 443.5 Β± 2.6 | 36% faster |
| Linux Desktop (NFS) | 1,618.0 Β± 28.0 | 478.2 Β± 21.2 | 70% faster |
| Windows Desktop (SMB) | 2,371.0 Β± 90.0 | 1,601.0 Β± 94.0 | 32% faster |
- The
fdscanner provides 32-70% performance improvement for search operations over pure python file scanning.
- Python 3.10+
- VLC media player (for
playcommand) - Internet connection (for IMDB lookup)
IMDb lookups rely on the cinemagoer library (imdb module), which uses an API that was deprecated in Python 3.14. Until this is fixed upstream, in 3.14 mf imdb exits gracefully without affecting other commands.
This project is licensed under the MIT License - see the LICENSE-MIT file for details.
This package includes the fd file finder binary, which is dual-licensed under MIT OR Apache-2.0.
Copyright (c) 2017-present the fd developers.
- MIT License: See
src/mf/bin/LICENSE-fd-MIT - Apache License 2.0: See
src/mf/bin/LICENSE-fd-APACHE