animebot / COMMANDS.md
luci18's picture
Upload folder using huggingface_hub
e4ccb70 verified
|
Raw History Blame Contribute Delete
5.89 kB
# Anime Encoder Bot - Commands & Features
## πŸ“ All Available Commands
### 🎬 Basic Commands
| Command | Usage | Description |
|---------|-------|-------------|
| `/start` | `/start` | Start the bot with menu buttons |
| `/help` | `/help` | Show help message |
| `/sites` | `/sites` | List available anime sites |
### πŸ” Search & Download
| Command | Usage | Description |
|---------|-------|-------------|
| `/anime` | `/anime <query>` | Search all anime sites |
| `/anime` | `/anime <query> <site>` | Search specific site (e.g., `/anime naruto gogoanime`) |
| `/download` | `/download <url> <ep>` | Download specific episode |
| `/ddl` | `/ddl <url>` | Download from direct URL |
### 🎞️ Video Encoding
| Command | Usage | Description |
|---------|-------|-------------|
| `/encode` | Reply to video + `/encode` | Encode a video with user settings |
| `/batchencode` | Reply to video + `/batchencode` | Batch encode multiple videos |
| `/thumb` | Reply to video + `/thumb` | Generate custom thumbnail |
### βš™οΈ Settings & Stats
| Command | Usage | Description |
|---------|-------|-------------|
| `/settings` | `/settings` | Configure encoding, renaming, thumbnail preferences |
| `/status` | `/status` | View queue status |
| `/mystats` | `/mystats` | View your personal statistics |
| `/stats` | `/stats` | Admin statistics (admin only) |
## πŸŽ›οΈ Settings Customization (via `/settings`)
### Video Encoding Settings
- **Video Codec**: H.264 (libx264) or H.265/HEVC (libx265)
- **CRF Quality**: 16-35 (lower = better quality)
- **Speed Preset**: ultrafast to veryslow
- **Resolution**: original, 1080p, 720p, 480p, 360p
- **Audio Codec**: AAC, AC3, Opus, MP3
- **Audio Bitrate**: 96k-320k
### πŸ–ΌοΈ Thumbnail Settings
Users can customize:
1. **Resolution**: 1080p, 720p, 480p, 360p, 240p, 180p
2. **Position**: 10%, 25%, 50%, 75%, 90% (where in video to capture)
3. **Format**: JPG or PNG
4. **Caption Template**: Custom text with variables:
- `{filename}` - Video filename
- `{resolution}` - Thumbnail resolution
- `{position}` - Timestamp position
### πŸ“ Rename Settings
- **Auto Rename**: Toggle on/off
- **Pattern Template**: Choose from presets or custom:
- `simple`: `{title} - Ep{episode}`
- `detailed`: `{title} - S{season}E{episode} [{quality}]`
- `with_codec`: `{title} - Ep{episode} [{quality}] [{codec}]`
- `with_site`: `[{source_site}] {title} - Ep{episode} [{quality}]`
- `anime_style`: `[{studio}] {title} - {episode} [{quality}]`
### Video Caption Template
Default: `🎬 {filename}\nπŸ“Š {resolution} | ⏱️ {duration} | πŸ’Ύ {size}`
Available variables:
- `{filename}` - Video filename
- `{resolution}` - Video resolution (e.g., 1920x1080)
- `{duration}` - Video duration
- `{size}` - File size
- `{codec}` - Video codec
## 🌐 Web Admin Panel
Access at `http://localhost:5000` after running:
```bash
python web_panel.py
```
**Default Login:**
- Username: `admin`
- Password: `admin` (⚠️ change in production!)
**Panel Features:**
- πŸ“Š Dashboard with real-time stats
- πŸ‘₯ User management
- πŸ“‹ Task monitoring
- πŸ† Leaderboard view
- βš™οΈ Settings control
## πŸ”§ Known Issues to Fix
### 1. **Import Error in queue.py**
Make sure `from config import Config` is at the top of `bot/queue.py`
### 2. **Missing UUID import in handlers.py**
Should have `import uuid` at the top
### 3. **Missing imports in renamer.py**
Needs `from config import Config`
### 4. **Flask missing in requirements.txt**
Add:
```
flask>=2.3.0
werkzeug>=2.3.0
```
### 5. **Web Panel Environment Variables**
Add to `.env`:
```
ADMIN_USERNAME=admin
ADMIN_PASSWORD_HASH=<bcrypt_hash>
FLASK_SECRET_KEY=your-secret-key
```
## πŸš€ Quick Setup Checklist
1. **Install dependencies:**
```bash
pip install -r requirements.txt
```
2. **Configure environment:**
```bash
cp .env.example .env
# Edit .env with your credentials
```
3. **Run the bot:**
```bash
python -m bot.main
```
4. **Run web panel (optional):**
```bash
python web_panel.py
```
## πŸ“ Project Structure
```
windsurf-project/
β”œβ”€β”€ bot/
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ database.py # MongoDB operations
β”‚ β”œβ”€β”€ downloader.py # Anime downloading
β”‚ β”œβ”€β”€ encoder.py # FFmpeg encoding
β”‚ β”œβ”€β”€ handlers.py # Telegram handlers
β”‚ β”œβ”€β”€ main.py # Bot entry point
β”‚ β”œβ”€β”€ queue.py # Task queue system
β”‚ β”œβ”€β”€ renamer.py # File renaming
β”‚ β”œβ”€β”€ sites.py # Anime site configs
β”‚ β”œβ”€β”€ stats.py # Statistics module
β”‚ └── thumbnail.py # Thumbnail generation
β”œβ”€β”€ config.py # Configuration
β”œβ”€β”€ web_panel.py # Web admin panel
β”œβ”€β”€ requirements.txt # Dependencies
β”œβ”€β”€ Dockerfile # Docker image
β”œβ”€β”€ docker-compose.yml # Docker orchestration
└── README.md # Documentation
```
## πŸ› Troubleshooting
**Bot not starting?**
- Check `.env` has all required variables
- Ensure MongoDB is running
- Verify FFmpeg is installed: `ffmpeg -version`
**Downloads failing?**
- Check `animdl` is installed: `animdl --version`
- Verify download directories exist and are writable
**Web panel not accessible?**
- Check port 5000 is not in use
- Verify Flask is installed
- Check firewall settings
## πŸ“ Environment Variables
Required:
```env
API_ID=your_api_id
API_HASH=your_api_hash
BOT_TOKEN=your_bot_token
OWNER_ID=your_telegram_id
MONGO_URI=mongodb://localhost:27017/anime_encoder_bot
```
Optional:
```env
# Web Panel
ADMIN_USERNAME=admin
ADMIN_PASSWORD_HASH=<bcrypt_hash>
FLASK_SECRET_KEY=secret
# Defaults
DEFAULT_CRF=28
DEFAULT_PRESET=medium
DEFAULT_CODEC=libx264
DEFAULT_RENAME_PATTERN={title} - Ep{episode} [{quality}]
# Queue limits
MAX_CONCURRENT_DOWNLOADS=2
MAX_CONCURRENT_ENCODINGS=1
```