guessit-js 4.3.1 → 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.
@@ -4551,6 +4551,14 @@ function source(config) {
4551
4551
  ...buildSourcePattern(["HD-?CAM"], "", optional(ripSuffix)),
4552
4552
  { value: { source: "HD Camera", other: "Rip" } }
4553
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
+ );
4554
4562
  rebulk.regex(
4555
4563
  ...buildSourcePattern(["TELESYNC", "TS"], "", optional(ripSuffix)),
4556
4564
  { value: { source: "Telesync", other: "Rip" }, tags: ["video-codec-prefix"], overrides: ["tags"] }
@@ -4599,6 +4607,10 @@ function source(config) {
4599
4607
  ...buildSourcePattern(["DVD"], "", optional(ripSuffix)),
4600
4608
  { value: { source: "DVD", other: "Rip" } }
4601
4609
  );
4610
+ rebulk.regex(
4611
+ ...buildSourcePattern(["DVD-?R[59]"], "", ""),
4612
+ { value: { source: "DVD" } }
4613
+ );
4602
4614
  rebulk.regex(
4603
4615
  ...buildSourcePattern(["LD"], "", ripSuffix),
4604
4616
  { value: { source: "Laserdisc", other: "Rip" } }
@@ -6224,6 +6236,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
6224
6236
  const lastSeg = createMatch(prevEnd, hole.end);
6225
6237
  if (lastSeg) segments.push(lastSeg);
6226
6238
  if (segments.length < 2) return null;
6239
+ if (/^\d+$/.test(String(segments[0].value ?? "").trim())) return null;
6227
6240
  return { title: segments[0], alternatives: segments.slice(1) };
6228
6241
  }
6229
6242
  /**
@@ -6842,6 +6855,38 @@ const _SplitOriginalScriptTitle = class _SplitOriginalScriptTitle extends Rule {
6842
6855
  };
6843
6856
  _SplitOriginalScriptTitle.priority = POST_PROCESS;
6844
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;
6845
6890
  const _PreBracketJunkTitle = class _PreBracketJunkTitle extends Rule {
6846
6891
  constructor() {
6847
6892
  super(...arguments);
@@ -7080,7 +7125,7 @@ function title(config) {
7080
7125
  const rebulk = new Rebulk({
7081
7126
  disabled: (context) => isDisabled(context, "title")
7082
7127
  });
7083
- 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);
7084
7129
  const expectedTitle = buildExpectedFunction("expected_title");
7085
7130
  rebulk.functional(expectedTitle, {
7086
7131
  name: "title",
@@ -12248,7 +12293,10 @@ const advanced_config = {
12248
12293
  },
12249
12294
  "High Resolution": "HR",
12250
12295
  "Line Dubbed": "LD",
12251
- "Mic Dubbed": "MD",
12296
+ "Mic Dubbed": {
12297
+ string: "MD",
12298
+ tags: "title-word"
12299
+ },
12252
12300
  "Micro HD": {
12253
12301
  string: [
12254
12302
  "mHD",