/** * @param $file * @throws \Exception */ private function doJob($file) { $this->files++; $id3Meta = new Id3Metadata($file); $this->mediainfoWrapper->read($id3Meta); $mover = $this->getBaseMoverStack($id3Meta); $return = $mover->pathAddMediaYear()->pathAddMediaGenre()->moveIn($this->input->getArgument('output-dir')); if ($return && !$this->input->getOption('dump-command')) { $this->ouput->writeln($mover->getTargetDest()->getRealPath()); $this->movedFiles++; //return; } $moveToUntagged = $this->input->getOption('move-untagged-to'); if ($mover->isPartsIsIncomplete() && $moveToUntagged) { if (!is_dir($moveToUntagged)) { mkdir($moveToUntagged, 0775, true); } if ($return = $mover->reset()->moveIn($moveToUntagged)) { $this->untaggedFiles++; //return; } } if ($return && $this->input->getOption('dump-command')) { $this->nativeCommandStack[] = $mover->getNativeCommand(); } $this->unMovedFiles++; }
public function testRead() { $this->mediaInfoWrapper->setBinPath(Helper::getMediainfoPath()); $this->assertContains("MediaInfoLib", $this->mediaInfoWrapper->getVersion()); $metaDataFile = new Id3Metadata(Helper::getSampleMp3File()); if ($this->mediaInfoWrapper->read($metaDataFile)) { $this->assertEquals('Nom du morceau', $metaDataFile->getTitle()); $this->assertEquals('Artiste', $metaDataFile->getArtist()); $this->assertEquals('Nom de l\'album', $metaDataFile->getAlbum()); $this->assertEquals('Celtic', $metaDataFile->getGenre()); $this->assertEquals('2003', $metaDataFile->getYear()); $this->assertEquals('120', $metaDataFile->getBpm()); $this->assertEquals('87.875', $metaDataFile->getTimeDuration()); } $this->assertTrue($this->mediaInfoWrapper->supportRead($metaDataFile)); }
/** * @group mediainfo-read * @throws Exception */ public function testReadMediainfo() { self::$mediainfo->read(self::$id3meta); }