From 609aecdc4e43a3171c9dd4f573ca714321c812af Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Sat, 16 Nov 2024 01:22:37 +0000 Subject: [PATCH] Updated default settings (video archiving enabled by default) New database functionality and commands Additional video format support (MKV) Message duration now in hours (0-168) Enhanced error handling and logging Queue persistence and management improvements Hardware acceleration updates More detailed command descriptions Improved performance & limitations documentation --- README.md | 43 +++++-- videoarchiver/README.md | 46 +++++--- videoarchiver/config_manager.py | 8 +- videoarchiver/core/base.py | 125 ++++++++++++++++++++- videoarchiver/processor/message_handler.py | 16 ++- 5 files changed, 205 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 78f3ac0..5dc5133 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,24 @@ Welcome to **Pac-cogs**, a collection of custom cogs for [Red](https://github.com/Cog-Creators/Red-DiscordBot). These cogs are designed to add extra functionality to your Red bot instance on Discord. -## Cogs Overview - -| Cog Name | Description | -|------------|--------------------------------------------------| -| **Birthday** | Assigns a special birthday role to users and sends a celebratory message with random cake or pie emojis. Features include: automatic role removal at midnight in configurable timezone, custom announcement channels, role-based command permissions, random cake/pie emoji generation, task persistence across bot restarts, context menu support (right-click user to assign role), birthday role removal task checking, and no hierarchy requirements for role assignment. Perfect for automated birthday celebrations! | -| **Overseerr** | Allows interaction with [Overseerr](https://overseerr.dev/) directly from Discord. Users can search for movies or TV shows, request them, and have admins approve requests. Features include: media availability checking, request status tracking, admin role configuration, direct integration with Overseerr's API, and full slash command support. Requires a running Overseerr instance and API key. | -| **VideoArchiver** | A powerful video archiving cog that automatically downloads and reposts videos from monitored channels. Features hardware-accelerated compression (NVIDIA, AMD, Intel, ARM), multi-video processing, modular queue system with priority processing and state persistence, role-based permissions, automatic file cleanup, and support for multiple video platforms via yt-dlp. The enhanced queue system provides metrics tracking, health monitoring, and efficient resource management while maintaining quality. New features include: video archive database for tracking and retrieving archived videos, detailed queue monitoring with real-time progress tracking, and comprehensive error handling with automatic recovery. | - ## Installation To install the cogs in this repository, follow these steps: 1. Ensure you have [Red](https://github.com/Cog-Creators/Red-DiscordBot) set up. 2. Add this repository to your Red instance: - ```bash [p]repo add Pac-cogs https://github.com/pacnpal/Pac-cogs ``` +3. Install the desired cog: + ```bash + [p]cog install Pac-cogs videoarchiver + ``` +4. Load the installed cog: + ```bash + [p]load videoarchiver + ``` + 3. Install the desired cog: @@ -59,6 +59,27 @@ Replace `[p]` with your bot's prefix. [p]overseerr apikey ``` -- **VideoArchiver**: The cog requires FFmpeg for video processing. The cog will attempt to download and manage FFmpeg automatically if it's not found on your system. The required Python packages (yt-dlp, ffmpeg-python, requests) will be installed automatically during cog installation. Features a modular queue system with priority processing, performance metrics, health monitoring, and automatic cleanup. The queue system maintains state across bot restarts and provides efficient resource management. +- **VideoArchiver**: The cog requires FFmpeg for video processing. The cog will attempt to download and manage FFmpeg automatically if it's not found on your system. The required Python packages (yt-dlp, ffmpeg-python, requests) will be installed automatically during cog installation. -For more details on setting up and managing Red, visit the [Red documentation](https://docs.discord.red). +## VideoArchiver Commands and Features + +The VideoArchiver cog now comes with enhanced features and a comprehensive set of slash commands for easy management. + +### Default Behavior +- Video archiving is enabled by default for new servers +- All channels are monitored by default (can be restricted using commands) +- All users can trigger archiving by default (can be restricted using commands) +- All video sites are supported by default (can be restricted using commands) + +### Core Commands +- `/archiver settings` - View all current settings +- `/archiver enable`, `/archiver disable` - Toggle video archiving +- `/archiver queue` - View the current processing queue + +### Channel Management +- `/archiver setchannel` - Set the archive channel +- `/archiver setlog` - Set the log channel +- `/archiver addchannel` - Add a channel to monitor +- `/archiver removechannel` - Remove a channel from monitoring + +### Video Settings diff --git a/videoarchiver/README.md b/videoarchiver/README.md index 6b2c39a..1c26e01 100644 --- a/videoarchiver/README.md +++ b/videoarchiver/README.md @@ -13,6 +13,7 @@ A powerful video archiving cog that automatically downloads and reposts videos f - Default maximum file size: 8MB - Default video format: MP4 - Default video quality: High + - Support for MP4, WebM, and MKV formats - **Video Archive Database** - Track and store archived video information @@ -21,6 +22,7 @@ A powerful video archiving cog that automatically downloads and reposts videos f - Optional database functionality (disabled by default) - Automatic database management and cleanup - Persistent video history tracking + - URL-based video lookup - **Modular Queue System** - Priority-based processing with state persistence @@ -29,8 +31,9 @@ A powerful video archiving cog that automatically downloads and reposts videos f - Automatic cleanup and memory optimization - Default concurrent downloads: 2 (configurable 1-5) - Maximum queue size: 1000 items - - Automatic retry on failures (3 attempts) + - Automatic retry on failures (3 attempts with 5-second delay) - Queue state persistence across bot restarts + - Enhanced error recovery - **Progress Tracking** - Real-time download progress monitoring @@ -40,18 +43,21 @@ A powerful video archiving cog that automatically downloads and reposts videos f - Memory usage monitoring - Success rate calculations - Automatic cleanup of temporary files + - Enhanced logging capabilities - **Channel Management** - Flexible channel monitoring (specific channels or all) - Separate archive, notification, and log channels - Customizable message templates - - Configurable message duration (default: 30 seconds) + - Configurable message duration (0-168 hours) + - Enhanced error logging - **Access Control** - Role-based permissions - Site-specific enabling/disabling - Admin-only configuration commands - Per-guild settings + - Enhanced permission checks ## Installation @@ -72,16 +78,21 @@ All commands support both prefix and slash command syntax: ### Core Video Archiver Commands (va_) - **`va_settings`**: Show current video archiver settings -- **`va_format `**: Set video format +- **`va_format `**: Set video format - **`va_quality <144-4320>`**: Set maximum video quality (in pixels) - **`va_maxsize <1-100>`**: Set maximum file size (in MB) - **`va_concurrent <1-5>`**: Set number of concurrent downloads - **`va_toggledelete`**: Toggle deletion of local files after reposting -- **`va_duration <0-720>`**: Set message duration in hours (0 for permanent) +- **`va_duration <0-168>`**: Set message duration in hours (0 for permanent) - **`va_template