From f3457ec4d9d1c121dd0752dea3b2cccb9986acf4 Mon Sep 17 00:00:00 2001 From: Alba Date: Thu, 28 Nov 2024 12:49:18 +0100 Subject: [PATCH] TTK-27357: Change track functions --- Services/VideoDataValidationService.php | 6 +++--- Services/VideoInsertService.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Services/VideoDataValidationService.php b/Services/VideoDataValidationService.php index 97bba0b..be18dcd 100644 --- a/Services/VideoDataValidationService.php +++ b/Services/VideoDataValidationService.php @@ -14,7 +14,7 @@ use Pumukit\SchemaBundle\Document\MultimediaObject; use Pumukit\SchemaBundle\Document\Person; use Pumukit\SchemaBundle\Document\Tag; -use Pumukit\SchemaBundle\Document\Track; +use Pumukit\SchemaBundle\Document\MediaType\Track; use Pumukit\SchemaBundle\Document\ValueObject\Path; use Pumukit\SchemaBundle\Services\TagService; use Pumukit\YoutubeBundle\PumukitYoutubeBundle; @@ -75,7 +75,7 @@ public function validateMultimediaObjectTrack(MultimediaObject $multimediaObject return null; } - $trackPath = $track->getPath(); + $trackPath = $track->storage()->path()->path(); if (!file_exists($trackPath)) { $errorLog = self::class.' ['.__FUNCTION__.'] Error, there is no file '.$trackPath; $this->logger->error($errorLog); @@ -229,7 +229,7 @@ protected function generateSbsTrack(MultimediaObject $multimediaObject) return 0; } $track = $tracks[0]; - $path = $track->getPath(); + $path = $track->storage()->path()->path(); $language = $track->getLanguage() ?: \Locale::getDefault(); $jobOptions = new JobOptions($this->youtubeConfigurationService->sbsProfileName(), 2, $language, [], [], $track->getDuration()); $path = Path::create($path); diff --git a/Services/VideoInsertService.php b/Services/VideoInsertService.php index 59a24e4..f55854f 100644 --- a/Services/VideoInsertService.php +++ b/Services/VideoInsertService.php @@ -95,7 +95,7 @@ private function insert( \Google_Service_YouTube_Video $video, Track $track ): ?Video { - $infoLog = sprintf('[YouTube] Video insert ( %s ) with track %s', $video->getSnippet()->getTitle(), $track->getId()); + $infoLog = sprintf('[YouTube] Video insert ( %s ) with track %s', $video->getSnippet()->getTitle(), $track->id()); $this->logger->info($infoLog); $service = $this->googleAccountService->googleServiceFromAccount($youtubeAccount); @@ -104,7 +104,7 @@ private function insert( 'snippet,status', $video, [ - 'data' => file_get_contents($track->getPath()), + 'data' => file_get_contents($track->storage()->path()->path()), 'mimeType' => 'application/octet-stream', 'uploadType' => 'multipart', ] @@ -156,7 +156,7 @@ private function updateVideoAndYoutubeDocumentByResult( $youtube->removeError(); $youtube->setYoutubeId($video->getId()); $youtube->setLink('https://www.youtube.com/watch?v='.$video->getId()); - $youtube->setFileUploaded(basename($track->getPath())); + $youtube->setFileUploaded(basename($track->storage()->path()->path())); $multimediaObject->setProperty('youtubeurl', $youtube->getLink()); $code = $this->getEmbed($video->getId());