Exemple #1
0
 public function getAllPaging($where = [], $number_pagination = '')
 {
     $where['del_flg'] = 1;
     $channels = null;
     //Split username of channel
     $where_temp = $where;
     foreach ($where_temp as $k => $v) {
         //username
         if (isset($where_temp['daily_channel_username']) && $where_temp['daily_channel_username']) {
             $channels = \App\Channels::where('daily_channel_username', 'LIKE', '%' . $v . '%');
             break;
         }
     }
     if ($channels == null) {
         $channels = \App\Channels::where($where);
     }
     if ($number_pagination) {
         $channels = $channels->paginate($number_pagination);
         foreach (Input::except('page') as $input => $value) {
             $channels->appends($input, $value);
         }
     } else {
         $channels = $channels->get();
     }
     return $channels;
 }
Exemple #2
0
 public function renameRecordedVideos()
 {
     $channels = Channels::all();
     foreach ($channels as $channel) {
         $path = Channels::getChannelRecordsPath($channel->slug);
         if (file_exists($path . '/' . '.flv')) {
             $filetime = filemtime($path . '/' . '.flv');
             if (time() - $filetime > 10) {
                 rename($path . '/' . '.flv', $path . '/' . $filetime . '.flv');
             }
         }
     }
 }
Exemple #3
0
 public static function getLiveStatuses()
 {
     $channels = self::all();
     $channel_records_path = $_ENV['CHANNEL_RECORDS_PATH'];
     $result = [];
     $last_file_names = [];
     foreach ($channels as $channel) {
         $path = Channels::getChannelRecordsPath($channel->slug);
         if (file_exists($path . '/' . '.flv')) {
             $filetime = filemtime($path . '/' . '.flv');
             if (time() - $filetime < 5) {
                 $result[$channel->id] = true;
             } else {
                 $result[$channel->id] = false;
             }
         } else {
             $result[$channel->id] = false;
         }
     }
     return $result;
 }
Exemple #4
0
 /**
  * @author: lmkhang - skype
  * @date: 2016-02-17
  * Change status - Multiple
  */
 public function change_multi(Request $request)
 {
     //post
     $post = $this->trim_all($request->all());
     $channel_ids = isset($post['channel_ids']) ? $post['channel_ids'] : [];
     $msg = 'Please choose at least ONE channel';
     $channel_get = new \App\Channels();
     foreach ($channel_ids as $k => $ch) {
         //check existed
         $channel_get = \App\Channels::find($ch);
         if (!$channel_get) {
             continue;
         }
         //delete
         $channel_get->delete();
         $msg = 'Decline successfully';
     }
     //set Flash Message
     $this->setFlash('message', $msg);
     return redirect()->back()->with('message', $msg);
 }