Skip to content

Conversation

@nullable-eth
Copy link
Owner

🚀 SyncArr: High-Performance Plex Media Synchronization

📋 Overview

This PR introduces SyncArr, a robust Go application for synchronizing labeled movies and TV shows between Plex Media Servers. The current implementation focuses on high-performance file transfers and content discovery, with a foundation for comprehensive metadata synchronization.

✨ Features Implemented

🔄 6-Phase Synchronization Process

  • Phase 1-2: Content discovery from source Plex server using label-based filtering
  • Phase 3: High-performance file transfers using rsync with automatic directory creation
  • Phase 4: Destination Plex library refresh
  • Phase 5: Intelligent content matching between source and destination
  • Phase 6: Metadata synchronization framework (foundation implemented)

🚀 High-Performance File Transfer

  • rsync Integration: Fast, resumable file transfers with compression
  • SSH Authentication: Dual support for password (sshpass) and key-based authentication
  • Automatic Directory Creation: Creates destination directories before file transfer
  • Transfer Statistics: Detailed logging of transfer progress and completion times

🔧 Robust Infrastructure

  • Docker Ready: Containerized with Alpine Linux, includes rsync and sshpass
  • Structured Logging: JSON logging with configurable levels (DEBUG, INFO, WARN, ERROR)
  • Configuration Management: Environment variable-based configuration
  • Health Checks: Built-in validation and health monitoring
  • Error Handling: Comprehensive error handling with automatic recovery

🎯 Content Management

  • Label-Based Discovery: Finds media items with specific Plex labels (e.g., Sync2Secondary)
  • Intelligent Matching: Filename-based content matching between servers
  • Incremental Sync: Only processes new or changed content
  • Dry Run Mode: Test configurations without making changes

⚠️ Current Limitations

🔄 Metadata Synchronization Status

  • File Content Sync: ✅ Fully Implemented - Complete file transfer with rsync
  • Destination Metadata Sync: ⚠️ Currently Disabled - Framework exists but sync operations are not active

The metadata synchronization infrastructure is in place (Phase 6), including:

  • Metadata comparison logic for movies and TV shows
  • Support for titles, summaries, ratings, genres, labels, collections, artwork
  • Watched state synchronization framework
  • But actual metadata updates to destination server are currently disabled

🛠️ Technical Implementation

Core Components

  • Sync Orchestrator: Coordinates the entire 6-phase process
  • Content Discovery: Plex API integration for labeled content discovery
  • File Transfer: rsync-based transfer with SSH authentication
  • Content Matcher: Intelligent filename-based matching algorithm
  • Metadata Sync: Framework for comprehensive metadata synchronization (disabled)
  • Plex Client: Direct Plex API interactions with custom implementation

Authentication & Security

  • SSH Password Auth: Using sshpass for non-interactive authentication
  • SSH Key Auth: Traditional key-based authentication support
  • Secure Transfers: All file operations use encrypted SSH connections

Performance Optimizations

  • rsync Compression: Configurable compression levels
  • Concurrent Workers: Configurable worker pool for parallel operations
  • API Rate Limiting: Respectful Plex API usage
  • Transfer Batching: Efficient batch file transfers

📊 Current Workflow

  1. Discover labeled content from source Plex server
  2. Transfer media files using high-performance rsync
  3. Refresh destination Plex libraries
  4. Match source content to destination content
  5. Compare metadata (analysis only)
  6. Skip metadata updates (currently disabled)

🎯 Next Steps / Future Work

  • Enable destination metadata synchronization in Phase 6
  • Implement watched state sync between servers
  • Add custom poster/artwork sync capabilities
  • Enhance content matching with additional algorithms
  • Add content cleanup for removed items
  • Implement bandwidth throttling for transfers
  • Add web UI for monitoring and configuration

🐳 Deployment

Ready for production deployment via Docker with comprehensive configuration options:

services:
  syncarr:
    image: syncarr:latest
    environment:
      SYNC_LABEL: "Sync2Secondary"
      SOURCE_PLEX_HOST: "source-server"
      DEST_PLEX_HOST: "dest-server"
      OPT_SSH_USER: "mediauser"
      OPT_SSH_PASSWORD: "password"
    volumes:
      - "/media:/media/source:ro"

📝 Documentation

Includes comprehensive README with:

  • Quick start Docker Compose examples
  • Complete configuration reference
  • Troubleshooting guide with common issues
  • Architecture overview with diagrams
  • Development and contribution guidelines

Status: ✅ Ready for Review - File synchronization fully functional, metadata sync framework ready for activation

@nullable-eth nullable-eth force-pushed the file-syncing branch 4 times, most recently from b8b4fff to 0309efb Compare July 31, 2025 17:56
@nullable-eth nullable-eth changed the title feature: initial !: Initial release with file syncing Jul 31, 2025
@nullable-eth nullable-eth force-pushed the file-syncing branch 6 times, most recently from 0506f64 to bd034b4 Compare July 31, 2025 19:04
@nullable-eth nullable-eth merged commit 5fd045b into main Jul 31, 2025
4 checks passed
@nullable-eth nullable-eth deleted the file-syncing branch July 31, 2025 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants