diff --git a/app/library/Scan.php b/app/library/Scan.php
index de39d28..9d46133 100644
--- a/app/library/Scan.php
+++ b/app/library/Scan.php
@@ -154,25 +154,41 @@ private function scanManga($mangas)
foreach ($mangas as $manga)
{
$fmanga = page()->manga->toFriendlyName($manga);
+ $dataManga = $this->model->getMangaF($fmanga);
+ $duplicate = false;
- if (!$this->model->hasMangaF($fmanga))
+ if ($dataManga !== false)
{
- // Insert new manga
- $newManga[] = [$manga, $fmanga];
+ if (strcmp($dataManga->name, $manga) === 0)
+ {
+ // Manga exists and has same name
+ $existsManga[] = $fmanga;
+ }
+ else
+ {
+ // Manga exists but name is different
+ $this->scanWarning[] = "Found almost identical/duplicate manga:".
+ "
";
+ $duplicate = true;
+ }
}
else
{
- $existsManga[] = $fmanga;
+ // Insert new manga
+ $newManga[] = [$manga, $fmanga];
}
- $chapterDirs = new \FilesystemIterator($this->mangaPath . '/' . $manga,
- \FilesystemIterator::SKIP_DOTS);
-
- foreach ($chapterDirs as $chapter)
+ if (!$duplicate)
{
- if ($chapter->isDir())
+ $chapterDirs = new \FilesystemIterator($this->mangaPath . '/' . $manga,
+ \FilesystemIterator::SKIP_DOTS);
+
+ foreach ($chapterDirs as $chapter)
{
- $this->addScan([$manga, $chapter->getFilename()]);
+ if ($chapter->isDir())
+ {
+ $this->addScan([$manga, $chapter->getFilename()]);
+ }
}
}
}
@@ -213,12 +229,6 @@ private function scanChapter($chapters)
$id = $dataManga->id;
$lastId = $id;
$lastFManga = $fmanga;
-
- if (strcasecmp($dataManga->name, $manga) !== 0)
- {
- $this->scanWarning[] = "Found almost identical/duplicate manga:".
- "";
- }
}
$chp = $this->model->getChapterF($id, $fchapter);
@@ -229,13 +239,13 @@ private function scanChapter($chapters)
}
else
{
- if (strcasecmp($chp->name, $chapter) === 0)
+ if (strcmp($chp->name, $chapter) === 0)
{
$scChapter[] = [$id, $chp->id, $manga, $chapter];
}
else
{
- $this->scanWarning[] = "Found almost identical/duplicate chapters:".
+ $this->scanWarning[] = "Found almost identical/duplicate '$manga' chapters:".
"";
}
}