Esempio n. 1
0
 private function createMultimediaObjectAssignedToSeries($title, Series $series)
 {
     $rank = 1;
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $subtitle = 'Subtitle';
     $description = "Description";
     $duration = 0;
     $mm = new MultimediaObject();
     $mm->setStatus($status);
     $mm->setRecordDate($record_date);
     $mm->setPublicDate($public_date);
     $mm->setTitle($title);
     $mm->setSubtitle($subtitle);
     $mm->setDescription($description);
     $mm->setDuration($duration);
     $mm->setSeries($series);
     $this->dm->persist($mm);
     $this->dm->persist($series);
     $this->dm->flush();
     return $mm;
 }
Esempio n. 2
0
 public function createTrack(MultimediaObject $multimediaObject, $pathEnd, $profileName, $language = null, $description = array())
 {
     $profile = $this->profileService->getProfile($profileName);
     $track = new Track();
     $track->addTag('profile:' . $profileName);
     if ($profile['master']) {
         $track->addTag('master');
     }
     if ($profile['display']) {
         $track->addTag('display');
     }
     foreach (array_filter(preg_split('/[,\\s]+/', $profile['tags'])) as $tag) {
         $track->addTag(trim($tag));
     }
     if (!empty($description)) {
         $track->setI18nDescription($description);
     }
     $track->setLanguage($language);
     $track->setPath($pathEnd);
     if (isset($profile['streamserver']['url_out'])) {
         $track->setUrl(str_replace(realpath($profile['streamserver']['dir_out']), $profile['streamserver']['url_out'], $pathEnd));
     }
     $this->inspectionService->autocompleteTrack($track);
     $track->setOnlyAudio($track->getWidth() == 0);
     $track->setHide(!$profile['display']);
     $multimediaObject->setDuration($track->getDuration());
     $multimediaObject->addTrack($track);
     $this->dm->persist($multimediaObject);
     $this->dm->flush();
     return $track;
 }
 public function testRepository()
 {
     //$rank = 1;
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $title = 'titulo cualquiera';
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $broadcast = $this->createBroadcast(Broadcast::BROADCAST_TYPE_PRI);
     $mmobj = new MultimediaObject();
     //$mmobj->setRank($rank);
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $mmobj->setBroadcast($broadcast);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals(1, count($this->repo->findAll()));
     $this->assertEquals($broadcast, $mmobj->getBroadcast());
     $broadcast = $this->createBroadcast(Broadcast::BROADCAST_TYPE_PUB);
     $mmobj->setBroadcast($broadcast);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals($broadcast, $mmobj->getBroadcast());
     $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'));
     $t6 = new Track();
     $t6->setTags(array('track6'));
     $t6->setHide(true);
     $this->dm->persist($t1);
     $this->dm->persist($t2);
     $this->dm->persist($t3);
     $this->dm->persist($t4);
     $this->dm->persist($t5);
     $this->dm->persist($t6);
     $mmobj->addTrack($t3);
     $mmobj->addTrack($t2);
     $mmobj->addTrack($t1);
     $mmobj->addTrack($t4);
     $mmobj->addTrack($t5);
     $mmobj->addTrack($t6);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     $this->assertEquals(5, count($mmobj->getFilteredTracksWithTags()));
     $this->assertEquals(3, count($mmobj->getFilteredTracksWithTags(array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTracksWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mmobj->getFilteredTracksWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(3, count($mmobj->getFilteredTracksWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mmobj->getFilteredTracksWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(5, count($mmobj->getFilteredTracksWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTracksWithTags(array('mosca', 'old'), array(), array(), array('old'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags()));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('master'), array('mosca', 'old'))));
     $this->assertEquals(0, count($mmobj->getFilteredTrackWithTags(array(), array('mosca', 'old'), array('master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array('flv'))));
     $this->assertEquals(0, count($mmobj->getFilteredTrackWithTags(array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array(), array('flv', 'master'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array('mosca', 'old'), array(), array(), array('old'))));
     $this->assertEquals(1, count($mmobj->getFilteredTrackWithTags(array(), array(), array(), array('master', 'mosca'))));
     $this->assertEquals(null, count($mmobj->getFilteredTrackWithTags(array('track6'))));
     $this->assertEquals(null, count($mmobj->getFilteredTracksWithTags(array('track6'))));
 }
 public function testDurationInMinutesAndSeconds()
 {
     $duration = 120;
     $duration_in_minutes_and_seconds1 = array('minutes' => 2, 'seconds' => 0);
     $duration_in_minutes_and_seconds2 = array('minutes' => 5, 'seconds' => 30);
     $mm = new MultimediaObject();
     $mm->setDuration($duration);
     $this->assertEquals($duration_in_minutes_and_seconds1, $mm->getDurationInMinutesAndSeconds());
     $mm->setDurationInMinutesAndSeconds($duration_in_minutes_and_seconds2);
     $this->assertEquals($duration_in_minutes_and_seconds2, $mm->getDurationInMinutesAndSeconds());
 }
 public function syncMetadata(MultimediaObject $mmobj, $parsedTerena)
 {
     $mmobj->setTitle($parsedTerena['title']);
     $mmobj->setDescription($parsedTerena['description']);
     foreach ($parsedTerena['keywords'] as $keyword) {
         $mmobj->setKeyword($keyword);
     }
     $mmobj->setLicense($parsedTerena['license']);
     $mmobj->setCopyright($parsedTerena['copyright']);
     $mmobj->setRecordDate($parsedTerena['record_date']);
     $mmobj->setDuration($parsedTerena['duration']);
 }
 private function createTestMultimediaObject()
 {
     $status = MultimediaObject::STATUS_PUBLISHED;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $title = 'titulo cualquiera';
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $mmobj = new MultimediaObject();
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $this->dm->persist($mmobj);
     $this->dm->flush();
 }
 private function createMultimediaObject($title, $prototype = false)
 {
     $locale = 'en';
     $status = $prototype ? MultimediaObject::STATUS_PROTOTYPE : MultimediaObject::STATUS_NEW;
     $record_date = new \DateTime();
     $public_date = new \DateTime();
     $subtitle = 'Subtitle paragraph';
     $description = "Description text";
     $duration = 300;
     $mmobj = new MultimediaObject();
     $mmobj->setLocale($locale);
     $mmobj->setStatus($status);
     $mmobj->setRecordDate($record_date);
     $mmobj->setPublicDate($public_date);
     $mmobj->setTitle($title);
     $mmobj->setSubtitle($subtitle);
     $mmobj->setDescription($description);
     $mmobj->setDuration($duration);
     $this->dm->persist($mmobj);
     $this->dm->flush();
     return $mmobj;
 }