- ContentSource handling in message
- ContentSource list, add/update ui
- nextPageSelector and imageSelector can be null
- cleanup
This commit is contained in:
Jérémy Guillot
2024-06-30 20:47:27 +02:00
parent ba30d3102d
commit 3012adfee7
24 changed files with 762 additions and 707 deletions

View File

@@ -10,13 +10,13 @@ use App\Repository\ChapterRepository;
use App\Repository\MangaRepository;
use App\Service\CbzService;
use App\Service\MangadexProvider;
use App\Service\NotificationService;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\NonUniqueResultException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
@@ -27,13 +27,14 @@ use Symfony\Component\Routing\Attribute\Route;
class MangaController extends AbstractController
{
public function __construct(
private readonly MangaRepository $mangaRepository,
private readonly ChapterRepository $chapterRepository,
private readonly MessageBusInterface $bus,
private readonly CbzService $cbzService,
private readonly ToolbarFactory $toolbarFactory,
private MangadexProvider $mangadexProvider,
private EntityManagerInterface $entityManager
private readonly MangaRepository $mangaRepository,
private readonly ChapterRepository $chapterRepository,
private readonly MessageBusInterface $bus,
private readonly CbzService $cbzService,
private readonly ToolbarFactory $toolbarFactory,
private readonly MangadexProvider $mangadexProvider,
private readonly EntityManagerInterface $entityManager,
private readonly NotificationService $notificationService
)
{
}
@@ -171,6 +172,14 @@ class MangaController extends AbstractController
$allChapters = array_merge($mangaFeed, $mangaAggregate);
if (empty($allChapters)) {
$this->notificationService->sendUpdate([
'status' => 'error',
'message' => 'No chapters found for this manga.'
]);
return $this->redirectToRoute('app_manga_search', ['query' => $manga->getTitle()]);
}
$mergedChapters = [];
foreach ($allChapters as $chapter) {
$number = $chapter->getNumber();
@@ -187,7 +196,7 @@ class MangaController extends AbstractController
}
}
foreach($mergedChapters as $chapter) {
foreach ($mergedChapters as $chapter) {
$manga->addChapter($chapter);
}