# 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 ` | Search all anime sites | | `/anime` | `/anime ` | Search specific site (e.g., `/anime naruto gogoanime`) | | `/download` | `/download ` | Download specific episode | | `/ddl` | `/ddl ` | 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= 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= 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 ```