예제 #1
0
     // Scrub it in
     $localplay = new Localplay(AmpConfig::get('localplay_controller'));
     $localplay->delete_instance($_REQUEST['instance']);
     $key = 'localplay_instance_' . $_REQUEST['instance'];
     $results[$key] = '';
     break;
 case 'repeat':
     // Make sure that they have access to do this again no clue
     if (!Access::check('localplay', '50')) {
         debug_event('DENIED', 'Attempted to set repeat without access', '1');
         exit;
     }
     // Scrub her in
     $localplay = new Localplay(AmpConfig::get('localplay_controller'));
     $localplay->connect();
     $localplay->repeat(make_bool($_REQUEST['value']));
     ob_start();
     $objects = $localplay->get();
     require_once AmpConfig::get('prefix') . UI::find_template('show_localplay_status.inc.php');
     $results['localplay_status'] = ob_get_contents();
     ob_end_clean();
     break;
 case 'random':
     // Make sure that they have access to do this
     if (!Access::check('localplay', '50')) {
         debug_event('DENIED', 'Attempted to set random without access', '1');
         exit;
     }
     // Scrub her in
     $localplay = new Localplay(AmpConfig::get('localplay_controller'));
     $localplay->connect();
예제 #2
0
 /**
  * create_localplay
  * This calls the Localplay API to add the URLs and then start playback
  */
 public function create_localplay()
 {
     $localplay = new Localplay(AmpConfig::get('localplay_controller'));
     $localplay->connect();
     $append = $_REQUEST['append'];
     if (!$append) {
         $localplay->delete_all();
     }
     foreach ($this->urls as $url) {
         $localplay->add_url($url);
     }
     if (!$append) {
         // We don't have metadata on Stream_URL to know its kind
         // so we check the content to know if it is democratic
         if (count($this->urls) == 1) {
             $furl = $this->urls[0];
             if (strpos($furl->url, "&demo_id=1") !== false && $furl->time == -1) {
                 // If democratic, repeat the song to get the next voted one.
                 debug_event('stream_playlist', 'Playing democratic on localplay, enabling repeat...', 5);
                 $localplay->repeat(true);
             }
         }
         $localplay->play();
     }
 }