guessit-js 4.3.0 → 4.3.2
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 +86 -3
- package/dist/guessit-js.cjs.map +1 -1
- package/dist/guessit-js.js +86 -3
- package/dist/guessit-js.js.map +1 -1
- package/package.json +1 -1
package/dist/guessit-js.js
CHANGED
|
@@ -3375,7 +3375,8 @@ function seasonEpisodeConflictSolver(match, other2) {
|
|
|
3375
3375
|
return "__default__";
|
|
3376
3376
|
}
|
|
3377
3377
|
function orderingValidator(match) {
|
|
3378
|
-
const
|
|
3378
|
+
const dict = match.children?.toDict?.() ?? match.children?.to_dict?.();
|
|
3379
|
+
const values = dict instanceof Map ? Object.fromEntries(dict) : dict || {};
|
|
3379
3380
|
if (values.season && Array.isArray(values.season)) {
|
|
3380
3381
|
const sorted = [...values.season].sort((a, b) => a - b);
|
|
3381
3382
|
if (JSON.stringify(sorted) !== JSON.stringify(values.season)) {
|
|
@@ -4550,6 +4551,14 @@ function source(config) {
|
|
|
4550
4551
|
...buildSourcePattern(["HD-?CAM"], "", optional(ripSuffix)),
|
|
4551
4552
|
{ value: { source: "HD Camera", other: "Rip" } }
|
|
4552
4553
|
);
|
|
4554
|
+
rebulk.regex(
|
|
4555
|
+
...buildSourcePattern(["HQ-?CAM"], "", optional(ripSuffix)),
|
|
4556
|
+
{ value: { source: "Camera", other: "Rip" } }
|
|
4557
|
+
);
|
|
4558
|
+
rebulk.regex(
|
|
4559
|
+
...buildSourcePattern(["S-?Print"], "", optional(ripSuffix)),
|
|
4560
|
+
{ value: { source: "Camera" } }
|
|
4561
|
+
);
|
|
4553
4562
|
rebulk.regex(
|
|
4554
4563
|
...buildSourcePattern(["TELESYNC", "TS"], "", optional(ripSuffix)),
|
|
4555
4564
|
{ value: { source: "Telesync", other: "Rip" }, tags: ["video-codec-prefix"], overrides: ["tags"] }
|
|
@@ -4598,6 +4607,10 @@ function source(config) {
|
|
|
4598
4607
|
...buildSourcePattern(["DVD"], "", optional(ripSuffix)),
|
|
4599
4608
|
{ value: { source: "DVD", other: "Rip" } }
|
|
4600
4609
|
);
|
|
4610
|
+
rebulk.regex(
|
|
4611
|
+
...buildSourcePattern(["DVD-?R[59]"], "", ""),
|
|
4612
|
+
{ value: { source: "DVD" } }
|
|
4613
|
+
);
|
|
4601
4614
|
rebulk.regex(
|
|
4602
4615
|
...buildSourcePattern(["LD"], "", ripSuffix),
|
|
4603
4616
|
{ value: { source: "Laserdisc", other: "Rip" } }
|
|
@@ -6223,6 +6236,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
|
|
|
6223
6236
|
const lastSeg = createMatch(prevEnd, hole.end);
|
|
6224
6237
|
if (lastSeg) segments.push(lastSeg);
|
|
6225
6238
|
if (segments.length < 2) return null;
|
|
6239
|
+
if (/^\d+$/.test(String(segments[0].value ?? "").trim())) return null;
|
|
6226
6240
|
return { title: segments[0], alternatives: segments.slice(1) };
|
|
6227
6241
|
}
|
|
6228
6242
|
/**
|
|
@@ -6841,6 +6855,38 @@ const _SplitOriginalScriptTitle = class _SplitOriginalScriptTitle extends Rule {
|
|
|
6841
6855
|
};
|
|
6842
6856
|
_SplitOriginalScriptTitle.priority = POST_PROCESS;
|
|
6843
6857
|
let SplitOriginalScriptTitle = _SplitOriginalScriptTitle;
|
|
6858
|
+
const _TrimSeasonWordFromTitle = class _TrimSeasonWordFromTitle extends Rule {
|
|
6859
|
+
constructor() {
|
|
6860
|
+
super(...arguments);
|
|
6861
|
+
this.priority = POST_PROCESS;
|
|
6862
|
+
this.consequence = [RemoveMatch, AppendMatch];
|
|
6863
|
+
}
|
|
6864
|
+
when(matches, context) {
|
|
6865
|
+
if (isDisabled(context, "title")) return false;
|
|
6866
|
+
const input = matches.inputString ?? "";
|
|
6867
|
+
const toRemove = [];
|
|
6868
|
+
const toAppend = [];
|
|
6869
|
+
for (const title2 of matches.named("title") ?? []) {
|
|
6870
|
+
const m = /^(.*\S)[\s._-]+(seasons?|saison)$/i.exec(String(title2.value ?? ""));
|
|
6871
|
+
if (!m) continue;
|
|
6872
|
+
const next = matches.range(title2.end, input.length, (mm) => !mm.private && !!mm.value, 0);
|
|
6873
|
+
if (!next || next.name !== "season") continue;
|
|
6874
|
+
toRemove.push(title2);
|
|
6875
|
+
input.slice(title2.start, title2.end).slice(0, m[1].length + (String(title2.value).length === title2.end - title2.start ? 0 : 0));
|
|
6876
|
+
let newEnd = title2.end;
|
|
6877
|
+
while (newEnd > title2.start && cleanup(input.slice(title2.start, newEnd)).toLowerCase() !== m[1].toLowerCase()) newEnd--;
|
|
6878
|
+
if (newEnd <= title2.start) continue;
|
|
6879
|
+
toAppend.push(new Match(title2.start, newEnd, {
|
|
6880
|
+
name: "title",
|
|
6881
|
+
value: cleanup(input.slice(title2.start, newEnd)),
|
|
6882
|
+
inputString: input
|
|
6883
|
+
}));
|
|
6884
|
+
}
|
|
6885
|
+
return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
|
|
6886
|
+
}
|
|
6887
|
+
};
|
|
6888
|
+
_TrimSeasonWordFromTitle.priority = POST_PROCESS;
|
|
6889
|
+
let TrimSeasonWordFromTitle = _TrimSeasonWordFromTitle;
|
|
6844
6890
|
const _PreBracketJunkTitle = class _PreBracketJunkTitle extends Rule {
|
|
6845
6891
|
constructor() {
|
|
6846
6892
|
super(...arguments);
|
|
@@ -7079,7 +7125,7 @@ function title(config) {
|
|
|
7079
7125
|
const rebulk = new Rebulk({
|
|
7080
7126
|
disabled: (context) => isDisabled(context, "title")
|
|
7081
7127
|
});
|
|
7082
|
-
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle);
|
|
7128
|
+
rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle, BracketedTitleFallback, PreBracketJunkTitle, TrimSeasonWordFromTitle);
|
|
7083
7129
|
const expectedTitle = buildExpectedFunction("expected_title");
|
|
7084
7130
|
rebulk.functional(expectedTitle, {
|
|
7085
7131
|
name: "title",
|
|
@@ -7100,6 +7146,39 @@ const LEADING_ARTICLES_RE = /^(the|a|an|le|la|les|l'|el|los|las|der|die|das)\s+/
|
|
|
7100
7146
|
function normalizeTitle(s) {
|
|
7101
7147
|
return s.toLowerCase().replace(LEADING_ARTICLES_RE, "").trim();
|
|
7102
7148
|
}
|
|
7149
|
+
const _FormationRunEpisodeTitle = class _FormationRunEpisodeTitle extends Rule {
|
|
7150
|
+
constructor() {
|
|
7151
|
+
super(...arguments);
|
|
7152
|
+
this.priority = POST_PROCESS;
|
|
7153
|
+
this.consequence = [RemoveMatch, AppendMatch];
|
|
7154
|
+
}
|
|
7155
|
+
when(matches, _context) {
|
|
7156
|
+
const input = matches.inputString ?? "";
|
|
7157
|
+
const toRemove = [];
|
|
7158
|
+
const toAppend = [];
|
|
7159
|
+
const ets = matches.named("episode_title") ?? [];
|
|
7160
|
+
for (const et of ets) {
|
|
7161
|
+
if (!/^\d{1,2}$/.test(String(et.value ?? ""))) continue;
|
|
7162
|
+
const eps = (matches.named("episode") ?? []).filter((e) => e.end <= et.start && !e.private).sort((a, b) => a.start - b.start);
|
|
7163
|
+
if (eps.length < 3) continue;
|
|
7164
|
+
const run = eps.slice(1);
|
|
7165
|
+
const runStart = run[0].start;
|
|
7166
|
+
const span = input.slice(runStart, et.end);
|
|
7167
|
+
if (!/^\d{1,3}(-\d{1,3})+$/.test(span)) continue;
|
|
7168
|
+
const between = input.slice(eps[0].end, runStart);
|
|
7169
|
+
if (!/^[\s._]+$/.test(between)) continue;
|
|
7170
|
+
toRemove.push(...run, et);
|
|
7171
|
+
toAppend.push(new Match(runStart, et.end, {
|
|
7172
|
+
name: "episode_title",
|
|
7173
|
+
value: span,
|
|
7174
|
+
inputString: input
|
|
7175
|
+
}));
|
|
7176
|
+
}
|
|
7177
|
+
return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
|
|
7178
|
+
}
|
|
7179
|
+
};
|
|
7180
|
+
_FormationRunEpisodeTitle.priority = POST_PROCESS;
|
|
7181
|
+
let FormationRunEpisodeTitle = _FormationRunEpisodeTitle;
|
|
7103
7182
|
function episodeTitle(config) {
|
|
7104
7183
|
const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "episode_title") });
|
|
7105
7184
|
rebulk.rules(
|
|
@@ -7119,6 +7198,7 @@ function episodeTitle(config) {
|
|
|
7119
7198
|
RemoveSubtitleDescriptorEpisodeTitle,
|
|
7120
7199
|
RemoveHashFilepartJunk,
|
|
7121
7200
|
RemoveTailEpisodeTitle,
|
|
7201
|
+
FormationRunEpisodeTitle,
|
|
7122
7202
|
RenameEpisodeTitleWhenMovieType
|
|
7123
7203
|
);
|
|
7124
7204
|
return rebulk;
|
|
@@ -12213,7 +12293,10 @@ const advanced_config = {
|
|
|
12213
12293
|
},
|
|
12214
12294
|
"High Resolution": "HR",
|
|
12215
12295
|
"Line Dubbed": "LD",
|
|
12216
|
-
"Mic Dubbed":
|
|
12296
|
+
"Mic Dubbed": {
|
|
12297
|
+
string: "MD",
|
|
12298
|
+
tags: "title-word"
|
|
12299
|
+
},
|
|
12217
12300
|
"Micro HD": {
|
|
12218
12301
|
string: [
|
|
12219
12302
|
"mHD",
|