8.7 KiB
8.7 KiB
AE Anons - Automated After Effects Announcement Generator
Automated pipeline for generating sports announcements using After Effects templates via Nexrender, with data sourced from Synology Office spreadsheets.
Overview
AE Anons automates the creation of broadcast announcement videos by:
- Connecting to Synology NAS to retrieve schedule data from Office spreadsheets (.osheet)
- Parsing Excel data containing sports events, teams, channels and timing information
- Generating Nexrender jobs with appropriate templates and assets
- Monitoring render completion and managing output files
Features
- Synology Integration: Seamless authentication and file retrieval from Synology NAS
- Office Spreadsheet Export: Automatic conversion of .osheet files to Excel format
- Flexible Data Parsing: Dynamic sheet parsing with header detection
- Multi-variant Generation: Creates "Today", "Tomorrow" and dated variants for each announcement
- Smart Logo Management: Automatic logo resolution and scaling based on team/sport associations
- Nexrender Job Orchestration: Automated job submission, monitoring and cleanup
- Professional Logging: Structured logging with configurable verbosity levels
- Environment-based Configuration: All settings managed via
.envfile
Prerequisites
- Rust 1.70 or higher
- Access to Synology NAS with File Station and Office enabled
- Nexrender server instance
- After Effects templates configured on render nodes
Installation
1. Clone the Repository
git clone https://github.com/your-org/ae_anons.git
cd ae_anons
2. Build the Project
bash
cargo build --release
The binary will be available at target/release/ae_anons
3. Configure Environment
Create a .env file in the project root:
env
NAS_FQDN=https://your-synology-nas.example.com:5001
NAS_USER=service_account
NAS_PASS=secure_password
NAS_FILE=/Team Folder/Broadcast/Auto_Anons/schedule.osheet
NEXRENDER_API_URL=http://nexrender-server:3000/api/v1/jobs
OUTPUT_FOLDER=//file-server/edit/Auto_Anons
RUST_LOG=info
See Configuration section for detailed options.
Usage
Basic Execution
bash
# Run with default configuration
./target/release/ae_anons
# Run with custom log level
RUST_LOG=debug ./target/release/ae_anons
# Run with specific .env file
dotenv -f /path/to/.env.production run ./target/release/ae_anons
Development Mode
bash
cargo run
Logging Levels
Control output verbosity via RUST_LOG environment variable:
error - Only critical errors
warn - Warnings and errors
info - General operational messages (default)
debug - Detailed processing information
trace - Full debugging with API call details
bash
RUST_LOG=debug cargo run
Configuration
Environment Variables
Variable Required Default Description
NAS_FQDN Yes - Synology NAS URL with protocol and port
NAS_USER Yes - Synology account username
NAS_PASS Yes - Synology account password
NAS_FILE Yes - Full path to .osheet file on NAS
NEXRENDER_API_URL
OUTPUT_FOLDER Network path for rendered videos
RUST_LOG No info Logging verbosity level
Spreadsheet Structure
The input Excel file (converted from .osheet) must contain the following sheets:
Start Sheet
Main data source for announcements generation.
Column Description Example
STATE Processing flag FALSE (active), TRUE (skip)
SPORT Sport category Футбол, Хоккей
LEAGUE League name Премьер-лига
TEAM A Home team Спартак#FC Spartak#150
TEAM B Away team Зенит#FC Zenit#150
CHANEL Broadcast channel Матч ТВ
TIME Event time 19:30
DATA Event date 15.04.2026
SPORT Sheet
Mapping between sports and their video pack templates.
Column Description
SPORT Sport identifier
LINK Path to video pack file
TEAMS Sheet
Team logo registry with sport associations.
Column Description
TEAM Team identifier
SPORT Associated sport
LINK Path to team logo file
CHANELL Sheet
Channel logo mappings.
Column Description
CHANELL Channel name
LINK Path to channel logo file
Team Name Format
Team names can include resolution hints using hash separators:
text
Display Name#Search Key#Target Size
Example: Спартак#FC Spartak#150
Спартак - Display name in graphics
FC Spartak - Key for logo lookup
150 - Target size in pixels for logo scaling
Output Files
JSON Exports
During processing, JSON representations of the workbook are saved:
{filename}_workbook.json - Complete workbook structure
{filename}_{SheetName}.json - Individual sheet data
Rendered Videos
Output videos are saved to OUTPUT_FOLDER with naming pattern:
text
YYYYMMDD_Sport_League_TeamA_TeamB_Channel[_Variant].mp4
Examples:
20260415_Футбол_Премьер-лига_Спартак_Зенит_Матч-ТВ.mp4 (Base version)
20260415_Футбол_Премьер-лига_Спартак_Зенит_Матч-ТВ_Today.mp4
20260415_Футбол_Премьер-лига_Спартак_Зенит_Матч-ТВ_Tomorrow.mp4
Workflow
Authentication: Connects to Synology NAS using provided credentials
File Retrieval: Locates and exports the specified .osheet file as Excel
Data Parsing: Reads all sheets and structures the data
Asset Resolution: Matches sports, teams and channels with their visual assets
Job Generation: Creates Nexrender jobs for each active row with variants
Cleanup: Removes completed/failed jobs from previous runs
Submission: Sends jobs to Nexrender API
Monitoring: Tracks job progress until completion
Logout: Terminates Synology session
After Effects Template Requirements
Templates must be pre-configured on render nodes with specific layer names:
Template Types
Template File Use Case
Double Team PackShot_DOUBLE.aepx Matches with two teams
Single Team PackShot_SINGLE.aepx Single team announcements
Required Layers
Layer Name Type Description
DATA Text Date display (auto-adjusted)
TIME / TIME_H / TIME_M Text Time display
LEAGUE Text League name
SPORT Text Sport category
TEAMS Text Combined team names
TEAM_A_LOGO Image Home team logo
TEAM_B_LOGO Image Away team logo
CHANELL Image Channel logo
TOP Video Sport pack overlay
Composition Settings
Composition name: pack
Output module: Start_h264
Output format: mp4
Troubleshooting
Common Issues
Connection to NAS failed
Verify NAS_FQDN includes protocol and port (e.g., https://nas.example.com:5001)
Check network connectivity to NAS
Ensure File Station and Office services are enabled
File not found
Verify the path in NAS_FILE exactly matches the Synology Drive path
Path should start with /Team Folder/ for team folders
Check file permissions for the service account
Nexrender job submission fails
Confirm Nexrender server is accessible
Verify NEXRENDER_API_URL is correct
Check that template files exist on render nodes
Debug Mode
Enable debug logging for detailed troubleshooting:
bash
RUST_LOG=debug ./target/release/ae_anons
This will output:
API request/response details
Sheet parsing information
Job creation details
Asset resolution process
Performance Considerations
Large Spreadsheets: Processing limited to 10,000 rows per sheet
Network Latency: File downloads from NAS may take time for large files
Concurrent Jobs: Nexrender handles job queuing internally
Memory Usage: Excel parsing keeps entire workbook in memory
Security Notes
Store credentials only in .env file (excluded from git)
Use dedicated service accounts with minimal required permissions
Synology sessions are properly terminated after execution
HTTPS recommended for NAS connections in production
Development
Running Tests
bash
cargo test
Code Structure
text
src/
├── main.rs # Application entry point and orchestration
├── config.rs # Configuration management
├── nexrender.rs # Nexrender job generation and structures
└── synology.rs # Synology API client
Adding New Features
Extend JobData in nexrender.rs for new data fields
Update sheet parsing logic if new columns are required
Add corresponding After Effects layers to templates
Update to_nexrender_job() method with new asset mappings
Dependencies
Crate Version Purpose
reqwest 0.12 HTTP client for API communication
serde / serde_json 1.0 JSON serialization
calamine 0.26 Excel file parsing
chrono 0.4 Date/time handling
tokio 1.0 Async runtime
dotenv 0.15 Environment configuration
log / env_logger 0.4 Logging infrastructure
thiserror 2.0 Error type definitions
anyhow 1.0 Error handling
License
[Specify your license here]
Support
For issues and feature requests, please contact:
[Your Team Email]
[Internal Documentation Link]
Changelog
v0.1.0
Initial release
Synology Office integration
Basic Nexrender job generation
Excel parsing with dynamic sheet detection
Multi-variant job creation