/**
  * @param File $file
  * @return Track|null
  */
 public function createTrackFromFile(File $file)
 {
     $fileExt = strtolower(pathinfo($file->getPath(), PATHINFO_EXTENSION));
     switch ($fileExt) {
         case 'mp3':
             return new Mp3Track($file);
             break;
         case 'flac':
             return new FlacTrack($file);
         default:
             return null;
             //TODO: throw exception instead;
     }
 }
Beispiel #2
0
 function __construct(File $file)
 {
     $this->file = $file;
     $this->name = pathinfo($file->getPath(), PATHINFO_BASENAME);
     $this->processMetaData();
 }