A modern command-line interface to browse and play media from SAM-FTP servers with rich terminal UI, caching, bookmarks, and async operations.
- Beautiful Terminal UI: Rich formatted output with colors, icons, and tables
- Async Operations: Non-blocking downloads and directory browsing with aiohttp
- Smart Caching: Directory listings cached with TTL for faster navigation
- Bookmarks: Save and quickly access favorite directories
- Batch Operations: Multi-select files for download or playlist creation
- Player Persistence: Remember your preferred media player
- Background Playback: Continue browsing while media plays
- Authentication: Support for password-protected servers
- Interactive Setup: First-run wizard guides you through configuration
- Video: MP4, AVI, MOV, MKV, WebM, FLV, M4V
- Audio: MP3, FLAC, M4A, WAV, OGG, AAC
- Images: JPG, PNG, GIF, BMP, SVG, WebP
- Players: mpv, VLC, IINA (auto-detect and remember preference)
- Breadcrumb navigation with path display
- Fuzzy search with
fzfintegration - Download progress bars with speed and ETA
- Automatic retry with exponential backoff
- Configurable download locations
- CLI subcommands for management
- Optional TUI mode (experimental)
- Python 3.8+
- Media Player: At least one of:
- Optional: fzf for search functionality
- Optional: Rye for development
# Clone the repository
git clone <repository_url>
cd samftp_cli
# Install with Rye (recommended)
rye sync
rye shell
# Or install with pip
pip install -e .On first launch, SAM-FTP CLI will guide you through an interactive setup wizard:
samftpThe wizard will help you:
- Create the configuration file
- Add your first server
- Test the connection
- Set your preferred media player
Alternatively, manually create ~/.samftp-cli.env:
# Linux/macOS
cp .env.example ~/.samftp-cli.env
# Windows
copy .env.example %USERPROFILE%\.samftp-cli.env# Start the interactive browser
samftp
# Start with specific server
samftp --server "Movies"
# Use specific player
samftp --player mpv
# Launch TUI mode (experimental)
samftp --tui# Run configuration wizard
samftp config
# Add a new server
samftp config-add
# Validate configuration
samftp config-validate
# Show config file location
samftp config-path# Show cache statistics
samftp cache-stats
# Clear all cache
samftp cache-clear# List all bookmarks
samftp bookmarks-list
# In browser: Press 'a' to add bookmark at current location
# In browser: Press 'b' to view and navigate to bookmarksOnce in the browser, use these commands:
| Key | Action |
|---|---|
0-N |
Select file or folder by number |
s |
Search (fuzzy find with fzf) |
m |
Multi-select mode (batch operations) |
p |
Play all media files as playlist |
d |
Download all files in directory |
a |
Add current location to bookmarks |
b |
View and navigate bookmarks |
c |
Change media player |
r |
Refresh (clear cache and reload) |
h or ? |
Show help |
q |
Quit application |
Press m to enter batch selection:
# Select individual items
1,3,5
# Select ranges
1-5,8,10-15
# Commands in batch mode
done - Finish selection
clear - Clear all selections
cancel - Exit without action
After selection, choose to:
- Download selected files
- Play selected media files
- Cancel
Add servers to ~/.samftp-cli.env:
# Basic server
SERVER_1_NAME="English Movies"
SERVER_1_URL="http://172.16.50.7/Movies/"
# Server with authentication
SERVER_2_NAME="Private Server"
SERVER_2_URL="http://example.com/files/"
SERVER_2_USERNAME="myuser"
SERVER_2_PASSWORD="mypass"
# Server with preferred player
SERVER_3_NAME="Music"
SERVER_3_URL="http://music.server.com/"
SERVER_3_PREFERRED_PLAYER="mpv"# Default media player (mpv, vlc, iina)
DEFAULT_PLAYER="mpv"
# Default download directory
DEFAULT_DOWNLOAD_DIR="/Users/you/Downloads"# Clone and setup
git clone <repository_url>
cd samftp_cli
rye sync
# Run from source
python -m samftp_cli.main
# Run tests (when available)
rye run pytest# Lint
rye lint
# Format
rye fmt
# Type check (if configured)
rye run mypy srcsrc/samftp_cli/
├── main.py # CLI entry point with Click framework
├── config.py # Configuration management and wizard
├── ftp_client.py # Async HTTP client with caching
├── ui.py # Rich terminal UI components
├── player.py # Media player integration
├── cache.py # Directory listing cache manager
├── bookmarks.py # Bookmark management
├── data_models.py # Data classes and utilities
└── tui.py # Textual TUI (experimental)
- Async/Await: Non-blocking operations with aiohttp
- Rich Formatting: Beautiful terminal output with tables, panels, and colors
- Caching: 5-minute TTL cache for directory listings
- Bookmarks: Persistent favorite locations
- Player Persistence: Remembers your preferred player
- Background Playback: Non-blocking media playback
- Batch Operations: Multi-select for downloads and playlists
- Better Errors: Detailed error messages with retry logic
- Session Management: Tracks state across navigation
- First-Run Experience: Interactive setup wizard
- CLI Framework: Click-based subcommands
- Authentication: HTTP Basic Auth support
- Breadcrumbs: Visual path navigation
- Download Management: Configurable locations with progress bars
# Run the configuration wizard
samftp config# macOS
brew install fzf
# Ubuntu/Debian
sudo apt install fzf
# Fedora
sudo dnf install fzfInstall at least one media player:
- mpv:
brew install mpv(macOS) orsudo apt install mpv(Linux) - VLC: Download from videolan.org
- IINA: Download from iina.io (macOS only)
# Clear the cache
samftp cache-clear
# Check cache location and stats
samftp cache-statsIf you encounter errors like "'NoneType' object has no attribute 'substitute'":
# The error is logged to a file for debugging
# Location (macOS): ~/Library/Logs/samftp-cli/error.log
# Location (Linux): ~/.local/state/samftp-cli/error.log
# Location (Windows): %LOCALAPPDATA%\samftp-cli\Logs\error.log
# Solutions:
# 1. Run the configuration wizard to recreate config
samftp config
# 2. Manually check config file for malformed variables
# Look for ${VARIABLE} references in ~/.samftp-cli.env
# 3. Delete config and restart
rm ~/.samftp-cli.env
samftp- ✅ Async operations with aiohttp
- ✅ Rich terminal formatting
- ✅ Caching system
- ✅ Bookmarks
- ✅ Batch selection
- ✅ Player persistence
- ✅ Background playback
- ✅ Authentication support
- ✅ Interactive setup wizard
- ✅ CLI framework with subcommands
- ⬜ File filtering and sorting
- ⬜ Search across entire server
- ⬜ Download queue management
- ⬜ Parallel downloads
- ⬜ Resume downloads
- ⬜ Subtitle auto-detection
- ⬜ Full TUI mode with mouse support
- ⬜ Playlist management and export
- ⬜ Command history
- ⬜ File information view
MIT
Masnun Siam (echo@msiamn.dev)