guessit-js 4.4.2 → 4.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/guessit-js.cjs +226 -15
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +226 -15
- package/dist/guessit-js.js.map +1 -1
- package/package.json +1 -1
package/dist/guessit-js.js
CHANGED
|
@@ -3519,7 +3519,7 @@ function episodes(config) {
|
|
|
3519
3519
|
chainBreaker: (matches) => episodesSeasonChainBreaker(matches, config),
|
|
3520
3520
|
disabled: isSeasonEpisodeDisabled
|
|
3521
3521
|
}).defaults({ tags: ["SxxExx"] }).regex(
|
|
3522
|
-
seasonMarkerPattern + `(?<season>\\d+)@?` + episodeMarkerPattern + `@?(?<episode>\\d+)(?:[a-d](?![a-z0-9]))?`
|
|
3522
|
+
seasonMarkerPattern + `(?<season>\\d+)@?` + episodeMarkerPattern + `@?(?<episode>\\d+)(?:[a-d](?![a-z0-9]))?(?:v(?<version>\\d+))?`
|
|
3523
3523
|
).repeater("+").regex(
|
|
3524
3524
|
allSeparatorsPattern + `@?(?<episode>\\d+)`
|
|
3525
3525
|
).repeater("*");
|
|
@@ -3679,13 +3679,13 @@ function episodes(config) {
|
|
|
3679
3679
|
rebulk.chain({
|
|
3680
3680
|
tags: ["weak-episode"],
|
|
3681
3681
|
disabled: (context) => context?.type === "movie" || isDisabled(context, "episode")
|
|
3682
|
-
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])(?<episode>\\d{2})(?!(?:st|nd|rd|th)\\b)(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{2})`, {
|
|
3682
|
+
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])(?<episode>\\d{2})(?!(?:st|nd|rd|th)\\b)(?!%)(?:[a-d](?![a-z0-9]))?(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{2})`, {
|
|
3683
3683
|
abbreviations: null
|
|
3684
3684
|
}).repeater("*");
|
|
3685
3685
|
rebulk.chain({
|
|
3686
3686
|
tags: ["weak-episode"],
|
|
3687
3687
|
disabled: (context) => context?.type === "movie" || isDisabled(context, "episode")
|
|
3688
|
-
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])0(?<episode>\\d{1,2})(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])0(?<episode>\\d{1,2})`, {
|
|
3688
|
+
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])0(?<episode>\\d{1,2})(?!%)(?:[a-d](?![a-z0-9]))?(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])0(?<episode>\\d{1,2})`, {
|
|
3689
3689
|
abbreviations: null
|
|
3690
3690
|
}).repeater("*");
|
|
3691
3691
|
rebulk.chain({
|
|
@@ -3696,13 +3696,13 @@ function episodes(config) {
|
|
|
3696
3696
|
validator: null,
|
|
3697
3697
|
tags: ["weak-episode"],
|
|
3698
3698
|
name: "weak_episode"
|
|
3699
|
-
}).regex(`(?<![^\\W_])(?<episode>\\d{3,4})(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{3,4})`, {
|
|
3699
|
+
}).regex(`(?<![^\\W_])(?<episode>\\d{3,4})(?!%)(?:[a-d](?![a-z0-9]))?(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{3,4})`, {
|
|
3700
3700
|
abbreviations: null
|
|
3701
3701
|
}).repeater("*");
|
|
3702
3702
|
rebulk.chain({
|
|
3703
3703
|
tags: ["weak-episode"],
|
|
3704
3704
|
disabled: (context) => context?.type !== "episode" || isDisabled(context, "episode")
|
|
3705
|
-
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])(?<episode>\\d)(?!-[a-z])(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{1,2})`, {
|
|
3705
|
+
}).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<![^\\W_])(?<episode>\\d)(?!-[a-z])(?!%)(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{1,2})`, {
|
|
3706
3706
|
abbreviations: null
|
|
3707
3707
|
}).repeater("*");
|
|
3708
3708
|
rebulk.chain({
|
|
@@ -3731,7 +3731,7 @@ function episodes(config) {
|
|
|
3731
3731
|
name: "weak_duplicate",
|
|
3732
3732
|
validator: null,
|
|
3733
3733
|
conflictSolver: seasonEpisodeConflictSolver
|
|
3734
|
-
}).regex(`(?<![^\\W_])(?<season>\\d{1,2})(?<episode>\\d{2})(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>x|-)(?<episode>\\d{2})`, {
|
|
3734
|
+
}).regex(`(?<![^\\W_])(?<season>\\d{1,2})(?<episode>\\d{2})(?!%)(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>x|-)(?<episode>\\d{2})`, {
|
|
3735
3735
|
abbreviations: null
|
|
3736
3736
|
}).repeater("*");
|
|
3737
3737
|
rebulk.regex(`v(?<version>\\d+)`, {
|
|
@@ -3759,6 +3759,8 @@ function episodes(config) {
|
|
|
3759
3759
|
disabled: (context) => isDisabled(context, "episode_format")
|
|
3760
3760
|
});
|
|
3761
3761
|
rebulk.rules(
|
|
3762
|
+
EventNumberAsTitleRule,
|
|
3763
|
+
EpisodeWordBeforeYearAsTitle,
|
|
3762
3764
|
RemoveGroupSuffixSeason,
|
|
3763
3765
|
AnimeTrailingEpisodeRule,
|
|
3764
3766
|
PreferAnchoredWeakEpisodeRule,
|
|
@@ -3815,6 +3817,79 @@ const _RemoveGroupSuffixSeason = class _RemoveGroupSuffixSeason extends Rule {
|
|
|
3815
3817
|
};
|
|
3816
3818
|
_RemoveGroupSuffixSeason.priority = 72;
|
|
3817
3819
|
let RemoveGroupSuffixSeason = _RemoveGroupSuffixSeason;
|
|
3820
|
+
const _EventNumberAsTitleRule = class _EventNumberAsTitleRule extends Rule {
|
|
3821
|
+
constructor() {
|
|
3822
|
+
super(...arguments);
|
|
3823
|
+
this.priority = 60;
|
|
3824
|
+
this.consequence = RemoveMatch;
|
|
3825
|
+
}
|
|
3826
|
+
when(matches, _context) {
|
|
3827
|
+
const input = matches.inputString ?? "";
|
|
3828
|
+
const toRemove = [];
|
|
3829
|
+
const isWeak = (m) => !!(m.tags?.includes("weak-episode") || ["weak_episode", "weak_duplicate"].includes(m.initiator?.name));
|
|
3830
|
+
for (const filepart of matches.markers.named("path") ?? []) {
|
|
3831
|
+
const weaks = matches.range(
|
|
3832
|
+
filepart.start,
|
|
3833
|
+
filepart.end,
|
|
3834
|
+
(m) => m.name === "episode" && !m.private && isWeak(m)
|
|
3835
|
+
) ?? [];
|
|
3836
|
+
if (!weaks.length) continue;
|
|
3837
|
+
const strong = matches.range(filepart.start, filepart.end, (m) => !m.private && (m.name === "season" || m.name === "year" || m.name === "date" || m.name === "episode" && m.tags?.includes("SxxExx")), 0);
|
|
3838
|
+
for (const w of weaks) {
|
|
3839
|
+
const init = w.initiator ?? w;
|
|
3840
|
+
const after = input.slice(init.end, init.end + 5);
|
|
3841
|
+
if (/^[\s._-]?PPV/i.test(after)) {
|
|
3842
|
+
for (const c of [init, ...init.children ?? []]) if (!toRemove.includes(c)) toRemove.push(c);
|
|
3843
|
+
continue;
|
|
3844
|
+
}
|
|
3845
|
+
if (!strong && init.start === filepart.start && /^[1-9]\d$/.test(String(init.raw ?? ""))) {
|
|
3846
|
+
const rest = input.slice(init.end, filepart.end);
|
|
3847
|
+
const words = rest.match(/[A-Za-z][a-z]+/g) ?? [];
|
|
3848
|
+
if (words.length >= 2) {
|
|
3849
|
+
for (const c of [init, ...init.children ?? []]) if (!toRemove.includes(c)) toRemove.push(c);
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3852
|
+
}
|
|
3853
|
+
}
|
|
3854
|
+
return toRemove.length ? toRemove : false;
|
|
3855
|
+
}
|
|
3856
|
+
};
|
|
3857
|
+
_EventNumberAsTitleRule.priority = 60;
|
|
3858
|
+
let EventNumberAsTitleRule = _EventNumberAsTitleRule;
|
|
3859
|
+
const _EpisodeWordBeforeYearAsTitle = class _EpisodeWordBeforeYearAsTitle extends Rule {
|
|
3860
|
+
constructor() {
|
|
3861
|
+
super(...arguments);
|
|
3862
|
+
this.priority = 60;
|
|
3863
|
+
this.consequence = RemoveMatch;
|
|
3864
|
+
}
|
|
3865
|
+
when(matches, _context) {
|
|
3866
|
+
const toRemove = [];
|
|
3867
|
+
for (const episode of matches.named("episode") ?? []) {
|
|
3868
|
+
const init = episode.initiator ?? episode;
|
|
3869
|
+
const marker = [...init.children ?? []].find((c) => c.name === "episodeMarker");
|
|
3870
|
+
if (!marker || String(marker.raw ?? "").length < 3) continue;
|
|
3871
|
+
const filepart = matches.markers.atMatch(episode, (m) => m.name === "path", 0);
|
|
3872
|
+
if (!filepart) continue;
|
|
3873
|
+
const year = matches.range(episode.end, filepart.end, (m) => !m.private && m.name === "year", 0);
|
|
3874
|
+
if (!year) continue;
|
|
3875
|
+
const seasonish = matches.range(
|
|
3876
|
+
filepart.start,
|
|
3877
|
+
filepart.end,
|
|
3878
|
+
(m) => !m.private && (m.name === "season" || m.name === "episode" && m.tags?.includes("SxxExx")),
|
|
3879
|
+
0
|
|
3880
|
+
);
|
|
3881
|
+
if (seasonish) continue;
|
|
3882
|
+
const between = String(matches.inputString ?? "").slice(episode.end, year.start);
|
|
3883
|
+
if (!/[a-zA-Z]{2,}/.test(between)) continue;
|
|
3884
|
+
toRemove.push(episode);
|
|
3885
|
+
if (!toRemove.includes(init)) toRemove.push(init);
|
|
3886
|
+
for (const c of init.children ?? []) if (!toRemove.includes(c)) toRemove.push(c);
|
|
3887
|
+
}
|
|
3888
|
+
return toRemove.length ? toRemove : false;
|
|
3889
|
+
}
|
|
3890
|
+
};
|
|
3891
|
+
_EpisodeWordBeforeYearAsTitle.priority = 60;
|
|
3892
|
+
let EpisodeWordBeforeYearAsTitle = _EpisodeWordBeforeYearAsTitle;
|
|
3818
3893
|
const _AnimeTrailingEpisodeRule = class _AnimeTrailingEpisodeRule extends Rule {
|
|
3819
3894
|
constructor() {
|
|
3820
3895
|
super(...arguments);
|
|
@@ -7024,8 +7099,10 @@ const _BracketedTitleFallback = class _BracketedTitleFallback extends Rule {
|
|
|
7024
7099
|
const toRemove = [];
|
|
7025
7100
|
const toAppend = [];
|
|
7026
7101
|
for (const filepart of matches.markers.named("path")) {
|
|
7027
|
-
const
|
|
7028
|
-
|
|
7102
|
+
const titlesHere = matches.range(filepart.start, filepart.end, (m) => m.name === "title") ?? [];
|
|
7103
|
+
const realTitle = titlesHere.find((t) => /[\p{L}\p{N}]/u.test(String(t.value ?? "")));
|
|
7104
|
+
if (realTitle) continue;
|
|
7105
|
+
toRemove.push(...titlesHere);
|
|
7029
7106
|
const groups2 = matches.markers.range(filepart.start, filepart.end, (m) => m.name === "group") ?? [];
|
|
7030
7107
|
if (!groups2.length) continue;
|
|
7031
7108
|
const rg = matches.range(filepart.start, filepart.end, (m) => m.name === "release_group", 0);
|
|
@@ -7034,6 +7111,25 @@ const _BracketedTitleFallback = class _BracketedTitleFallback extends Rule {
|
|
|
7034
7111
|
if (rg && g.start <= rg.start && g.end >= rg.end) continue;
|
|
7035
7112
|
const core = input.slice(g.start + 1, g.end - 1);
|
|
7036
7113
|
if (!/[a-zA-Z]{2,}/.test(core)) continue;
|
|
7114
|
+
const softInner = matches.range(
|
|
7115
|
+
g.start,
|
|
7116
|
+
g.end,
|
|
7117
|
+
(m) => !m.private && ["episode_title", "alternative_title"].includes(m.name ?? "")
|
|
7118
|
+
) ?? [];
|
|
7119
|
+
const hardInner = matches.range(
|
|
7120
|
+
g.start,
|
|
7121
|
+
g.end,
|
|
7122
|
+
(m) => !m.private && !["episode_title", "alternative_title"].includes(m.name ?? "")
|
|
7123
|
+
) ?? [];
|
|
7124
|
+
if (softInner.length && !hardInner.length) {
|
|
7125
|
+
toRemove.push(...softInner);
|
|
7126
|
+
candidate = new Match(g.start + 1, g.end - 1, {
|
|
7127
|
+
name: "title",
|
|
7128
|
+
value: cleanup(input.slice(g.start + 1, g.end - 1)),
|
|
7129
|
+
inputString: input
|
|
7130
|
+
});
|
|
7131
|
+
break;
|
|
7132
|
+
}
|
|
7037
7133
|
const hole = matches.holes(g.start + 1, g.end - 1, {
|
|
7038
7134
|
formatter: cleanup,
|
|
7039
7135
|
predicate: (h) => !!h.value,
|
|
@@ -7101,6 +7197,76 @@ const _WordNumeralPartAtTitlePosition = class _WordNumeralPartAtTitlePosition ex
|
|
|
7101
7197
|
};
|
|
7102
7198
|
_WordNumeralPartAtTitlePosition.priority = 64;
|
|
7103
7199
|
let WordNumeralPartAtTitlePosition = _WordNumeralPartAtTitlePosition;
|
|
7200
|
+
const _BonusAtTitlePositionRule = class _BonusAtTitlePositionRule extends Rule {
|
|
7201
|
+
constructor() {
|
|
7202
|
+
super(...arguments);
|
|
7203
|
+
this.priority = 64;
|
|
7204
|
+
this.consequence = RemoveMatch;
|
|
7205
|
+
}
|
|
7206
|
+
when(matches, context) {
|
|
7207
|
+
if (isDisabled(context, "bonus")) return false;
|
|
7208
|
+
const toRemove = [];
|
|
7209
|
+
for (const bonus2 of matches.named("bonus") ?? []) {
|
|
7210
|
+
const filepart = matches.markers.atMatch(bonus2, (m) => m.name === "path", 0);
|
|
7211
|
+
if (!filepart) continue;
|
|
7212
|
+
const anime = matches.range(filepart.start, filepart.end, (m) => m.name === "crc32", 0) || matches.markers.range(
|
|
7213
|
+
filepart.start,
|
|
7214
|
+
filepart.end,
|
|
7215
|
+
(m) => m.name === "group" && m.start === filepart.start,
|
|
7216
|
+
0
|
|
7217
|
+
);
|
|
7218
|
+
if (!anime) continue;
|
|
7219
|
+
const anchor = matches.range(
|
|
7220
|
+
bonus2.end,
|
|
7221
|
+
filepart.end,
|
|
7222
|
+
(m) => !m.private && ["episode", "season", "year", "date"].includes(m.name ?? ""),
|
|
7223
|
+
0
|
|
7224
|
+
);
|
|
7225
|
+
const bonusTitles = matches.named("bonus_title") ?? [];
|
|
7226
|
+
if (!anchor && !bonusTitles.length) continue;
|
|
7227
|
+
toRemove.push(bonus2);
|
|
7228
|
+
toRemove.push(...bonusTitles.filter((bt) => bt.start >= filepart.start && bt.end <= filepart.end));
|
|
7229
|
+
}
|
|
7230
|
+
return toRemove.length ? toRemove : false;
|
|
7231
|
+
}
|
|
7232
|
+
};
|
|
7233
|
+
_BonusAtTitlePositionRule.priority = 64;
|
|
7234
|
+
let BonusAtTitlePositionRule = _BonusAtTitlePositionRule;
|
|
7235
|
+
const _LanguageWordInAnimeTitle = class _LanguageWordInAnimeTitle extends Rule {
|
|
7236
|
+
constructor() {
|
|
7237
|
+
super(...arguments);
|
|
7238
|
+
this.priority = 64;
|
|
7239
|
+
this.consequence = RemoveMatch;
|
|
7240
|
+
}
|
|
7241
|
+
when(matches, context) {
|
|
7242
|
+
if (isDisabled(context, "language")) return false;
|
|
7243
|
+
const toRemove = [];
|
|
7244
|
+
for (const lang of matches.named("language") ?? []) {
|
|
7245
|
+
const raw = String(lang.raw ?? "");
|
|
7246
|
+
if (raw.length > 3 || !/^[A-Z][a-z]{0,2}$/.test(raw)) continue;
|
|
7247
|
+
const filepart = matches.markers.atMatch(lang, (m) => m.name === "path", 0);
|
|
7248
|
+
if (!filepart) continue;
|
|
7249
|
+
const leadingBracket = matches.markers.range(
|
|
7250
|
+
filepart.start,
|
|
7251
|
+
filepart.end,
|
|
7252
|
+
(m) => m.name === "group" && m.start === filepart.start,
|
|
7253
|
+
0
|
|
7254
|
+
);
|
|
7255
|
+
if (!leadingBracket) continue;
|
|
7256
|
+
const anchor = matches.range(
|
|
7257
|
+
lang.end,
|
|
7258
|
+
filepart.end,
|
|
7259
|
+
(m) => !m.private && ["episode", "season", "year", "date"].includes(m.name ?? ""),
|
|
7260
|
+
0
|
|
7261
|
+
);
|
|
7262
|
+
if (!anchor) continue;
|
|
7263
|
+
toRemove.push(lang);
|
|
7264
|
+
}
|
|
7265
|
+
return toRemove.length ? toRemove : false;
|
|
7266
|
+
}
|
|
7267
|
+
};
|
|
7268
|
+
_LanguageWordInAnimeTitle.priority = 64;
|
|
7269
|
+
let LanguageWordInAnimeTitle = _LanguageWordInAnimeTitle;
|
|
7104
7270
|
const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle extends Rule {
|
|
7105
7271
|
constructor() {
|
|
7106
7272
|
super(...arguments);
|
|
@@ -7118,7 +7284,16 @@ const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle ex
|
|
|
7118
7284
|
(m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
|
|
7119
7285
|
0
|
|
7120
7286
|
);
|
|
7121
|
-
if (!anchor)
|
|
7287
|
+
if (!anchor) {
|
|
7288
|
+
const anyTitle = matches.range(filepart.start, filepart.end, (m) => m.name === "title", 0);
|
|
7289
|
+
if (lead.name === "year" && lead.start === filepart.start && !anyTitle) {
|
|
7290
|
+
lead.name = "title";
|
|
7291
|
+
lead.value = String(matches.inputString ?? "").slice(lead.start, lead.end);
|
|
7292
|
+
out.push(lead);
|
|
7293
|
+
continue;
|
|
7294
|
+
}
|
|
7295
|
+
continue;
|
|
7296
|
+
}
|
|
7122
7297
|
const yearTitled = lead.name === "year" && ["season", "episode"].includes(anchor.name ?? "") && !anchor.tags?.includes("weak-episode") && !anchor.tags?.includes("weak-duplicate");
|
|
7123
7298
|
if (!yearTitled && !["other", "country", "edition"].includes(lead.name ?? "")) continue;
|
|
7124
7299
|
const titles = matches.range(filepart.start, filepart.end, (m) => m.name === "title") ?? [];
|
|
@@ -7252,7 +7427,7 @@ function title(config) {
|
|
|
7252
7427
|
const rebulk = new Rebulk({
|
|
7253
7428
|
disabled: (context) => isDisabled(context, "title")
|
|
7254
7429
|
});
|
|
7255
|
-
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, WordNumeralPartAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle, TrimSeasonWordFromTitle);
|
|
7430
|
+
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, WordNumeralPartAtTitlePosition, BonusAtTitlePositionRule, LanguageWordInAnimeTitle, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle, TrimSeasonWordFromTitle);
|
|
7256
7431
|
const expectedTitle = buildExpectedFunction("expected_title");
|
|
7257
7432
|
rebulk.functional(expectedTitle, {
|
|
7258
7433
|
name: "title",
|
|
@@ -9244,6 +9419,7 @@ function releaseGroup(config) {
|
|
|
9244
9419
|
new SceneReleaseGroup(cleanGroupname),
|
|
9245
9420
|
AnimeReleaseGroup,
|
|
9246
9421
|
new TrailingTokenAfterEpisodeAsReleaseGroup(cleanGroupname),
|
|
9422
|
+
NumericPrefixedGroupRule,
|
|
9247
9423
|
RemoveSeasonPackReleaseGroup
|
|
9248
9424
|
);
|
|
9249
9425
|
}
|
|
@@ -9589,6 +9765,39 @@ _AnimeReleaseGroup.dependency = ["SceneReleaseGroup", "TitleFromPosition"];
|
|
|
9589
9765
|
_AnimeReleaseGroup.consequence = [RemoveMatch, AppendMatch];
|
|
9590
9766
|
_AnimeReleaseGroup.properties = { release_group: [null] };
|
|
9591
9767
|
let AnimeReleaseGroup = _AnimeReleaseGroup;
|
|
9768
|
+
const _NumericPrefixedGroupRule = class _NumericPrefixedGroupRule extends Rule {
|
|
9769
|
+
constructor() {
|
|
9770
|
+
super(...arguments);
|
|
9771
|
+
this.priority = -32;
|
|
9772
|
+
this.consequence = [RemoveMatch, AppendMatch];
|
|
9773
|
+
}
|
|
9774
|
+
when(matches, _context) {
|
|
9775
|
+
const input = matches.inputString ?? "";
|
|
9776
|
+
const toRemove = [];
|
|
9777
|
+
const toAppend = [];
|
|
9778
|
+
for (const rg of matches.named("release_group") ?? []) {
|
|
9779
|
+
const m = /^(\d{1,3})\s*\[([^\]]+)\]$/.exec(String(rg.value ?? ""));
|
|
9780
|
+
if (!m) continue;
|
|
9781
|
+
const raw = input.slice(rg.start, rg.end);
|
|
9782
|
+
const numLen = m[1].length;
|
|
9783
|
+
toRemove.push(rg);
|
|
9784
|
+
toAppend.push(new Match(rg.start, rg.start + numLen, {
|
|
9785
|
+
name: "episode",
|
|
9786
|
+
value: parseInt(m[1], 10),
|
|
9787
|
+
inputString: input
|
|
9788
|
+
}));
|
|
9789
|
+
const inner = raw.indexOf("[");
|
|
9790
|
+
toAppend.push(new Match(rg.start + inner + 1, rg.end - 1, {
|
|
9791
|
+
name: "release_group",
|
|
9792
|
+
value: m[2],
|
|
9793
|
+
inputString: input
|
|
9794
|
+
}));
|
|
9795
|
+
}
|
|
9796
|
+
return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
|
|
9797
|
+
}
|
|
9798
|
+
};
|
|
9799
|
+
_NumericPrefixedGroupRule.priority = -32;
|
|
9800
|
+
let NumericPrefixedGroupRule = _NumericPrefixedGroupRule;
|
|
9592
9801
|
const _TrailingTokenAfterEpisodeAsReleaseGroup = class _TrailingTokenAfterEpisodeAsReleaseGroup extends Rule {
|
|
9593
9802
|
constructor(valueFormatter) {
|
|
9594
9803
|
super();
|
|
@@ -10798,10 +11007,11 @@ function imdb(_config) {
|
|
|
10798
11007
|
function volume(_config) {
|
|
10799
11008
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "volume") });
|
|
10800
11009
|
rebulk.regexDefaults({ flags: "i" });
|
|
10801
|
-
rebulk.regex("vol(?:\\d{1,3}|(?:ume)?[-. ]\\d{1,3})", {
|
|
11010
|
+
rebulk.regex("vol(?:\\d{1,3}|(?:ume)?[-. ]{1,2}\\d{1,3})(?:v\\d)?(?:[&+]\\d{1,3})?", {
|
|
10802
11011
|
name: "volume",
|
|
10803
11012
|
validator: sepsSurround,
|
|
10804
|
-
formatter: (value) => parseInt(value.replace(
|
|
11013
|
+
formatter: (value) => parseInt(String(value).replace(/^vol(?:ume)?[-. ]*/i, "").replace(/[v&+].*$/i, ""), 10),
|
|
11014
|
+
conflictSolver: (match, other2) => other2.name === "episode" || other2.name === "season" ? other2 : "__default__"
|
|
10805
11015
|
});
|
|
10806
11016
|
return rebulk;
|
|
10807
11017
|
}
|
|
@@ -11426,8 +11636,8 @@ const advanced_config = {
|
|
|
11426
11636
|
"sub"
|
|
11427
11637
|
],
|
|
11428
11638
|
groups: {
|
|
11429
|
-
starting: "([{",
|
|
11430
|
-
ending: ")]}"
|
|
11639
|
+
starting: "([{【「(",
|
|
11640
|
+
ending: ")]}】」)"
|
|
11431
11641
|
},
|
|
11432
11642
|
audio_codec: {
|
|
11433
11643
|
audio_codec: {
|
|
@@ -12579,7 +12789,8 @@ const advanced_config = {
|
|
|
12579
12789
|
string: [
|
|
12580
12790
|
"Ova",
|
|
12581
12791
|
"Oav"
|
|
12582
|
-
]
|
|
12792
|
+
],
|
|
12793
|
+
tags: "title-word"
|
|
12583
12794
|
},
|
|
12584
12795
|
"Original Net Animation": "Ona",
|
|
12585
12796
|
"Original Animation DVD": "Oad",
|