[MangaDexBridge] Exclude external chapters (#2703)

This commit is contained in:
Yaman Qalieh 2022-05-07 22:22:33 -04:00 committed by GitHub
parent 158ee41be4
commit 3476b06ee0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -33,6 +33,9 @@ class MangaDexBridge extends BridgeAbstract {
'title' => 'Some chapters are inaccessible or only available on an external site. Include these?' 'title' => 'Some chapters are inaccessible or only available on an external site. Include these?'
) )
) )
// Future Contexts:
// Latest uploads (whole site or group): https://api.mangadex.org/swagger.html#/Chapter/get-chapter
// Manga List (by author or tags) https://api.mangadex.org/swagger.html#/Manga/get-search-manga
); );
const TITLE_REGEX = '#title/(?<uuid>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})#'; const TITLE_REGEX = '#title/(?<uuid>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})#';
@ -83,7 +86,6 @@ class MangaDexBridge extends BridgeAbstract {
} }
return $uri; return $uri;
} }
public function getName() { public function getName() {
@ -131,6 +133,10 @@ class MangaDexBridge extends BridgeAbstract {
$item['uid'] = $chapter['id']; $item['uid'] = $chapter['id'];
$item['uri'] = self::URI . 'chapter/' . $chapter['id']; $item['uri'] = self::URI . 'chapter/' . $chapter['id'];
// External chapter
if (!$this->getInput('external') && $chapter['attributes']['pages'] == 0)
continue;
// Preceding space accounts for Manga title added later // Preceding space accounts for Manga title added later
$item['title'] = ' Chapter ' . $chapter['attributes']['chapter']; $item['title'] = ' Chapter ' . $chapter['attributes']['chapter'];
if (!empty($chapter['attributes']['title'])) { if (!empty($chapter['attributes']['title'])) {
@ -148,9 +154,9 @@ class MangaDexBridge extends BridgeAbstract {
$groups[] = $rel['attributes']['name']; $groups[] = $rel['attributes']['name'];
break; break;
case 'manga': case 'manga':
if (empty($this->feedName)) { if (empty($this->feedName))
$this->feedName = reset($rel['attributes']['title']); $this->feedName = reset($rel['attributes']['title']);
}
$item['title'] = reset($rel['attributes']['title']) . $item['title']; $item['title'] = reset($rel['attributes']['title']) . $item['title'];
break; break;
case 'user': case 'user':