guessit-js 4.4.0 → 4.4.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/dist/guessit-js.cjs +81 -8
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +81 -8
- package/dist/guessit-js.js.map +1 -1
- package/package.json +1 -1
package/dist/guessit-js.js
CHANGED
|
@@ -3736,6 +3736,7 @@ function episodes(config) {
|
|
|
3736
3736
|
disabled: (context) => isDisabled(context, "episode_format")
|
|
3737
3737
|
});
|
|
3738
3738
|
rebulk.rules(
|
|
3739
|
+
RemoveGroupSuffixSeason,
|
|
3739
3740
|
AnimeTrailingEpisodeRule,
|
|
3740
3741
|
PreferAnchoredWeakEpisodeRule,
|
|
3741
3742
|
SeasonWordDashedEpisodeRule,
|
|
@@ -3754,6 +3755,43 @@ function episodes(config) {
|
|
|
3754
3755
|
);
|
|
3755
3756
|
return rebulk;
|
|
3756
3757
|
}
|
|
3758
|
+
const _RemoveGroupSuffixSeason = class _RemoveGroupSuffixSeason extends Rule {
|
|
3759
|
+
constructor() {
|
|
3760
|
+
super(...arguments);
|
|
3761
|
+
this.priority = 72;
|
|
3762
|
+
this.consequence = RemoveMatch;
|
|
3763
|
+
}
|
|
3764
|
+
when(matches, _context) {
|
|
3765
|
+
const input = matches.inputString ?? "";
|
|
3766
|
+
const toRemove = [];
|
|
3767
|
+
const TOKENS = /* @__PURE__ */ new Set(["audio_codec", "audio_channels", "video_codec", "audio_profile", "other"]);
|
|
3768
|
+
for (const season of matches.named("season") ?? []) {
|
|
3769
|
+
const init = season.initiator ?? season;
|
|
3770
|
+
if (!/^s\d{1,3}$/i.test(String(init.raw ?? ""))) continue;
|
|
3771
|
+
const hasEpisode = [...init.children ?? []].some((c) => c.name === "episode");
|
|
3772
|
+
if (hasEpisode) continue;
|
|
3773
|
+
if (input[init.start - 1] !== "-") continue;
|
|
3774
|
+
const prev = matches.range(
|
|
3775
|
+
Math.max(0, init.start - 12),
|
|
3776
|
+
init.start - 1,
|
|
3777
|
+
(m) => !m.private && TOKENS.has(m.name ?? ""),
|
|
3778
|
+
-1
|
|
3779
|
+
) ?? matches.range(
|
|
3780
|
+
Math.max(0, init.start - 12),
|
|
3781
|
+
init.start - 1,
|
|
3782
|
+
(m) => !m.private && TOKENS.has(m.name ?? ""),
|
|
3783
|
+
0
|
|
3784
|
+
);
|
|
3785
|
+
const inGroup = matches.markers.atMatch(init, (m) => m.name === "group", 0);
|
|
3786
|
+
if (!prev && !inGroup) continue;
|
|
3787
|
+
toRemove.push(season);
|
|
3788
|
+
for (const c of init.children ?? []) if (!toRemove.includes(c)) toRemove.push(c);
|
|
3789
|
+
}
|
|
3790
|
+
return toRemove.length ? toRemove : false;
|
|
3791
|
+
}
|
|
3792
|
+
};
|
|
3793
|
+
_RemoveGroupSuffixSeason.priority = 72;
|
|
3794
|
+
let RemoveGroupSuffixSeason = _RemoveGroupSuffixSeason;
|
|
3757
3795
|
const _AnimeTrailingEpisodeRule = class _AnimeTrailingEpisodeRule extends Rule {
|
|
3758
3796
|
constructor() {
|
|
3759
3797
|
super(...arguments);
|
|
@@ -7009,6 +7047,36 @@ const _BracketedTitleFallback = class _BracketedTitleFallback extends Rule {
|
|
|
7009
7047
|
};
|
|
7010
7048
|
_BracketedTitleFallback.priority = POST_PROCESS;
|
|
7011
7049
|
let BracketedTitleFallback = _BracketedTitleFallback;
|
|
7050
|
+
const _WordNumeralPartAtTitlePosition = class _WordNumeralPartAtTitlePosition extends Rule {
|
|
7051
|
+
constructor() {
|
|
7052
|
+
super(...arguments);
|
|
7053
|
+
this.priority = 64;
|
|
7054
|
+
this.consequence = RemoveMatch;
|
|
7055
|
+
}
|
|
7056
|
+
when(matches, context) {
|
|
7057
|
+
if (isDisabled(context, "part")) return false;
|
|
7058
|
+
const toRemove = [];
|
|
7059
|
+
for (const part2 of matches.named("part") ?? []) {
|
|
7060
|
+
const target = part2.initiator ?? part2;
|
|
7061
|
+
if (/\d/.test(String(target.raw ?? ""))) continue;
|
|
7062
|
+
const filepart = matches.markers.atMatch(part2, (m) => m.name === "path", 0);
|
|
7063
|
+
if (!filepart) continue;
|
|
7064
|
+
const anchor = matches.range(
|
|
7065
|
+
part2.end,
|
|
7066
|
+
filepart.end,
|
|
7067
|
+
(m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
|
|
7068
|
+
0
|
|
7069
|
+
);
|
|
7070
|
+
if (!anchor) continue;
|
|
7071
|
+
toRemove.push(part2);
|
|
7072
|
+
for (const c of [...target.children ?? []]) if (!toRemove.includes(c)) toRemove.push(c);
|
|
7073
|
+
if (target !== part2 && !toRemove.includes(target)) toRemove.push(target);
|
|
7074
|
+
}
|
|
7075
|
+
return toRemove.length ? toRemove : false;
|
|
7076
|
+
}
|
|
7077
|
+
};
|
|
7078
|
+
_WordNumeralPartAtTitlePosition.priority = 64;
|
|
7079
|
+
let WordNumeralPartAtTitlePosition = _WordNumeralPartAtTitlePosition;
|
|
7012
7080
|
const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle extends Rule {
|
|
7013
7081
|
constructor() {
|
|
7014
7082
|
super(...arguments);
|
|
@@ -7018,18 +7086,22 @@ const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle ex
|
|
|
7018
7086
|
const inp = matches.inputString || "";
|
|
7019
7087
|
const out = [];
|
|
7020
7088
|
for (const filepart of matches.markers.named("path")) {
|
|
7021
|
-
|
|
7089
|
+
const lead = matches.range(filepart.start, filepart.end, (m) => !m.private && !!m.value, 0);
|
|
7090
|
+
if (!lead) continue;
|
|
7022
7091
|
const anchor = matches.range(
|
|
7023
|
-
|
|
7092
|
+
lead.end,
|
|
7024
7093
|
filepart.end,
|
|
7025
7094
|
(m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
|
|
7026
7095
|
0
|
|
7027
7096
|
);
|
|
7028
7097
|
if (!anchor) continue;
|
|
7029
|
-
const
|
|
7030
|
-
if (!
|
|
7031
|
-
|
|
7032
|
-
if ((
|
|
7098
|
+
const yearTitled = lead.name === "year" && ["season", "episode"].includes(anchor.name ?? "") && !anchor.tags?.includes("weak-episode") && !anchor.tags?.includes("weak-duplicate");
|
|
7099
|
+
if (!yearTitled && !["other", "country", "edition"].includes(lead.name ?? "")) continue;
|
|
7100
|
+
const titles = matches.range(filepart.start, filepart.end, (m) => m.name === "title") ?? [];
|
|
7101
|
+
if (titles.some((t) => t.start < anchor.end)) continue;
|
|
7102
|
+
if (titles.length && !yearTitled) continue;
|
|
7103
|
+
out.push(...titles);
|
|
7104
|
+
if (lead.name !== "year" && (lead.raw ?? "") === String(lead.value ?? "")) continue;
|
|
7033
7105
|
if (![...inp.slice(filepart.start, lead.start)].every((c) => seps.includes(c))) continue;
|
|
7034
7106
|
out.push(lead);
|
|
7035
7107
|
}
|
|
@@ -7156,7 +7228,7 @@ function title(config) {
|
|
|
7156
7228
|
const rebulk = new Rebulk({
|
|
7157
7229
|
disabled: (context) => isDisabled(context, "title")
|
|
7158
7230
|
});
|
|
7159
|
-
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle, TrimSeasonWordFromTitle);
|
|
7231
|
+
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, WordNumeralPartAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle, TrimSeasonWordFromTitle);
|
|
7160
7232
|
const expectedTitle = buildExpectedFunction("expected_title");
|
|
7161
7233
|
rebulk.functional(expectedTitle, {
|
|
7162
7234
|
name: "title",
|
|
@@ -11353,7 +11425,8 @@ const advanced_config = {
|
|
|
11353
11425
|
regex: [
|
|
11354
11426
|
"Dolby-Digital",
|
|
11355
11427
|
"DD",
|
|
11356
|
-
"AC-?3D?"
|
|
11428
|
+
"AC-?3D?",
|
|
11429
|
+
"DolbyD"
|
|
11357
11430
|
]
|
|
11358
11431
|
},
|
|
11359
11432
|
"Dolby Atmos": {
|