<?php
  $pluginBaseUrl = 'https://github.com/mediaelement/mediaelement-plugins/raw/master/dist/';
  $plugins = ['airplay' => ['airplay.svg', 'airplay.png'], 
    'chromecast' => ['chromecast.svg', 'chromecast.png'], 
    'context-menu' => [], 
    'jump-forward' => ['jumpforward.svg', 'jumpforward.png'], 
    'skip-back' => ['skipback.svg', 'skipback.png']];

  $js = '';
  $css = '';
 
  foreach($plugins as $plugin => $resources) {
    $js .= file_get_contents($pluginBaseUrl . $plugin . '/' . $plugin . '.min.js');
    $css .= file_get_contents($pluginBaseUrl . $plugin . '/' . $plugin . '.min.css');

    foreach($resources as $resource) {
        file_put_contents('public/css/' . $resource,
            file_get_contents($pluginBaseUrl . $plugin . '/' . $resource));
    }
  }

  file_put_contents('public/js/mediaplayer_plugins.min.js', $js);
  file_put_contents('public/css/mediaplayer_plugins.min.css', $css);

?>
