Example #1
0
 /**
  * Returns class instance
  *
  * @return VIDEO_BOL_ClipDao
  */
 public static function getInstance()
 {
     if (null === self::$classInstance) {
         self::$classInstance = new self();
     }
     return self::$classInstance;
 }
Example #2
0
 public function findUserVideos($userId, $start, $offset)
 {
     $clipDao = VIDEO_BOL_ClipDao::getInstance();
     $example = new OW_Example();
     $example->andFieldEqual('status', 'approved');
     $example->andFieldEqual('userId', $userId);
     $example->setOrder('`addDatetime` DESC');
     $example->setLimitClause($start, $offset);
     $list = $clipDao->findListByExample($example);
     $out = array();
     foreach ($list as $video) {
         $id = $video->id;
         $videoThumb = VIDEO_BOL_ClipService::getInstance()->getClipThumbUrl($id);
         $out[$id] = array('id' => $id, 'embed' => $video->code, 'title' => UTIL_String::truncate($video->title, 65, ' ...'), 'description' => UTIL_String::truncate($video->description, 130, ' ...'), 'thumb' => $videoThumb == 'undefined' ? null : $videoThumb, 'date' => UTIL_DateTime::formatDate($video->addDatetime), 'permalink' => OW::getRouter()->urlForRoute('view_clip', array('id' => $id)));
         $out[$id]['oembed'] = json_encode(array('type' => 'video', 'thumbnail_url' => $out[$id]['thumb'], 'html' => $out[$id]['embed'], 'title' => $out[$id]['title'], 'description' => $out[$id]['description']));
     }
     return $out;
 }
Example #3
0
 public function cacheThumbnails($limit)
 {
     $clips = $this->clipDao->getUncachedThumbsClipsList($limit);
     if (!$clips) {
         return true;
     }
     foreach ($clips as $clip) {
         $prov = new VideoProviders($clip->code);
         if (!$clip->provider) {
             $clip->provider = $prov->detectProvider();
         }
         $thumbUrl = $prov->getProviderThumbUrl($clip->provider);
         if ($thumbUrl != VideoProviders::PROVIDER_UNDEFINED) {
             $clip->thumbUrl = $thumbUrl;
         }
         $clip->thumbCheckStamp = time();
         $this->clipDao->save($clip);
     }
     return true;
 }
Example #4
0
 public function countVideos()
 {
     return VIDEO_BOL_ClipDao::getInstance()->countClips('latest');
 }
Example #5
0
 /**
  * Class constructor
  *
  */
 protected function __construct()
 {
     parent::__construct();
 }