diff --git a/videoarchiver/README.md b/videoarchiver/README.md index ab5755a..884d71c 100644 --- a/videoarchiver/README.md +++ b/videoarchiver/README.md @@ -1,237 +1,138 @@ -# VideoArchiver Cog for Red-DiscordBot +# VideoArchiver Cog -A powerful video archiving cog that automatically downloads and reposts videos from monitored channels, with support for GPU-accelerated compression, multi-video processing, and role-based permissions. +A Red-DiscordBot cog for automatically archiving videos from monitored Discord channels. ## Features -- **Hardware-Accelerated Video Processing**: - - NVIDIA GPU support using NVENC with advanced encoding options - - AMD GPU support using AMF with quality preservation - - Intel GPU support using QuickSync with look-ahead - - ARM64/aarch64 support with V4L2 M2M encoder - - Multi-core CPU optimization with advanced parameters - - Automatic GPU fallback to CPU if hardware encoding fails -- **Smart Video Processing**: - - Content-aware video analysis - - Dark scene detection and optimization - - Motion detection and adaptation - - Dynamic audio bitrate allocation - - Intelligent quality preservation - - Only compresses when needed - - Concurrent video processing - - Default 8MB file size limit -- **Role-Based Access**: - - Restrict archiving to specific roles - - Default allows all users - - Per-guild role configuration -- **Wide Platform Support**: - - Support for multiple video platforms via [yt-dlp](https://github.com/yt-dlp/yt-dlp) - - Configurable site whitelist - - Automatic quality selection -- **Automatic Updates**: - - Automatic yt-dlp update checking - - Semantic version comparison - - Bot owner notifications for new versions - - Easy update command - - Configurable update notifications - - Retries for update operations -- **Error Handling & Logging**: - - Detailed error logging to Discord channels - - Full error tracebacks for debugging - - Automatic retries for Discord operations - - Proper resource cleanup - - Task tracking and management +- Automatically detects and downloads videos from monitored channels +- Supports multiple video hosting platforms through yt-dlp +- Enhanced queue system with priority processing and performance metrics +- Configurable video quality and format +- Role-based access control +- Automatic file cleanup +- Hardware-accelerated video processing (when available) +- Customizable notification messages +- Queue persistence across bot restarts + +## File Structure + +The cog is organized into several modules for better maintainability: + +- `video_archiver.py`: Main cog class and entry point +- `commands.py`: Discord command handlers +- `config_manager.py`: Guild configuration management +- `processor.py`: Video processing logic +- `enhanced_queue.py`: Advanced queue management system +- `update_checker.py`: yt-dlp update management +- `utils.py`: Utility functions and classes +- `ffmpeg_manager.py`: FFmpeg configuration and hardware acceleration +- `exceptions.py`: Custom exception classes ## Installation -To install this cog, follow these steps: - -1. Ensure you have Red-DiscordBot V3 installed. -2. Add the repository to your bot: - - ``` - [p]repo add Pac-cogs https://github.com/pacnpal/Pac-cogs - ``` - -3. Install the VideoArchiver cog: - - ``` - [p]cog install Pac-cogs videoarchiver - ``` - -4. Load the cog: - - ``` - [p]load videoarchiver - ``` - -Replace `[p]` with your bot's prefix. - -The required dependencies (yt-dlp, ffmpeg-python, requests, aiohttp) will be installed automatically. You will also need FFmpeg installed on your system - the cog will attempt to download and manage FFmpeg automatically if it's not found. - -### Important: Keeping yt-dlp Updated - -The cog relies on [yt-dlp](https://github.com/yt-dlp/yt-dlp) for video downloading. Video platforms frequently update their sites, which may break video downloading if yt-dlp is outdated. The cog will automatically check for updates and notify the bot owner when a new version is available. - -To update yt-dlp: +1. Install the cog using Red's cog manager: ```bash -[p]videoarchiver updateytdlp +[p]repo add videoarchiver +[p]cog install videoarchiver ``` -You can also disable update notifications per guild: +2. Load the cog: ```bash -[p]videoarchiver toggleupdates +[p]load videoarchiver ``` ## Configuration -The cog supports both slash commands and traditional prefix commands. Use whichever style you prefer. +Use the following commands to configure the cog: -### Channel Setup -``` -/videoarchiver setchannel #archive-channel # Set archive channel -/videoarchiver setnotification #notify-channel # Set notification channel -/videoarchiver setlogchannel #log-channel # Set log channel for errors/notifications -/videoarchiver addmonitor #videos-channel # Add channel to monitor -/videoarchiver removemonitor #channel # Remove monitored channel - -# Legacy commands also supported: -[p]videoarchiver setchannel #channel -[p]videoarchiver setnotification #channel -etc. -``` +### Channel Settings +- `[p]va setchannel `: Set the archive channel +- `[p]va setnotification `: Set the notification channel +- `[p]va setlogchannel `: Set the log channel +- `[p]va addmonitor `: Add a channel to monitor +- `[p]va removemonitor `: Remove a monitored channel ### Role Management -``` -/videoarchiver addrole @role # Add role that can trigger archiving -/videoarchiver removerole @role # Remove role from allowed list -/videoarchiver listroles # List all allowed roles (empty = all allowed) -``` +- `[p]va addrole `: Add a role allowed to trigger archiving +- `[p]va removerole `: Remove an allowed role +- `[p]va listroles`: List allowed roles ### Video Settings -``` -/videoarchiver setformat mp4 # Set video format -/videoarchiver setquality 1080 # Set max quality (pixels) -/videoarchiver setmaxsize 8 # Set max size (MB, default 8MB) -/videoarchiver toggledelete # Toggle file cleanup -``` +- `[p]va setformat `: Set video format (e.g., mp4, webm) +- `[p]va setquality `: Set maximum video quality (e.g., 1080) +- `[p]va setmaxsize `: Set maximum file size in MB +- `[p]va setconcurrent `: Set number of concurrent downloads (1-5) ### Message Settings -``` -/videoarchiver setduration 24 # Set message duration (hours) -/videoarchiver settemplate "Archived video from {author}\nOriginal: {original_message}" -/videoarchiver enablesites # Configure allowed sites -``` +- `[p]va setduration `: Set how long to keep archive messages +- `[p]va settemplate