Skip to content

Commit

Permalink
TTK-26902 fix commands
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Mar 8, 2024
1 parent 6b97986 commit 1a56dca
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 3 additions & 6 deletions Command/DownloadVideosFromYouTubeChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
namespace Pumukit\YoutubeBundle\Command;

use Doctrine\ODM\MongoDB\DocumentManager;
use Pumukit\EncoderBundle\Document\Job;
use Pumukit\SchemaBundle\Document\MultimediaObject;
use Pumukit\SchemaBundle\Document\Series;
use Pumukit\SchemaBundle\Document\Tag;
use Pumukit\YoutubeBundle\Services\GoogleAccountService;
use Symfony\Component\Console\Command\Command;
Expand All @@ -16,7 +14,6 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use YouTube\DownloadOptions;
use YouTube\Exception\YouTubeException;
use YouTube\Models\StreamFormat;
use YouTube\Utils\Utils;
use YouTube\YouTubeDownloader;
Expand Down Expand Up @@ -77,12 +74,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$progressBar->start();

$count = 0;
foreach($multimediaObjects as $multimediaObject) {
foreach ($multimediaObjects as $multimediaObject) {
$progressBar->advance();
if (null !== $input->getOption('limit') && $count >= $input->getOption('limit')) {
break;
}
$count++;
++$count;

$videoId = $multimediaObject->getProperty('youtube_import_id');
$youtubeDownloader = new YouTubeDownloader();
Expand All @@ -107,6 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->documentManager->flush();
} catch (\Exception $exception) {
$this->youtubeErrors[] = 'Error moving file to storage: '.$exception->getMessage();

continue;
}
}
Expand Down Expand Up @@ -203,5 +201,4 @@ private function ensureYouTubeAccountExists(InputInterface $input): void
throw new \Exception('Account not found');
}
}

}
1 change: 1 addition & 0 deletions Command/ImportJobsFromYouTubeDownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Pumukit\YoutubeBundle\Command;

use Doctrine\ODM\MongoDB\DocumentManager;
use Pumukit\CoreBundle\Utils\FinderUtils;
use Pumukit\EncoderBundle\Services\JobService;
use Pumukit\SchemaBundle\Document\MultimediaObject;
use Symfony\Component\Console\Command\Command;
Expand Down

0 comments on commit 1a56dca

Please sign in to comment.