- turbo-stream for Chapter updates
- progressbar for chapter scrapping
- minor optimisations
This commit is contained in:
Jérémy Guillot
2024-07-17 20:20:19 +02:00
parent 4672886a67
commit 7fc2f15f6b
14 changed files with 111 additions and 63 deletions

View File

@@ -28,6 +28,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Serializer\SerializerInterface;
use Symfony\Component\String\Slugger\SluggerInterface;
class MangaController extends AbstractController

View File

@@ -6,8 +6,10 @@ use App\Repository\ChapterRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\UX\Turbo\Attribute\Broadcast;
#[ORM\Entity(repositoryClass: ChapterRepository::class)]
#[Broadcast()]
class Chapter
{
#[ORM\Id]

View File

@@ -7,6 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
#[ORM\Entity(repositoryClass: MangaRepository::class)]
class Manga

View File

@@ -4,7 +4,7 @@ namespace App\Manager\Toolbar\Definition;
use App\Manager\Toolbar\Element\ToolbarElement;
class Toolbar
abstract class Toolbar
{
private array $leftGroup = [];
private array $rightGroup = [];

View File

@@ -17,9 +17,9 @@ use Symfony\Component\Messenger\Attribute\AsMessageHandler;
readonly class DownloadChapterHandler
{
public function __construct(
private ChapterRepository $chapterRepository,
private MangaScraperService $mangaScraperService,
private NotificationService $notificationService,
private ChapterRepository $chapterRepository,
private MangaScraperService $mangaScraperService,
private NotificationService $notificationService,
private ContentSourceRepository $contentSourceRepository
)
{
@@ -46,8 +46,7 @@ readonly class DownloadChapterHandler
->setBaseUrl('https://api.mangadex.org/')
->setImageSelector('img')
->setChapterUrlFormat('at-home/server/%s')
->setScrapingType('mangadex')
;
->setScrapingType('mangadex');
// (new ContentSource())
// ->setBaseUrl('https://lelscans.net')

View File

@@ -32,7 +32,7 @@ readonly class RefreshMetadataHandler
$lastChapters = $this->mangadexProvider->addAllChaptersToManga($manga);
try {
foreach ($manga->getChapters() as $chapter) {
foreach ($lastChapters as $chapter) {
$this->entityManager->persist($chapter);
}