Update READMEs

This commit is contained in:
pacnpal
2024-11-15 01:28:06 +00:00
parent 190e689919
commit dccd16e776
4 changed files with 179 additions and 254 deletions

View File

@@ -6,9 +6,9 @@ Welcome to **Pac-cogs**, a collection of custom cogs for [Red](https://github.co
| 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, 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, and direct integration with Overseerr's API. 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, role-based permissions, and support for multiple video platforms via yt-dlp. Automatically compresses videos to meet Discord's file size limits while maintaining quality. |
| **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, enhanced queue system with priority processing, role-based permissions, automatic file cleanup, queue persistence across bot restarts, and support for multiple video platforms via yt-dlp. Automatically compresses videos to meet Discord's file size limits while maintaining quality. |
## Installation
@@ -51,7 +51,7 @@ Replace `[p]` with your bot's prefix.
### Additional Requirements
- **Birthday**: No additional requirements. Just configure the birthday role, timezone, and allowed roles after installation.
- **Birthday**: No additional requirements. Just configure the birthday role, timezone, and allowed roles after installation. Supports both traditional commands, slash commands, and context menu interactions.
- **Overseerr**: Requires a running [Overseerr](https://overseerr.dev/) instance and API key. You'll need to configure the Overseerr URL and API key after installation using:
```bash
@@ -59,6 +59,6 @@ Replace `[p]` with your bot's prefix.
[p]overseerr apikey <your-api-key>
```
- **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.
- **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 an enhanced queue system with priority processing, performance metrics, and automatic cleanup.
For more details on setting up and managing Red, visit the [Red documentation](https://docs.discord.red).

View File

@@ -1,6 +1,6 @@
# Birthday Cog for Red-DiscordBot
This cog allows you to assign a special role to users on their birthday and send them a celebratory message with cake (or pie) emojis! Supports both traditional prefix commands and slash commands.
This cog allows you to assign a special role to users on their birthday and send them a celebratory message with cake (or pie) emojis! Supports both traditional prefix commands, slash commands, and context menu commands.
## Installation
@@ -34,11 +34,11 @@ Before using the cog, you need to set it up. You can use either prefix commands
1. Set the birthday role:
```
[p]birthdayset role @Birthday
[p]setrole @Birthday
```
or
```
/birthdayset role @Birthday
/setrole @Birthday
```
**Note:** The bot's role must be above the birthday role in the server's role hierarchy, but users assigning the birthday role do not need to have a role above it.
@@ -46,46 +46,50 @@ Before using the cog, you need to set it up. You can use either prefix commands
2. Add roles that can use the birthday command:
```
[p]birthdayset addrole @Moderator
[p]addrole @Moderator
```
or
```
/birthdayset addrole @Moderator
/addrole @Moderator
```
3. (Optional) Set the timezone for role expiration:
```
[p]birthdayset timezone America/New_York
[p]settimezone America/New_York
```
or
```
/birthdayset timezone America/New_York
/settimezone America/New_York
```
4. (Optional) Set a specific channel for birthday announcements:
```
[p]birthdayset channel #birthdays
[p]setchannel #birthdays
```
or
```
/birthdayset channel #birthdays
/setchannel #birthdays
```
If not set, the birthday message will be sent in the channel where the command is used.
## Usage
To assign the birthday role to a user:
To assign the birthday role to a user, you can use any of these methods:
```
[p]birthday @User
```
or
```
/birthday @User
```
1. Command:
```
[p]birthday @User
```
or
```
/birthday @User
```
2. Context Menu:
Right-click on a user and select "Apps > Give Birthday Role"
This will assign the birthday role to the user and send a celebratory message with random cake (or pie) emojis. The role will be automatically removed at midnight in the specified timezone.
@@ -93,23 +97,29 @@ This will assign the birthday role to the user and send a celebratory message wi
- Assigns a special birthday role to users
- Sends a celebratory message with random cake (or pie) emojis
- Automatically removes the birthday role at midnight, temporarily stores so tasks will complete even if cog is reloaded
- Automatically removes the birthday role at midnight
- Configurable timezone for role expiration
- Option to set a specific channel for birthday announcements (defaults to the channel where the command is used)
- Restricts usage of the birthday command to specified roles
- Users can assign the birthday role without needing a role higher than it in the hierarchy
- Full slash command support for all commands
- Full slash command and context menu support
- Persistent birthday role removal scheduling (survives bot restarts)
- Birthday role removal task checking
## Commands
All commands support both prefix and slash command syntax:
- `[p]birthdayset role` or `/birthdayset role`: Set the birthday role
- `[p]birthdayset addrole` or `/birthdayset addrole`: Add a role that can use the birthday command
- `[p]birthdayset removerole` or `/birthdayset removerole`: Remove a role from using the birthday command
- `[p]birthdayset timezone` or `/birthdayset timezone`: Set the timezone for the birthday role expiration
- `[p]birthdayset channel` or `/birthdayset channel`: Set the channel for birthday announcements
### Admin Commands
- `[p]setrole` or `/setrole`: Set the birthday role
- `[p]addrole` or `/addrole`: Add a role that can use the birthday command
- `[p]removerole` or `/removerole`: Remove a role from using the birthday command
- `[p]settimezone` or `/settimezone`: Set the timezone for the birthday role expiration
- `[p]setchannel` or `/setchannel`: Set the channel for birthday announcements
### User Commands
- `[p]birthday` or `/birthday`: Assign the birthday role to a user
- Context Menu > "Give Birthday Role": Right-click a user to assign the birthday role
- `[p]bdaycheck` or `/bdaycheck`: Check upcoming birthday role removal tasks
## Support

View File

@@ -27,41 +27,42 @@ To install this cog, follow these steps:
Replace `[p]` with your bot's prefix.
## Setup
Before using the cog, you'll need to configure it. You can use either prefix commands or slash commands:
Before using the cog, you need to configure it. You can use either prefix commands or slash commands:
1. Set the Overseerr URL:
```
[p]overseerr url https://your.overseerr.instance
[p]seturl https://your.overseerr.instance
```
or
```
/overseerr url https://your.overseerr.instance
/seturl https://your.overseerr.instance
```
2. Set the Overseerr API key:
```
[p]overseerr apikey your_api_key
[p]setapikey your_api_key
```
or
```
/overseerr apikey your_api_key
/setapikey your_api_key
```
3. Set the admin role allowed to approve requests:
3. (Optional) Set the admin role name for approvals:
```
[p]overseerr adminrole @OverseerrAdmins
[p]setadminrole "Overseerr Admin"
```
or
```
/overseerr adminrole @OverseerrAdmins
/setadminrole "Overseerr Admin"
```
## Usage
Users can request movies or TV shows using:
### Requesting Media
To search for and request media:
```
[p]request Movie/TV Show Name
@@ -71,6 +72,15 @@ or
/request Movie/TV Show Name
```
This will:
1. Search for the media on Overseerr
2. Display an interactive select menu with up to 25 results
3. Show media type, release date, and current status (Available/Not Available/Requested) for each result
4. Allow you to select the desired title from the menu
5. Automatically check if the media is already available or requested before submitting a new request
### Approving Requests
Admins can approve requests using:
```
@@ -82,39 +92,44 @@ or
```
## Features
- **Set Overseerr URL and API key**: Admins can configure the Overseerr URL and API key for API interactions.
- **Search and request media**: Users can search for movies or TV shows and request them directly in Discord.
- **Media availability status**: The cog checks if media is already available or has been requested before making new requests.
- **Approve requests**: Admins with the appropriate role can approve Overseerr requests within Discord.
- **Full slash command support**: All commands can be used as both traditional prefix commands and Discord slash commands.
- **Interactive Media Selection**: Users get a dropdown menu of search results with detailed information
- **Smart Status Checking**: Automatically checks if media is already available or requested
- **Detailed Results**: Shows media type, release date, and availability status for each result
- **Admin Approval System**: Role-based approval system for managing requests
- **Full API Integration**: Direct integration with Overseerr's API for real-time status updates
- **Hybrid Commands**: Supports both traditional prefix commands and Discord slash commands
- **Error Handling**: Comprehensive error messages and user feedback
- **Permission Management**: Role-based access control for admin functions
## Commands
All commands support both prefix and slash command syntax:
### Admin Commands
- **`[p]overseerr url <url>`** or **`/overseerr url <url>`**
- Set the Overseerr URL for the bot to communicate with Overseerr.
- Example: `[p]overseerr url https://your-overseerr-url` or `/overseerr url https://your-overseerr-url`
- **`[p]seturl <url>`** or **`/seturl <url>`**
- Set the Overseerr URL for API communication
- Example: `[p]seturl https://your-overseerr-url` or `/seturl https://your-overseerr-url`
- **`[p]overseerr apikey <apikey>`** or **`/overseerr apikey <apikey>`**
- Set the Overseerr API Key, retrieved from `https://your-overseerr-url/settings`.
- Example: `[p]overseerr apikey 4OK6WLU8Fv2T...` or `/overseerr apikey 4OK6WLU8Fv2T...`
- **`[p]setapikey <apikey>`** or **`/setapikey <apikey>`**
- Set the Overseerr API Key (found in your Overseerr settings)
- Example: `[p]setapikey 4OK6WLU8Fv2T...` or `/setapikey 4OK6WLU8Fv2T...`
- **`[p]overseerr adminrole <role_name>`** or **`/overseerr adminrole <role_name>`**
- Set the name of the admin role that is allowed to approve Overseerr requests.
- Example: `[p]overseerr adminrole @Overseerr Admin` or `/overseerr adminrole @Overseerr Admin`
- **`[p]setadminrole <role_name>`** or **`/setadminrole <role_name>`**
- Set the admin role for request approvals
- Example: `[p]setadminrole "Overseerr Admin"` or `/setadminrole "Overseerr Admin"`
### User Commands
- **`[p]request <media name>`** or **`/request <media name>`**
- Search for a movie or TV show and request it if it's not already available or requested.
- Search for and request movies or TV shows
- Displays an interactive select menu with detailed media information
- Automatically checks availability status
- Example: `[p]request The Matrix` or `/request The Matrix`
- **`[p]approve <request_id>`** or **`/approve <request_id>`**
- Approve a media request by its request ID (requires the admin role).
- Approve a media request (requires admin role)
- Example: `[p]approve 123` or `/approve 123`
## Support
If you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/pacnpal/Pac-cogs).

View File

@@ -1,54 +1,41 @@
# VideoArchiver Cog
# VideoArchiver Cog for Red-DiscordBot
A Red-DiscordBot cog for automatically archiving videos from monitored Discord channels. Supports both traditional prefix commands and Discord slash commands.
A powerful video archiving cog that automatically downloads and reposts videos from monitored channels. Features hardware-accelerated compression, multi-video processing, and support for multiple video platforms.
## Features
- 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
- Full slash command support for all commands
- **Automatic Video Processing**
- Monitors specified channels for videos
- Supports multiple video platforms through yt-dlp
- Hardware-accelerated compression (NVIDIA, AMD, Intel, ARM)
- Configurable video quality and format
- Automatic file size optimization for Discord limits
## File Structure
- **Enhanced Queue System**
- Priority-based processing
- Queue persistence across bot restarts
- Performance metrics tracking
- Automatic cleanup and memory management
- Real-time queue status monitoring
- Detailed performance analytics
The cog is organized into several modules for better maintainability:
- **Channel Management**
- Flexible channel monitoring (specific channels or all)
- Separate archive, notification, and log channels
- Customizable message templates
- Configurable message duration
### Core Files
- `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
- `exceptions.py`: Custom exception classes
### Utils Package
- `utils/video_downloader.py`: Video download and processing
- `utils/message_manager.py`: Message handling and cleanup
- `utils/file_ops.py`: File operations and secure deletion
- `utils/path_manager.py`: Path management utilities
- `utils/exceptions.py`: Utility-specific exceptions
### FFmpeg Package
- `ffmpeg/ffmpeg_manager.py`: FFmpeg configuration and management
- `ffmpeg/gpu_detector.py`: GPU capability detection
- `ffmpeg/video_analyzer.py`: Video analysis utilities
- `ffmpeg/encoder_params.py`: Encoding parameter optimization
- `ffmpeg/ffmpeg_downloader.py`: FFmpeg binary management
- `ffmpeg/exceptions.py`: FFmpeg-specific exceptions
- **Access Control**
- Role-based permissions
- Site-specific enabling/disabling
- Admin-only configuration commands
## Installation
1. Install the cog using Red's cog manager:
1. Install the cog:
```bash
[p]repo add videoarchiver <repository_url>
[p]cog install videoarchiver
[p]repo add Pac-cogs https://github.com/pacnpal/Pac-cogs
[p]cog install Pac-cogs videoarchiver
```
2. Load the cog:
@@ -56,183 +43,96 @@ The cog is organized into several modules for better maintainability:
[p]load videoarchiver
```
## Configuration
## Commands
Use the following commands to configure the cog. All commands support both prefix and slash command syntax:
All commands support both prefix (`[p]videoarchiver` or `[p]va`) and slash command (`/videoarchiver`) syntax:
### Channel Settings
- Set the archive channel:
```
[p]va setchannel <channel>
```
or
```
/va setchannel <channel>
```
### Core Settings
- **`setchannel <channel>`**: Set the archive channel
- **`setnotification <channel>`**: Set the notification channel
- **`setlogchannel <channel>`**: Set the log channel for errors
- **`setformat <mp4|webm>`**: Set video format
- **`setquality <144-4320>`**: Set maximum video quality (in pixels)
- **`setmaxsize <1-100>`**: Set maximum file size (in MB)
- **`setconcurrent <1-5>`**: Set number of concurrent downloads
- Set the notification channel:
```
[p]va setnotification <channel>
```
or
```
/va setnotification <channel>
```
### Channel Monitoring
- **`addmonitor [channel]`**: Add channel to monitor (empty for all channels)
- **`removemonitor <channel>`**: Remove channel from monitoring
- **`toggledelete`**: Toggle deletion of local files after reposting
- Set the log channel:
```
[p]va setlogchannel <channel>
```
or
```
/va setlogchannel <channel>
```
- Add/remove a monitored channel:
```
[p]va addmonitor <channel>
[p]va removemonitor <channel>
```
or
```
/va addmonitor <channel>
/va removemonitor <channel>
```
### Message Configuration
- **`setduration <0-720>`**: Set message duration in hours (0 for permanent)
- **`settemplate <template>`**: Set message template using {author}, {url}, {original_message}
### Role Management
- Add/remove allowed roles:
```
[p]va addrole <role>
[p]va removerole <role>
[p]va listroles
```
or
```
/va addrole <role>
/va removerole <role>
/va listroles
```
### Video Settings
- Set video format and quality:
```
[p]va setformat <format>
[p]va setquality <pixels>
[p]va setmaxsize <MB>
[p]va setconcurrent <count>
```
or
```
/va setformat <format>
/va setquality <pixels>
/va setmaxsize <MB>
/va setconcurrent <count>
```
### Message Settings
- Configure message handling:
```
[p]va setduration <hours>
[p]va settemplate <template>
[p]va toggledelete
```
or
```
/va setduration <hours>
/va settemplate <template>
/va toggledelete
```
- **`addrole [role]`**: Add allowed role (empty for @everyone)
- **`removerole <role>`**: Remove allowed role
- **`listroles`**: List allowed roles
### Site Management
- Manage supported sites:
```
[p]va enablesites [sites...]
[p]va listsites
```
or
```
/va enablesites [sites...]
/va listsites
```
- **`enablesites [sites...]`**: Enable specific sites (empty for all)
- **`listsites`**: List available and enabled sites
### Queue Management
- Manage the processing queue:
```
[p]va queue
[p]va clearqueue
[p]va queuemetrics
```
or
```
/va queue
/va clearqueue
/va queuemetrics
```
- **`queue`**: Show current queue status with basic metrics
- **`queuemetrics`**: Show detailed queue performance metrics
- **`clearqueue`**: Clear the video processing queue
### Update Management
- Manage yt-dlp updates:
```
[p]va updateytdlp
[p]va toggleupdates
```
or
```
/va updateytdlp
/va toggleupdates
```
### System Management
- **`updateytdlp`**: Update yt-dlp to latest version
- **`toggleupdates`**: Toggle update notifications
## Technical Details
## Queue System
### Enhanced Queue System
The cog uses an advanced queue system with the following features:
- Priority-based processing (first URL in messages gets highest priority)
- Queue persistence across bot restarts
- Automatic memory management and cleanup
- Performance metrics tracking (success rate, processing times)
- Health monitoring with automatic issue detection
- Deadlock prevention
- Configurable cleanup intervals
- Size-limited queue to prevent memory issues
- Detailed status tracking per guild
The enhanced queue system provides:
### Queue Metrics
The queue system tracks various performance metrics:
- Total processed videos
- Success/failure rates
### Basic Metrics
- Pending/Processing/Completed/Failed counts
- Success rate percentage
- Average processing time
### Detailed Metrics
- Total processed videos
- Total failures
- Peak memory usage
- Queue size per guild/channel
- Processing history
- Cleanup statistics
- Last cleanup time
- Real-time queue state
### Configuration Management
- Settings are stored per guild
- Supports hot-reloading of configurations
- Automatic validation of settings
## Message Templates
You can customize archive messages using these variables:
- `{author}`: Original message author
- `{url}`: Original video URL
- `{original_message}`: Link to original message
Example template:
```
📥 Video archived from {author}
Original: {url}
Source: {original_message}
```
## Site Support
The cog supports all sites compatible with yt-dlp. Use `[p]va listsites` to see available sites and currently enabled ones.
## Performance
- Hardware acceleration automatically detected and utilized
- Configurable concurrent downloads (1-5)
- Automatic file size optimization
- Memory-efficient queue management
- Automatic cleanup of temporary files
## Error Handling
### Error Handling
- Comprehensive error logging
- Automatic retry mechanisms with configurable attempts
- Guild-specific error reporting
- Detailed failure tracking
### Performance Optimizations
- Hardware-accelerated video processing when available
- Efficient file handling with secure deletion
- Memory leak prevention through proper resource cleanup
- Automatic resource monitoring
- Periodic cleanup of old queue items
- Memory usage optimization
## Requirements
- Python 3.8 or higher
- FFmpeg
- yt-dlp
- Discord.py 2.0 or higher
- Red-DiscordBot V3
- psutil>=5.9.0
- Dedicated log channel for issues
- Automatic retry mechanism
- Queue persistence across restarts
- Detailed error messages
## Support
For issues and feature requests, please use the issue tracker on GitHub.
If you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/pacnpal/Pac-cogs).