- toogle chapter visibility
- delete chapter cbz
- preferred ContentSource.php and modal
- minor fixes
This commit is contained in:
Jérémy Guillot
2024-07-21 22:21:04 +02:00
parent fafff5014c
commit c56f72b813
17 changed files with 474 additions and 82 deletions

View File

@@ -6,8 +6,8 @@ use App\Entity\ContentSource;
use App\Message\DownloadChapter;
use App\Repository\ChapterRepository;
use App\Repository\ContentSourceRepository;
use App\Service\MangaScraperService;
use App\Service\NotificationService;
use App\Service\Scraper\MangaScraperService;
use Exception;
use GuzzleHttp\Exception\GuzzleException;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -40,7 +40,16 @@ readonly class DownloadChapterHandler
throw new BadRequestHttpException('Chapter already downloaded');
}
$sources = $this->contentSourceRepository->findAll();
$manga = $chapter->getManga();
$preferredSources = $manga->getPreferredSources()->toArray();
$allSources = $this->contentSourceRepository->findAll();
$filteredSources = array_udiff($allSources, $preferredSources, function ($a, $b) {
return $a->getId() - $b->getId();
});
$sources = array_merge($preferredSources, $filteredSources);
$sources[] =
(new ContentSource())
->setBaseUrl('https://api.mangadex.org/')