Exemple #1
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 #2
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;
 }