Ejemplo n.º 1
0
 protected function _process(&$np)
 {
     $return_raw = $this->getUrl();
     if (empty($return_raw)) {
         return false;
     }
     $current_data = \DF\Export::XmlToArray($return_raw);
     $song_data = $current_data['SHOUTCASTSERVER'];
     $np['meta']['status'] = 'online';
     $np['meta']['bitrate'] = $song_data['BITRATE'];
     $np['meta']['format'] = $song_data['CONTENT'];
     $np['current_song'] = $this->getSongFromString($song_data['SONGTITLE'], '-');
     $u_list = (int) $song_data['UNIQUELISTENERS'];
     $t_list = (int) $song_data['CURRENTLISTENERS'];
     $np['listeners'] = array('current' => $this->getListenerCount($u_list, $t_list), 'unique' => $u_list, 'total' => $t_list);
     return true;
 }
Ejemplo n.º 2
0
 public static function fetch($url, $params = array())
 {
     $news_items = array();
     $author = self::getAccount($url);
     $http_params = array('type' => 'deviation', 'q' => 'by:' . $author . ' sort:time meta:all');
     $feed_url = 'http://backend.deviantart.com/rss.xml?' . http_build_query($http_params);
     $news_feed = @file_get_contents($feed_url);
     if ($news_feed) {
         $article_num = 0;
         $feed_array = \DF\Export::XmlToArray($news_feed);
         $items = $feed_array['rss']['channel'][0]['item'];
         foreach ((array) $items as $item) {
             if (!isset($item['media:thumbnail'])) {
                 continue;
             }
             $news_items[] = array('guid' => 'deviantart_' . md5($item['link']), 'media_format' => 'image', 'timestamp' => strtotime($item['pubDate']), 'title' => $item['title'], 'body' => $item['description'], 'web_url' => $item['link']);
         }
     }
     return $news_items;
 }
Ejemplo n.º 3
0
 protected function _process(&$np)
 {
     $ls_url = parse_url($this->stream_url, PHP_URL_PATH);
     $ls_username = trim($ls_url, '/');
     if (empty($this->data_url)) {
         $this->data_url = 'http://x' . $ls_username . 'x.api.channel.livestream.com/2.0/livestatus.xml';
     }
     $xml = $this->getUrl();
     if (empty($xml)) {
         return false;
     }
     $stream_data = Export::XmlToArray($xml);
     Debug::print_r($stream_data);
     if ($stream_data['channel']['ls:isLive'] && $stream_data['channel']['ls:isLive'] == 'true') {
         $np['meta']['status'] = 'online';
         $np['meta']['listeners'] = (int) $stream_data['channel']['ls:currentViewerCount'];
         $np['on_air']['thumbnail'] = 'http://thumbnail.api.livestream.com/thumbnail?name=' . $ls_username . '&t=' . time();
         $np['on_air']['text'] = 'Stream Online';
         return true;
     }
 }