Skip to content

Commit

Permalink
block google
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioMendolia committed Oct 13, 2023
1 parent dd26117 commit 22e161f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Command/BooksTagCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(private BookSuggestions $bookSuggestions, private Bo
protected function configure(): void
{
$this
->addOption('allow-google', 'f', InputOption::VALUE_NONE, 'Force the extraction of the cover')
->addArgument('book-id', InputOption::VALUE_REQUIRED, 'Which book to extract the cover from, use "all" for all books')
;
}
Expand All @@ -37,6 +38,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
$bookId = $input->getArgument('book-id');
$allowGoogle = $input->getArgument('allow-google');
if ($bookId === 'all') {
$books = $this->bookRepository->findAll();
} else {
Expand Down Expand Up @@ -66,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->writeln('looking for suggestions for '.$book->getTitle());

$suggestions = $this->bookSuggestions->getCategorySuggestions($book);
if (count($suggestions['tags']) === 0) {
if (count($suggestions['tags']) === 0 && $allowGoogle === true) {
$suggestions = $this->bookSuggestions->getGoogleSuggestions($book);
}
if(count($suggestions['tags']) > 0){
Expand Down

0 comments on commit 22e161f

Please sign in to comment.