Skip to content

benjaminraffetseder/bunny-stream-sync

Repository files navigation

Bunny Stream Sync Module

This custom Drupal module provides automatic synchronization between Bunny Stream library and Drupal media entities.

Features

  • One-click sync: Sync all videos from a Bunny Stream library to Drupal media entities
  • Automatic detection: Detects existing media entities and updates them if needed
  • Error handling: Comprehensive error handling and logging
  • Admin interface: Easy-to-use admin form for selecting and syncing libraries

Requirements

  • Drupal 10
  • Bunny Stream module
  • Configured Bunny Stream library with API key

Installation

  1. Place this module in web/modules/custom/bunny_stream_sync/
  2. Enable the module: drush en bunny_stream_sync
  3. Grant the "Administer Bunny Stream Sync" permission to appropriate roles

Usage

  1. Navigate to Configuration > Services > Bunny Stream > Sync Library
  2. Select the Bunny Stream library you want to sync
  3. Click "Sync Library" button
  4. The module will:
    • Fetch all videos from the selected Bunny Stream library
    • Create new media entities for videos that don't exist in Drupal
    • Update existing media entities if their titles have changed
    • Skip videos that are already up-to-date

Configuration

Before using the sync functionality, ensure you have:

  1. Bunny Stream Library configured: Go to Configuration > Services > Bunny Stream > Library and create a library with your API key
  2. Media Type configured: Create a media type that uses the "Bunny Stream" source and select your library

Permissions

  • administer bunny_stream_sync: Access to sync Bunny Stream library with Drupal media entities

API Integration

The module uses the Bunny Stream API endpoint:

  • GET https://video.bunnycdn.com/library/{libraryId}/videos - Lists all videos in a library

Logging

All sync operations are logged to the bunny_stream_sync channel. Check the Drupal logs for detailed information about sync operations.

Troubleshooting

  • No libraries found: Ensure you have created at least one Bunny Stream library configuration
  • API errors: Verify your API key is correct and has proper permissions
  • No media type found: Create a media type that uses the Bunny Stream source and is configured for your library

About

This Drupal module provides automatic synchronization between Bunny Stream library and Drupal media entities.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages