Add first-party MangaPill source and distinct volume releases
This commit is contained in:
1 parent
a8df57f165
commit
a08e847932
20 files changed
+364
-34
No files matched your search
+10
-4
@@ -3,21 +3,27 @@
|
||||
// An unnumbered release is not chapter zero. Keep its upstream identity intact.
|
||||
const UUID = '[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}';
|
||||
const SPECIAL = new RegExp(`^special-mangadex-(${UUID})$`, 'i');
|
||||
const SPECIAL_FOLDER = new RegExp(`^(special-mangadex-${UUID})(?: (.*))?$`, 'i');
|
||||
const VOLUME = /^special-weebcentral-volume-([a-z0-9]{26})$/i;
|
||||
const SPECIAL_FOLDER = new RegExp(`^(special-mangadex-${UUID}|special-weebcentral-volume-[a-z0-9]{26})(?: (.*))?$`, 'i');
|
||||
const NUMBERED_FOLDER = /^([a-z]*) ?(\d+(?:\.\d+)?)(?=$|[\s_\-[(])[\s_-]*(.*)$/i;
|
||||
const isSpecialKey = value => SPECIAL.test(String(value));
|
||||
const isSpecialKey = value => SPECIAL.test(String(value)) || VOLUME.test(String(value));
|
||||
function specialKey(id) {
|
||||
const key = `special-mangadex-${String(id).toLowerCase()}`;
|
||||
if (!isSpecialKey(key)) throw new Error('Unnumbered MangaDex release needs a stable chapter UUID');
|
||||
return key;
|
||||
}
|
||||
function volumeKey(id) {
|
||||
const key = `special-weebcentral-volume-${String(id).toLowerCase()}`;
|
||||
if (!VOLUME.test(key)) throw new Error('WeebCentral volume needs a stable 26-character release ID');
|
||||
return key;
|
||||
}
|
||||
function parseSpecialFolder(name) {
|
||||
const match = SPECIAL_FOLDER.exec(name);
|
||||
if (!match) return null;
|
||||
let title = (match[2] || '').trim(), src = '';
|
||||
const source = /\s*\[([^\]]*)\]$/.exec(title);
|
||||
if (source) { src = source[1].trim(); title = title.slice(0, source.index).trim(); }
|
||||
return { key: match[1].toLowerCase(), special: true, x: false, num: null, title, src };
|
||||
return { key: match[1].toLowerCase(), special: true, releaseKind: VOLUME.test(match[1]) ? 'volume' : 'special', x: false, num: null, title, src };
|
||||
}
|
||||
// Reader and scraper must assign the same identity to every numbered folder.
|
||||
function parseKey(name) {
|
||||
@@ -29,4 +35,4 @@ function parseKey(name) {
|
||||
if (source) { src = source[1].trim(); title = title.slice(0, source.index).trim(); }
|
||||
return { key: (x ? 'x' : '') + num, x, num, title: title.replace(/^[-:.]\s*/, ''), src };
|
||||
}
|
||||
module.exports = { isSpecialKey, specialKey, parseSpecialFolder, parseKey };
|
||||
module.exports = { isSpecialKey, specialKey, volumeKey, parseSpecialFolder, parseKey };
|
||||
Reference in new issue
Block a user