- activity on menu
- starting activity page
This commit is contained in:
2024-06-17 22:36:37 +02:00
parent 671551c7f8
commit f7bb7b9148
14 changed files with 524 additions and 33 deletions

View File

@@ -33,10 +33,10 @@ readonly class DownloadChapterHandler
{
$chapter = $this->chapterRepository->find($message->getChapterId());
if (!$chapter) {
$this->notificationService->sendUpdate('notification', ['status' => 'error', 'message' => 'Chapter not found.']);
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Chapter not found.']);
throw new BadRequestHttpException('Chapter not found');
} elseif ($chapter->getLocalPath() !== null) {
$this->notificationService->sendUpdate('notification', ['status' => 'error', 'message' => 'Chapter already scraped.']);
$this->notificationService->sendUpdate(['status' => 'error', 'message' => 'Chapter already scraped.']);
throw new BadRequestHttpException('Chapter already downloaded');
}
@@ -64,7 +64,7 @@ readonly class DownloadChapterHandler
$scrapedSuccessfully = true;
break;
} catch (Exception $e) {
$this->notificationService->sendUpdate('notification', [
$this->notificationService->sendUpdate([
'status' => 'warning',
'message' => 'An error occurred while scraping with source: ' . $source->getBaseUrl() . '. Trying next source...'
]);
@@ -74,13 +74,13 @@ readonly class DownloadChapterHandler
}
if (!$scrapedSuccessfully) {
$this->notificationService->sendUpdate('notification', [
$this->notificationService->sendUpdate([
'status' => 'error',
'message' => 'All sources failed to scrape the chapter ' . $chapter->getManga()->getTitle() . ' ' . $chapter->getNumber() . '.'
]);
throw new Exception('All sources failed to scrape the chapter ' . $chapter->getManga()->getTitle() . ' ' . $chapter->getNumber() . '.');
}
$this->notificationService->sendUpdate('notification', ['status' => 'success', 'message' => 'Chapter scraped successfully.']);
$this->notificationService->sendUpdate(['status' => 'success', 'message' => 'Chapter scraped successfully.']);
}
}