Example #1
0
 /**
  * Adds a entry to the feed list
  */
 function addItem($i)
 {
     switch (get_class($i)) {
         case 'cd\\NewsItem':
             $item = $i;
             break;
         case 'cd\\VideoResource':
             d($i);
             die;
             //    d($i);
             //convert into a NewsItem
             $item = new NewsItem();
             $item->title = $i->title;
             $item->desc = $i->desc;
             $item->image_url = $i->thumbnail;
             $item->image_mime = file_get_mime_by_suffix($i->thumbnail);
             $item->Url->set($i->Url->get());
             $item->Duration->set($i->Duration->get());
             $item->Timestamp->set($i->Timestamp->get());
             break;
         default:
             throw new \Exception('cant handle ' . get_class($i));
     }
     parent::addItem($item);
 }
Example #2
0
 /**
  * Adds a item to the feed list
  */
 function addItem($i)
 {
     if (!is_object($i)) {
         throw new \Exception('not an object ' . $i);
     }
     /**
      * HACK: Needed to work around a limitation in xbmc, which needs rss
      * feeds in the format rss:// instead of http:// for all http links
      *
      * bug progress in xbmc: http://xbmc.org/trac/ticket/6186
      */
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'XBMC') !== false) {
         $i->Url->setScheme('rss');
     }
     switch (get_class($i)) {
         case 'VideoResource':
             $item = $i;
             //            d($item);
             break;
         default:
             d('Playlist->addItem cant handle ' . get_class($i));
             return false;
     }
     parent::addItem($item);
 }