Ejemplo n.º 1
0
 /**
  * Rebuilds the cache file by reading & parsing all ChordPro song files.
  * @return array song list
  */
 public function Rebuild()
 {
     // large song collections (1,000's of songs) might timeout, set max number of seconds for this task
     set_time_limit(45);
     $files = FileHelper::getFilenames(Config::$SongDirectory);
     $songList = $this->buildFileList($files);
     $this->cache->put(Config::SongCacheKey_FileName, serialize($songList));
     return $songList;
 }
Ejemplo n.º 2
0
 /**
  * Populates SongList View Model by reading and parsing filenames in the source directory
  * @return SongList_Vm
  */
 public function Build()
 {
     $files = FileHelper::getFilenames(Config::$SongDirectory);
     $viewModel = new SongList_Vm();
     foreach ($files as $filename) {
         // Parse the filename (to make a Title) and create URL.
         $s = preg_replace(Config::FileNamePattern, '$1', $filename);
         $viewModel->Add($this->getTitle($s), Ugs::MakeUri(Actions::Song, $s));
     }
     $viewModel->Sort();
     return $viewModel;
 }