Ejemplo n.º 1
0
 public function doGet()
 {
     Songs::wipeOldPreviews();
     FileServer::removeUnused();
     FileServer::removeDead();
     $limit = 30;
     while ($limit-- > 0) {
         set_time_limit(30);
         (new SelectQuery(TSongs::_NAME))->select(TSongs::FILE_NAME, TSongs::FILE_ID, TSongs::ID)->where(TSongs::PEAKS_ID . " IS NULL")->where(TSongs::FILE_ID . " IS NOT NULL")->limit(1)->eachRow(function ($row) {
             Logger::printf("Creating peaks for file: %s", $row[TSongs::FILE_NAME]);
             $peaks = WaveformGenerator::generate(FileServer::getFileUsingId($row[TSongs::FILE_ID]));
             $file_id = FileServer::registerByContent(json_encode($peaks), "application/json");
             SongDao::updateSongUsingId($row[TSongs::ID], [TSongs::PEAKS_ID => $file_id]);
         });
         sleep(1);
     }
 }
Ejemplo n.º 2
0
 /**
  * @return mixed
  */
 private function getFilePath()
 {
     return FileServer::getFileUsingId($this->track_data[TSongs::FILE_ID]);
 }