Skip to content

Commit

Permalink
PHPCsFixer
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurujai committed Mar 6, 2024
1 parent 4503108 commit cdf5f52
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Command/EstimatedStorageAccountCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
namespace Pumukit\YoutubeBundle\Command;

use Doctrine\ODM\MongoDB\DocumentManager;
use Pumukit\EncoderBundle\Document\Job;
use Pumukit\SchemaBundle\Document\MultimediaObject;
use Pumukit\SchemaBundle\Document\Tag;
use Pumukit\YoutubeBundle\Services\GoogleAccountService;
use Symfony\Component\Console\Command\Command;
Expand All @@ -28,6 +26,7 @@ final class EstimatedStorageAccountCommand extends Command
private GoogleAccountService $googleAccountService;

private $sumStorage;

public function __construct(DocumentManager $documentManager, GoogleAccountService $googleAccountService)
{
$this->documentManager = $documentManager;
Expand Down Expand Up @@ -84,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'forMine' => true,
];

if($input->getOption('live')){
if ($input->getOption('live')) {
$queryParams['eventType'] = 'live';
}

Expand Down Expand Up @@ -124,14 +123,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$url = $this->selectBestStreamFormat($downloadOptions);

try {

$duration = $downloadOptions->getInfo()->durationSeconds;
$bitrate = $url->bitrate;
$output->writeln('Duration: '.$duration . ' and bitrate: ' . $bitrate);
$output->writeln('Duration: '.$duration.' and bitrate: '.$bitrate);
$storage = $duration * $bitrate;
$this->sumStorage += $storage;
} catch (\Exception $exception) {
$output->writeln('There was error calculating storage video with title '.$item->snippet->title.' and id '.$videoId);

continue;
}
} catch (YouTubeException $e) {
Expand All @@ -142,10 +141,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
} while (null !== $nextPageToken);


$progressBar->finish();
$output->writeln(' ');
$output->writeln('Total storage: '. $this->sumStorage);
$output->writeln('Total storage: '.$this->sumStorage);

return 0;
}
Expand Down

0 comments on commit cdf5f52

Please sign in to comment.