Ejemplo n.º 1
0
 /**
  * Render a list page
  *
  * @param Song $song
  * The song that is currently playing
  *
  * @return string
  * The HTML of the rendered page
  */
 public static function render($song, $previous)
 {
     // instantiate the template engine
     $parser = new Rain\Tpl();
     // get the image data for the song
     $image_data = Song::getImageData($song['Artist'], $song['Album'], 320);
     // assign the values to the template parser
     $parser->assign(array('image' => $image_data, 'song' => $song, 'volume' => Music::getVolume(), 'previous' => $previous));
     // return the HTML
     return $parser->draw("now-playing-page", true);
 }
Ejemplo n.º 2
0
 public static function updateNowPlaying()
 {
     // get the current status of the player
     $status = static::getStatus();
     $results['volume'] = $status['values']['volume'];
     $results['state'] = $status['values']['state'];
     // get the current song
     $song = static::getCurrentSong();
     $results['title'] = $song ? $song['Title'] : null;
     $results['artist'] = $song ? $song['Artist'] : null;
     $results['album'] = $song ? $song['Album'] : null;
     // get the image data
     $results['artwork'] = Song::getImageData($song['Artist'], $song['Album'], 320);
     // return the data
     return $results;
 }