private function checkMultimediaObject(MultimediaObject $multimediaObject)
 {
     if (!isset($this->profiles[$this->targetProfile])) {
         $this->logger->warning(sprintf('CMAR JobGeneratorListener profile "%s" doesn\'t exist', $this->targetProfile));
         return;
     }
     $sbs = $multimediaObject->getTrackWithTag('sbs');
     $publicTracks = $multimediaObject->getTracksWithTag('profile:' . $this->targetProfile);
     if ($sbs && !$publicTracks) {
         $this->logger->info(sprintf("CMAR JobGeneratorListener creates new job (%s) for SbS in multimedia object %s", $this->targetProfile, $multimediaObject->getId()));
         $jobs[] = $this->jobService->addUniqueJob($sbs->getPath(), $this->targetProfile, 2, $multimediaObject, $sbs->getLanguage());
     }
 }
 private function checkMultimediaObject(MultimediaObject $multimediaObject)
 {
     $master = $multimediaObject->getTrackWithTag("master");
     $publicTracks = $multimediaObject->getTracksWithTag("display");
     $repository = $this->dm->getRepository('PumukitSchemaBundle:Tag');
     $tag = $repository->findOneByCod("PUBCHANNELS");
     if (!$tag) {
         return;
     }
     foreach ($tag->getChildren() as $pubchannel) {
         if ($multimediaObject->containsTag($pubchannel) && $master && !$publicTracks) {
             $this->generateJobs($multimediaObject, $pubchannel->getCod());
         }
     }
 }
 public function testGetTracksWithTag()
 {
     $mm = new MultimediaObject();
     $t1 = new Track();
     $t1->setTags(array('master'));
     $t2 = new Track();
     $t2->setTags(array('mosca', 'master', 'old'));
     $t3 = new Track();
     $t3->setTags(array('master', 'mosca'));
     $t4 = new Track();
     $t4->setTags(array('flv', 'itunes', 'hide'));
     $t5 = new Track();
     $t5->setTags(array('flv', 'webtv'));
     $mm->addTrack($t3);
     $mm->addTrack($t2);
     $mm->addTrack($t1);
     $mm->addTrack($t4);
     $mm->addTrack($t5);
     $this->assertEquals(array($t3, $t2, $t1), $mm->getTracksWithTag('master'));
     $this->assertEquals($t3, $mm->getTrackWithTag('master'));
     $this->assertEquals(null, $mm->getTrackWithTag('del_universo'));
     $this->assertEquals($t3, $mm->getTrackWithAnyTag(array('master', 'pr')));
     $this->assertEquals(array($t2), $mm->getTracksWithAllTags(array('master', 'mosca', 'old')));
     $this->assertTrue(in_array($mm->getTrackWithAllTags(array('mosca', 'master')), array($t3, $t2)));
     $this->assertEquals(null, $mm->getTrackWithAllTags(array('mosca', 'master', 'del_universo')));
     $this->assertEquals(4, count($mm->getTracksWithAnyTag(array('master', 'webtv'))));
     $this->assertEquals(1, count($mm->getTrackWithAnyTag(array('master'))));
     $this->assertEquals(null, $mm->getTrackWithAnyTag(array('del_universo')));
     $this->assertEquals(5, count($mm->getFilteredTracksWithTags()));
     $this->assertEquals(3, count($mm->getFilteredTracksWithTags(array('master'))));
     $this->assertEquals(1, count($mm->getFilteredTracksWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mm->getFilteredTracksWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(3, count($mm->getFilteredTracksWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mm->getFilteredTracksWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(5, count($mm->getFilteredTracksWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mm->getFilteredTracksWithTags(array('mosca', 'old'), array(), array(), array('old'))));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags()));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags(array('master'))));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mm->getFilteredTrackWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mm->getFilteredTrackWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mm->getFilteredTrackWithTags(array('mosca', 'old'), array(), array(), array('old'))));
 }