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 | | 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! | | **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, and direct integration with Overseerr's API. Requires a running Overseerr instance and API key. | | **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, 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. | | **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 ## Installation
@@ -51,7 +51,7 @@ Replace `[p]` with your bot's prefix.
### Additional Requirements ### 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: - **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 ```bash
@@ -59,6 +59,6 @@ Replace `[p]` with your bot's prefix.
[p]overseerr apikey <your-api-key> [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). 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 # 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 ## 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: 1. Set the birthday role:
``` ```
[p]birthdayset role @Birthday [p]setrole @Birthday
``` ```
or 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. **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,39 +46,40 @@ 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: 2. Add roles that can use the birthday command:
``` ```
[p]birthdayset addrole @Moderator [p]addrole @Moderator
``` ```
or or
``` ```
/birthdayset addrole @Moderator /addrole @Moderator
``` ```
3. (Optional) Set the timezone for role expiration: 3. (Optional) Set the timezone for role expiration:
``` ```
[p]birthdayset timezone America/New_York [p]settimezone America/New_York
``` ```
or or
``` ```
/birthdayset timezone America/New_York /settimezone America/New_York
``` ```
4. (Optional) Set a specific channel for birthday announcements: 4. (Optional) Set a specific channel for birthday announcements:
``` ```
[p]birthdayset channel #birthdays [p]setchannel #birthdays
``` ```
or or
``` ```
/birthdayset channel #birthdays /setchannel #birthdays
``` ```
If not set, the birthday message will be sent in the channel where the command is used. If not set, the birthday message will be sent in the channel where the command is used.
## Usage ## Usage
To assign the birthday role to a user: To assign the birthday role to a user, you can use any of these methods:
1. Command:
``` ```
[p]birthday @User [p]birthday @User
``` ```
@@ -87,29 +88,38 @@ or
/birthday @User /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. 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.
## Features ## Features
- Assigns a special birthday role to users - Assigns a special birthday role to users
- Sends a celebratory message with random cake (or pie) emojis - 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 - Configurable timezone for role expiration
- Option to set a specific channel for birthday announcements (defaults to the channel where the command is used) - 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 - 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 - 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 ## Commands
All commands support both prefix and slash command syntax: All commands support both prefix and slash command syntax:
- `[p]birthdayset role` or `/birthdayset role`: Set the birthday role ### Admin Commands
- `[p]birthdayset addrole` or `/birthdayset addrole`: Add a role that can use the birthday command - `[p]setrole` or `/setrole`: Set the birthday role
- `[p]birthdayset removerole` or `/birthdayset removerole`: Remove a role from using the birthday command - `[p]addrole` or `/addrole`: Add a role that can use the birthday command
- `[p]birthdayset timezone` or `/birthdayset timezone`: Set the timezone for the birthday role expiration - `[p]removerole` or `/removerole`: Remove a role from using the birthday command
- `[p]birthdayset channel` or `/birthdayset channel`: Set the channel for birthday announcements - `[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 - `[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 - `[p]bdaycheck` or `/bdaycheck`: Check upcoming birthday role removal tasks
## Support ## Support

View File

@@ -27,41 +27,42 @@ To install this cog, follow these steps:
Replace `[p]` with your bot's prefix. Replace `[p]` with your bot's prefix.
## Setup ## 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: 1. Set the Overseerr URL:
``` ```
[p]overseerr url https://your.overseerr.instance [p]seturl https://your.overseerr.instance
``` ```
or or
``` ```
/overseerr url https://your.overseerr.instance /seturl https://your.overseerr.instance
``` ```
2. Set the Overseerr API key: 2. Set the Overseerr API key:
``` ```
[p]overseerr apikey your_api_key [p]setapikey your_api_key
``` ```
or 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 or
``` ```
/overseerr adminrole @OverseerrAdmins /setadminrole "Overseerr Admin"
``` ```
## Usage ## Usage
Users can request movies or TV shows using: ### Requesting Media
To search for and request media:
``` ```
[p]request Movie/TV Show Name [p]request Movie/TV Show Name
@@ -71,6 +72,15 @@ or
/request Movie/TV Show Name /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: Admins can approve requests using:
``` ```
@@ -82,39 +92,44 @@ or
``` ```
## Features ## 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. - **Interactive Media Selection**: Users get a dropdown menu of search results with detailed information
- **Media availability status**: The cog checks if media is already available or has been requested before making new requests. - **Smart Status Checking**: Automatically checks if media is already available or requested
- **Approve requests**: Admins with the appropriate role can approve Overseerr requests within Discord. - **Detailed Results**: Shows media type, release date, and availability status for each result
- **Full slash command support**: All commands can be used as both traditional prefix commands and Discord slash commands. - **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 ## Commands
All commands support both prefix and slash command syntax: All commands support both prefix and slash command syntax:
### Admin Commands ### Admin Commands
- **`[p]overseerr url <url>`** or **`/overseerr url <url>`** - **`[p]seturl <url>`** or **`/seturl <url>`**
- Set the Overseerr URL for the bot to communicate with Overseerr. - Set the Overseerr URL for API communication
- Example: `[p]overseerr url https://your-overseerr-url` or `/overseerr url https://your-overseerr-url` - Example: `[p]seturl https://your-overseerr-url` or `/seturl https://your-overseerr-url`
- **`[p]overseerr apikey <apikey>`** or **`/overseerr apikey <apikey>`** - **`[p]setapikey <apikey>`** or **`/setapikey <apikey>`**
- Set the Overseerr API Key, retrieved from `https://your-overseerr-url/settings`. - Set the Overseerr API Key (found in your Overseerr settings)
- Example: `[p]overseerr apikey 4OK6WLU8Fv2T...` or `/overseerr apikey 4OK6WLU8Fv2T...` - Example: `[p]setapikey 4OK6WLU8Fv2T...` or `/setapikey 4OK6WLU8Fv2T...`
- **`[p]overseerr adminrole <role_name>`** or **`/overseerr adminrole <role_name>`** - **`[p]setadminrole <role_name>`** or **`/setadminrole <role_name>`**
- Set the name of the admin role that is allowed to approve Overseerr requests. - Set the admin role for request approvals
- Example: `[p]overseerr adminrole @Overseerr Admin` or `/overseerr adminrole @Overseerr Admin` - Example: `[p]setadminrole "Overseerr Admin"` or `/setadminrole "Overseerr Admin"`
### User Commands ### User Commands
- **`[p]request <media name>`** or **`/request <media name>`** - **`[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` - Example: `[p]request The Matrix` or `/request The Matrix`
- **`[p]approve <request_id>`** or **`/approve <request_id>`** - **`[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` - Example: `[p]approve 123` or `/approve 123`
## Support ## Support
If you encounter any issues or have questions, please open an issue on the [GitHub repository](https://github.com/pacnpal/Pac-cogs). 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 ## Features
- Automatically detects and downloads videos from monitored channels - **Automatic Video Processing**
- Supports multiple video hosting platforms through yt-dlp - Monitors specified channels for videos
- Enhanced queue system with priority processing and performance metrics - Supports multiple video platforms through yt-dlp
- Hardware-accelerated compression (NVIDIA, AMD, Intel, ARM)
- Configurable video quality and format - Configurable video quality and format
- Role-based access control - Automatic file size optimization for Discord limits
- Automatic file cleanup
- Hardware-accelerated video processing (when available) - **Enhanced Queue System**
- Customizable notification messages - Priority-based processing
- Queue persistence across bot restarts - Queue persistence across bot restarts
- Full slash command support for all commands - Performance metrics tracking
- Automatic cleanup and memory management
- Real-time queue status monitoring
- Detailed performance analytics
## File Structure - **Channel Management**
- Flexible channel monitoring (specific channels or all)
- Separate archive, notification, and log channels
- Customizable message templates
- Configurable message duration
The cog is organized into several modules for better maintainability: - **Access Control**
- Role-based permissions
### Core Files - Site-specific enabling/disabling
- `video_archiver.py`: Main cog class and entry point - Admin-only configuration commands
- `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
## Installation ## Installation
1. Install the cog using Red's cog manager: 1. Install the cog:
```bash ```bash
[p]repo add videoarchiver <repository_url> [p]repo add Pac-cogs https://github.com/pacnpal/Pac-cogs
[p]cog install videoarchiver [p]cog install Pac-cogs videoarchiver
``` ```
2. Load the cog: 2. Load the cog:
@@ -56,183 +43,96 @@ The cog is organized into several modules for better maintainability:
[p]load videoarchiver [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 ### Core Settings
- Set the archive channel: - **`setchannel <channel>`**: Set the archive channel
``` - **`setnotification <channel>`**: Set the notification channel
[p]va setchannel <channel> - **`setlogchannel <channel>`**: Set the log channel for errors
``` - **`setformat <mp4|webm>`**: Set video format
or - **`setquality <144-4320>`**: Set maximum video quality (in pixels)
``` - **`setmaxsize <1-100>`**: Set maximum file size (in MB)
/va setchannel <channel> - **`setconcurrent <1-5>`**: Set number of concurrent downloads
```
- Set the notification channel: ### Channel Monitoring
``` - **`addmonitor [channel]`**: Add channel to monitor (empty for all channels)
[p]va setnotification <channel> - **`removemonitor <channel>`**: Remove channel from monitoring
``` - **`toggledelete`**: Toggle deletion of local files after reposting
or
```
/va setnotification <channel>
```
- Set the log channel: ### Message Configuration
``` - **`setduration <0-720>`**: Set message duration in hours (0 for permanent)
[p]va setlogchannel <channel> - **`settemplate <template>`**: Set message template using {author}, {url}, {original_message}
```
or
```
/va setlogchannel <channel>
```
- Add/remove a monitored channel:
```
[p]va addmonitor <channel>
[p]va removemonitor <channel>
```
or
```
/va addmonitor <channel>
/va removemonitor <channel>
```
### Role Management ### Role Management
- Add/remove allowed roles: - **`addrole [role]`**: Add allowed role (empty for @everyone)
``` - **`removerole <role>`**: Remove allowed role
[p]va addrole <role> - **`listroles`**: List allowed roles
[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
```
### Site Management ### Site Management
- Manage supported sites: - **`enablesites [sites...]`**: Enable specific sites (empty for all)
``` - **`listsites`**: List available and enabled sites
[p]va enablesites [sites...]
[p]va listsites
```
or
```
/va enablesites [sites...]
/va listsites
```
### Queue Management ### Queue Management
- Manage the processing queue: - **`queue`**: Show current queue status with basic metrics
``` - **`queuemetrics`**: Show detailed queue performance metrics
[p]va queue - **`clearqueue`**: Clear the video processing queue
[p]va clearqueue
[p]va queuemetrics
```
or
```
/va queue
/va clearqueue
/va queuemetrics
```
### Update Management ### System Management
- Manage yt-dlp updates: - **`updateytdlp`**: Update yt-dlp to latest version
``` - **`toggleupdates`**: Toggle update notifications
[p]va updateytdlp
[p]va toggleupdates
```
or
```
/va updateytdlp
/va toggleupdates
```
## Technical Details ## Queue System
### Enhanced Queue System The enhanced queue system provides:
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
### Queue Metrics ### Basic Metrics
The queue system tracks various performance metrics: - Pending/Processing/Completed/Failed counts
- Total processed videos - Success rate percentage
- Success/failure rates
- Average processing time - Average processing time
### Detailed Metrics
- Total processed videos
- Total failures
- Peak memory usage - Peak memory usage
- Queue size per guild/channel - Last cleanup time
- Processing history - Real-time queue state
- Cleanup statistics
### Configuration Management ## Message Templates
- Settings are stored per guild
- Supports hot-reloading of configurations You can customize archive messages using these variables:
- Automatic validation of settings - `{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 - Comprehensive error logging
- Automatic retry mechanisms with configurable attempts - Dedicated log channel for issues
- Guild-specific error reporting - Automatic retry mechanism
- Detailed failure tracking - Queue persistence across restarts
- Detailed error messages
### 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
## Support ## 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).