guessit-js 4.0.2 → 4.2.0

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.
@@ -3233,6 +3233,43 @@ function isDisabled(context, name) {
3233
3233
  if (includes && includes.length > 0 && !includes.includes(name)) return true;
3234
3234
  return false;
3235
3235
  }
3236
+ const CJK_DIGITS = {
3237
+ "零": 0,
3238
+ "一": 1,
3239
+ "二": 2,
3240
+ "两": 2,
3241
+ "三": 3,
3242
+ "四": 4,
3243
+ "五": 5,
3244
+ "六": 6,
3245
+ "七": 7,
3246
+ "八": 8,
3247
+ "九": 9
3248
+ };
3249
+ const CJK_NUMBER = "(?:\\d{1,4}|[一二两三四五六七八九]?十[一二两三四五六七八九]?|[零一二两三四五六七八九])";
3250
+ function parseCjkNumber(value) {
3251
+ if (/^\d+$/.test(value)) return parseInt(value, 10);
3252
+ if (value.includes("十")) {
3253
+ const [tens, ones] = value.split("十");
3254
+ const tensValue = tens ? CJK_DIGITS[tens] : 1;
3255
+ const onesValue = ones ? CJK_DIGITS[ones] : 0;
3256
+ return tensValue * 10 + onesValue;
3257
+ }
3258
+ return CJK_DIGITS[value];
3259
+ }
3260
+ function splitWords(entries) {
3261
+ const words = [];
3262
+ const numfirst = [];
3263
+ for (const entry of entries) {
3264
+ if (typeof entry === "object") {
3265
+ if (entry.numfirst) numfirst.push(entry.value);
3266
+ words.push(entry.value);
3267
+ } else {
3268
+ words.push(entry);
3269
+ }
3270
+ }
3271
+ return { words, numfirst };
3272
+ }
3236
3273
  function episodesSeasonChainBreaker(matches, config) {
3237
3274
  const episodes2 = matches.named("episode") || [];
3238
3275
  if (episodes2.length > 1 && Math.abs(episodes2[episodes2.length - 1].value - episodes2[episodes2.length - 2].value) > config.episode_max_range) {
@@ -3252,6 +3289,18 @@ function episodesSeasonChainBreaker(matches, config) {
3252
3289
  return false;
3253
3290
  }
3254
3291
  function seasonEpisodeConflictSolver(match, other2) {
3292
+ const famChild = (p) => {
3293
+ if (p?.name) return null;
3294
+ const ch = [...p?.children ?? []];
3295
+ return ch.find((c) => c.name === "season" || c.name === "episode") ?? null;
3296
+ };
3297
+ const mChild = famChild(match);
3298
+ const oChild = famChild(other2);
3299
+ if (mChild && oChild) {
3300
+ const mNumfirst = !!mChild.tags?.includes("numfirst");
3301
+ const oNumfirst = !!oChild.tags?.includes("numfirst");
3302
+ if (mNumfirst !== oNumfirst) return null;
3303
+ }
3255
3304
  if (match.name !== other2.name) {
3256
3305
  if (match.name === "episode" && other2.name === "year") {
3257
3306
  return match;
@@ -3271,6 +3320,38 @@ function seasonEpisodeConflictSolver(match, other2) {
3271
3320
  }
3272
3321
  }
3273
3322
  if (["season", "episode"].includes(match.name) && ["season", "episode"].includes(other2.name) && match.initiator !== other2.initiator) {
3323
+ const isWeak = (m) => !!(m.tags?.includes("weak-episode") || ["weak_episode", "weak_duplicate"].includes(m.initiator?.name));
3324
+ const matchNumfirst = !!match.tags?.includes("numfirst");
3325
+ const otherNumfirst = !!other2.tags?.includes("numfirst");
3326
+ if (matchNumfirst !== otherNumfirst && !isWeak(match) && !isWeak(other2) && match.start < other2.end && other2.start < match.end) {
3327
+ const nf = matchNumfirst ? match : other2;
3328
+ const wf = matchNumfirst ? other2 : match;
3329
+ const input = match.inputString ?? "";
3330
+ const digitToken = (from, dir) => {
3331
+ let i = from;
3332
+ while (i >= 0 && i < input.length && seps.includes(input[i])) i += dir;
3333
+ let tok = "";
3334
+ while (i >= 0 && i < input.length && /\d/.test(input[i])) {
3335
+ tok = tok + input[i];
3336
+ i += dir;
3337
+ }
3338
+ return tok;
3339
+ };
3340
+ const isYearLike = (t) => t.length === 4 && +t >= 1900 && +t <= 2100;
3341
+ const nfInit = nf.initiator ?? nf;
3342
+ const wfInit = wf.initiator ?? wf;
3343
+ const nfDangling = (() => {
3344
+ const t = digitToken(nfInit.end, 1);
3345
+ return t.length >= 1 && t.length <= 4 && !isYearLike(t);
3346
+ })();
3347
+ const wfDangling = (() => {
3348
+ const before = input.slice(Math.max(0, wfInit.start - 12), wfInit.start);
3349
+ const m = /(\d{1,3})(?:ª|º|°|a|o|-?(?:й|я|е|го|ая|ый|ое))?[\s.,_\-–]*$/iu.exec(before);
3350
+ return !!(m && !isYearLike(m[1]));
3351
+ })();
3352
+ if (wfDangling && !nfDangling) return wf;
3353
+ return nf;
3354
+ }
3274
3355
  const matchIsWeak = !!(match.tags?.includes("weak-episode") || ["weak_episode", "weak_duplicate"].includes(match.initiator?.name));
3275
3356
  const otherIsWeak = !!(other2.tags?.includes("weak-episode") || ["weak_episode", "weak_duplicate"].includes(other2.initiator?.name));
3276
3357
  if (matchIsWeak && otherIsWeak) {
@@ -3322,11 +3403,41 @@ function seasonWordNotYear(match) {
3322
3403
  function episodes(config) {
3323
3404
  config.range_separators;
3324
3405
  const discreteSeparators = config.discrete_separators;
3325
- seps.split("").filter((s) => !config.range_separators.includes(s));
3406
+ const weakDiscreteSeparators = seps.split("").filter((s) => !config.range_separators.includes(s) && s !== "/" && s !== "\\");
3326
3407
  const allSeparators = [
3327
3408
  ...config.range_separators,
3328
- ...discreteSeparators
3409
+ ...discreteSeparators,
3410
+ ...weakDiscreteSeparators
3329
3411
  ];
3412
+ const moduleOrderingValidator = orderingValidator;
3413
+ const localOrderingValidator = (match) => {
3414
+ if (!moduleOrderingValidator(match)) return false;
3415
+ const isConsecutive = (prop) => {
3416
+ let previous = null;
3417
+ let valid = true;
3418
+ const children = match.children;
3419
+ const named = children?.named?.(prop) ?? [];
3420
+ for (const current of Array.isArray(named) ? named : [named]) {
3421
+ if (previous) {
3422
+ const separator = children.previous?.(current, (m) => m.name === prop + "Separator", 0);
3423
+ if (separator) {
3424
+ const sraw = String(separator.raw ?? "");
3425
+ if (!config.range_separators.includes(sraw) && weakDiscreteSeparators.includes(sraw)) {
3426
+ const gap = Number(current.value) - Number(previous.value);
3427
+ if (!(gap > 0 && gap <= config.max_range_gap + 1)) valid = false;
3428
+ }
3429
+ if (discreteSeparators.includes(sraw)) {
3430
+ valid = true;
3431
+ break;
3432
+ }
3433
+ }
3434
+ }
3435
+ previous = current;
3436
+ }
3437
+ return valid;
3438
+ };
3439
+ return isConsecutive("episode") && isConsecutive("season");
3440
+ };
3330
3441
  const wordNumerals = [
3331
3442
  "zero",
3332
3443
  "one",
@@ -3374,15 +3485,16 @@ function episodes(config) {
3374
3485
  }
3375
3486
  const rebulk = new Rebulk().regexDefaults({ flags: "i" }).stringDefaults({ ignoreCase: true }).defaults({
3376
3487
  privateNames: ["episodeSeparator", "seasonSeparator", "episodeMarker", "seasonMarker"],
3377
- formatter: { season: (v) => parseInt(v, 10), episode: (v) => parseInt(v, 10), version: (v) => parseInt(v, 10) },
3488
+ formatter: { season: (v) => parseInt(v, 10), episode: (v) => parseInt(v, 10), version: (v) => parseInt(v, 10), count: (v) => parseInt(v, 10) },
3378
3489
  children: true,
3379
3490
  privateParent: true,
3380
3491
  conflictSolver: seasonEpisodeConflictSolver,
3381
3492
  abbreviations: [altDash]
3382
3493
  });
3383
- rebulk.regex("第(?<episode>\\d{1,4})話", { tags: ["SxxExx"] });
3384
- rebulk.regex("(?:シーズン|シリーズ)(?<season>\\d{1,2})", { tags: ["SxxExx"] });
3385
- rebulk.regex("(?<season>\\d{1,2})期", {});
3494
+ rebulk.regex(`第(?<episode>${CJK_NUMBER})[話话集]`, { tags: ["SxxExx"], formatter: { episode: parseCjkNumber } });
3495
+ rebulk.regex(`第(?<season>${CJK_NUMBER})季`, { tags: ["SxxExx"], formatter: { season: parseCjkNumber } });
3496
+ rebulk.regex("(?:シーズン|シリーズ)(?<season>\\d{1,2})(?!\\d)", { tags: ["SxxExx"] });
3497
+ rebulk.regex("(?<!\\d)(?<season>\\d{1,2})期", {});
3386
3498
  const seasonMarkerPattern = buildOrPattern(config.season_markers, "seasonMarker");
3387
3499
  const episodeMarkerPattern = buildOrPattern(
3388
3500
  [...config.episode_markers, ...config.disc_markers],
@@ -3397,7 +3509,7 @@ function episodes(config) {
3397
3509
  tags: ["SxxExx"],
3398
3510
  validateAll: true,
3399
3511
  validator: {
3400
- __parent__: and_(sepsSurround, orderingValidator)
3512
+ __parent__: and_(sepsSurround, localOrderingValidator)
3401
3513
  },
3402
3514
  chainBreaker: (matches) => episodesSeasonChainBreaker(matches, config),
3403
3515
  disabled: isSeasonEpisodeDisabled
@@ -3407,6 +3519,7 @@ function episodes(config) {
3407
3519
  allSeparatorsPattern + `@?(?<episode>\\d+)`
3408
3520
  ).repeater("*");
3409
3521
  const seasonEpMarkerPattern = buildOrPattern(config.season_ep_markers, "episodeMarker");
3522
+ const asymmetricSeasonEpMarker = `(?!@` + buildOrPattern(config.season_ep_markers) + `\\d)`;
3410
3523
  rebulk.chain({
3411
3524
  tags: ["SxxExx"],
3412
3525
  validateAll: true,
@@ -3415,7 +3528,7 @@ function episodes(config) {
3415
3528
  },
3416
3529
  disabled: isSeasonEpisodeDisabled
3417
3530
  }).defaults({ tags: ["SxxExx"] }).regex(
3418
- `(?<season>\\d+)@?` + seasonEpMarkerPattern + `@?(?<episode>\\d+)`
3531
+ `(?<season>\\d+)` + asymmetricSeasonEpMarker + `@?` + seasonEpMarkerPattern + `@?(?<episode>\\d+)`
3419
3532
  ).repeater("+");
3420
3533
  rebulk.chain({
3421
3534
  tags: ["SxxExx"],
@@ -3424,13 +3537,17 @@ function episodes(config) {
3424
3537
  __parent__: and_(sepsSurround, orderingValidator)
3425
3538
  },
3426
3539
  disabled: isSeasonEpisodeDisabled
3427
- }).defaults({ tags: ["SxxExx"] }).regex(`(?<season>\\d+)@?` + seasonEpMarkerPattern + `@?(?<episode>\\d+)`).regex(
3540
+ }).defaults({ tags: ["SxxExx"] }).regex(`(?<season>\\d+)` + asymmetricSeasonEpMarker + `@?` + seasonEpMarkerPattern + `@?(?<episode>\\d+)`).regex(
3428
3541
  buildOrPattern(
3429
3542
  [...config.season_ep_markers, ...discreteSeparators, ...config.range_separators],
3430
3543
  "episodeSeparator",
3431
3544
  true
3432
3545
  ) + `(?<episode>\\d+)`
3433
3546
  ).repeater("*");
3547
+ rebulk.regex(
3548
+ `t(?<season>\\d{1,2})@?` + buildOrPattern(config.episode_markers, "episodeMarker") + `@?(?<episode>\\d{1,4})`,
3549
+ { tags: ["SxxExx"], disabled: isSeasonEpisodeDisabled }
3550
+ );
3434
3551
  const seasonOnlySepPattern = buildOrPattern(
3435
3552
  [...config.season_markers, ...discreteSeparators, ...config.range_separators],
3436
3553
  "seasonSeparator",
@@ -3453,7 +3570,9 @@ function episodes(config) {
3453
3570
  disabled: (context) => isDisabled(context, "episode_details")
3454
3571
  });
3455
3572
  }
3456
- const seasonWordPattern = buildOrPattern(config.season_words, "seasonMarker");
3573
+ const { words: seasonWords, numfirst: seasonWordsNumfirst } = splitWords(config.season_words);
3574
+ const { words: episodeWords, numfirst: episodeWordsNumfirst } = splitWords(config.episode_words);
3575
+ const seasonWordPattern = buildOrPattern(seasonWords, "seasonMarker");
3457
3576
  const ofWordPattern = buildOrPattern(config.of_words);
3458
3577
  rebulk.chain({
3459
3578
  validateAll: true,
@@ -3477,7 +3596,28 @@ function episodes(config) {
3477
3596
  true
3478
3597
  ) + `@?(?P<season>\\d+)`
3479
3598
  ).repeater("*");
3480
- const episodeWordPattern = buildOrPattern(config.episode_words, "episodeMarker");
3599
+ const ofCountPattern = `(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`;
3600
+ if (seasonWordsNumfirst.length > 0) {
3601
+ rebulk.regex(
3602
+ `(?<season>\\d{1,2})` + config.ordinal_suffix + `@?@?` + buildOrPattern(seasonWordsNumfirst, "seasonMarker") + `(?![^\\W\\d_])` + ofCountPattern,
3603
+ {
3604
+ tags: ["SxxExx", "numfirst"],
3605
+ formatter: { season: parseNumber, count: (v) => parseInt(v, 10) },
3606
+ disabled: isSeasonEpisodeDisabled
3607
+ }
3608
+ );
3609
+ }
3610
+ if (episodeWordsNumfirst.length > 0) {
3611
+ rebulk.regex(
3612
+ `(?<episode>\\d{1,3})` + config.ordinal_suffix + `@?@?` + buildOrPattern(episodeWordsNumfirst, "episodeMarker") + `(?![^\\W\\d_])` + ofCountPattern,
3613
+ {
3614
+ tags: ["SxxExx", "numfirst"],
3615
+ formatter: { episode: parseNumber, count: (v) => parseInt(v, 10) },
3616
+ disabled: (context) => isDisabled(context, "episode")
3617
+ }
3618
+ );
3619
+ }
3620
+ const episodeWordPattern = buildOrPattern(episodeWords, "episodeMarker");
3481
3621
  rebulk.regex(
3482
3622
  `(?<![a-zA-Z\\d])` + episodeWordPattern + `@?(?<episode>\\d+)(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
3483
3623
  {
@@ -3503,13 +3643,13 @@ function episodes(config) {
3503
3643
  rebulk.chain({
3504
3644
  tags: ["weak-episode"],
3505
3645
  disabled: (context) => context?.type === "movie" || isDisabled(context, "episode")
3506
- }).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<episode>\\d{2})(?!(?:st|nd|rd|th)\\b)`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{2})`, {
3646
+ }).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})`, {
3507
3647
  abbreviations: null
3508
3648
  }).repeater("*");
3509
3649
  rebulk.chain({
3510
3650
  tags: ["weak-episode"],
3511
3651
  disabled: (context) => context?.type === "movie" || isDisabled(context, "episode")
3512
- }).defaults({ validator: null, tags: ["weak-episode"] }).regex(`0(?<episode>\\d{1,2})`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])0(?<episode>\\d{1,2})`, {
3652
+ }).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})`, {
3513
3653
  abbreviations: null
3514
3654
  }).repeater("*");
3515
3655
  rebulk.chain({
@@ -3520,13 +3660,13 @@ function episodes(config) {
3520
3660
  validator: null,
3521
3661
  tags: ["weak-episode"],
3522
3662
  name: "weak_episode"
3523
- }).regex(`(?<episode>\\d{3,4})`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{3,4})`, {
3663
+ }).regex(`(?<![^\\W_])(?<episode>\\d{3,4})(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{3,4})`, {
3524
3664
  abbreviations: null
3525
3665
  }).repeater("*");
3526
3666
  rebulk.chain({
3527
3667
  tags: ["weak-episode"],
3528
3668
  disabled: (context) => context?.type !== "episode" || isDisabled(context, "episode")
3529
- }).defaults({ validator: null, tags: ["weak-episode"] }).regex(`(?<episode>\\d)`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>[x-])(?<episode>\\d{1,2})`, {
3669
+ }).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})`, {
3530
3670
  abbreviations: null
3531
3671
  }).repeater("*");
3532
3672
  rebulk.chain({
@@ -3555,7 +3695,7 @@ function episodes(config) {
3555
3695
  name: "weak_duplicate",
3556
3696
  validator: null,
3557
3697
  conflictSolver: seasonEpisodeConflictSolver
3558
- }).regex(`(?<season>\\d{1,2})(?<episode>\\d{2})`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>x|-)(?<episode>\\d{2})`, {
3698
+ }).regex(`(?<![^\\W_])(?<season>\\d{1,2})(?<episode>\\d{2})(?!(?![vV]\\d)[^\\W_])`).regex(`v(?<version>\\d+)`).repeater("?").regex(`(?<episodeSeparator>x|-)(?<episode>\\d{2})`, {
3559
3699
  abbreviations: null
3560
3700
  }).repeater("*");
3561
3701
  rebulk.regex(`v(?<version>\\d+)`, {
@@ -3563,9 +3703,11 @@ function episodes(config) {
3563
3703
  disabled: (context) => isDisabled(context, "version")
3564
3704
  });
3565
3705
  rebulk.regex(
3566
- `(?<episode>\\d+)@?` + ofWordPattern + `@?(?<episode_count>\\d+)@?` + episodeWordPattern + "?",
3706
+ // The lookbehind keeps this off token tails: "AC3-de[42]" is not "episode 3 of 42"
3707
+ // ('de' is also a Spanish of-word — codec suffixes must stay intact).
3708
+ `(?<![^\\W_])(?<episode>\\d+)@?` + ofWordPattern + `@?(?<count>\\d+)@?` + episodeWordPattern + "?",
3567
3709
  {
3568
- formatter: { episode: (v) => parseInt(v, 10), episode_count: (v) => parseInt(v, 10) },
3710
+ formatter: { episode: (v) => parseInt(v, 10), count: (v) => parseInt(v, 10) },
3569
3711
  preMatchProcessor: (match) => {
3570
3712
  match.value = cleanup(match.value);
3571
3713
  return match;
@@ -3581,6 +3723,8 @@ function episodes(config) {
3581
3723
  disabled: (context) => isDisabled(context, "episode_format")
3582
3724
  });
3583
3725
  rebulk.rules(
3726
+ RemoveNumfirstMarkerCollision,
3727
+ CountValidator,
3584
3728
  new DiscMarkerRule(config),
3585
3729
  FixCorruptedGroupBoundaryValues,
3586
3730
  new RangeExpansionRule(config),
@@ -3594,6 +3738,73 @@ function episodes(config) {
3594
3738
  );
3595
3739
  return rebulk;
3596
3740
  }
3741
+ const _RemoveNumfirstMarkerCollision = class _RemoveNumfirstMarkerCollision extends Rule {
3742
+ constructor() {
3743
+ super(...arguments);
3744
+ this.priority = 70;
3745
+ this.consequence = RemoveMatch;
3746
+ }
3747
+ when(matches, _context) {
3748
+ const toRemove = [];
3749
+ const isWeak = (m) => !!(m.tags?.includes("weak-episode") || ["weak_episode", "weak_duplicate"].includes(m.initiator?.name));
3750
+ const removeWithParent = (m) => {
3751
+ const init = m.initiator ?? m;
3752
+ if (!toRemove.includes(m)) toRemove.push(m);
3753
+ for (const child of init.children ?? []) {
3754
+ if (!toRemove.includes(child)) toRemove.push(child);
3755
+ }
3756
+ };
3757
+ const all = [...matches];
3758
+ const numfirsts = all.filter((m) => (m.name === "season" || m.name === "episode") && m.tags?.includes("numfirst"));
3759
+ for (const nf of numfirsts) {
3760
+ const nfInit = nf.initiator ?? nf;
3761
+ const wordFirst = all.find((w) => {
3762
+ if (w.name !== "season" && w.name !== "episode") return false;
3763
+ if (w.tags?.includes("numfirst") || isWeak(w)) return false;
3764
+ const wInit = w.initiator ?? w;
3765
+ if (wInit === nfInit) return false;
3766
+ return wInit.start < nfInit.end && nfInit.start < wInit.end;
3767
+ });
3768
+ if (!wordFirst) continue;
3769
+ const claimed = all.some((m) => !m.private && (m.name === "screen_size" || m.name === "year") && m.start < wordFirst.end && wordFirst.start < m.end);
3770
+ if (claimed) removeWithParent(wordFirst);
3771
+ else removeWithParent(nf);
3772
+ }
3773
+ return toRemove.length ? toRemove : false;
3774
+ }
3775
+ };
3776
+ _RemoveNumfirstMarkerCollision.priority = 70;
3777
+ let RemoveNumfirstMarkerCollision = _RemoveNumfirstMarkerCollision;
3778
+ const _CountValidator = class _CountValidator extends Rule {
3779
+ constructor() {
3780
+ super(...arguments);
3781
+ this.priority = 64;
3782
+ this.consequence = [RemoveMatch, new RenameMatch("episode_count"), new RenameMatch("season_count")];
3783
+ }
3784
+ when(matches, _context) {
3785
+ const toRemove = [];
3786
+ const episodeCount = [];
3787
+ const seasonCount = [];
3788
+ for (const count of matches.named("count") ?? []) {
3789
+ const numbers = matches.range(
3790
+ count.initiator.start,
3791
+ count.start,
3792
+ (m) => m.name === "episode" || m.name === "season"
3793
+ );
3794
+ const numbered = numbers.length ? numbers[numbers.length - 1] : void 0;
3795
+ if (!numbered) toRemove.push(count);
3796
+ else if (numbered.name === "episode") episodeCount.push(count);
3797
+ else seasonCount.push(count);
3798
+ }
3799
+ if (toRemove.length || episodeCount.length || seasonCount.length) {
3800
+ return [toRemove, episodeCount, seasonCount];
3801
+ }
3802
+ return false;
3803
+ }
3804
+ };
3805
+ _CountValidator.priority = 64;
3806
+ _CountValidator.consequence = [RemoveMatch, new RenameMatch("episode_count"), new RenameMatch("season_count")];
3807
+ let CountValidator = _CountValidator;
3597
3808
  const _DiscMarkerRule = class _DiscMarkerRule extends Rule {
3598
3809
  constructor(config) {
3599
3810
  super();
@@ -4199,6 +4410,14 @@ function source(config) {
4199
4410
  ...buildSourcePattern(["DVD"], "", optional(ripSuffix)),
4200
4411
  { value: { source: "DVD", other: "Rip" } }
4201
4412
  );
4413
+ rebulk.regex(
4414
+ ...buildSourcePattern(["LD"], "", ripSuffix),
4415
+ { value: { source: "Laserdisc", other: "Rip" } }
4416
+ );
4417
+ rebulk.regex(
4418
+ ...buildSourcePattern(["LASERDISC"], "", optional(ripSuffix)),
4419
+ { value: { source: "Laserdisc", other: "Rip" } }
4420
+ );
4202
4421
  rebulk.regex(
4203
4422
  ...buildSourcePattern(["DM"], "", optional(ripSuffix)),
4204
4423
  { value: { source: "Digital Master", other: "Rip" } }
@@ -4776,6 +4995,10 @@ const COMPOUND_PROFILES = {
4776
4995
  "Dolby Digital": "EX"
4777
4996
  };
4778
4997
  const _CompoundAudioProfileRule = class _CompoundAudioProfileRule extends Rule {
4998
+ constructor() {
4999
+ super(...arguments);
5000
+ this.priority = 128;
5001
+ }
4779
5002
  enabled(context) {
4780
5003
  return !isDisabled(context, "audio_profile");
4781
5004
  }
@@ -4818,6 +5041,7 @@ const _CompoundAudioProfileRule = class _CompoundAudioProfileRule extends Rule {
4818
5041
  }
4819
5042
  }
4820
5043
  };
5044
+ _CompoundAudioProfileRule.priority = 128;
4821
5045
  _CompoundAudioProfileRule.consequence = AppendMatch;
4822
5046
  let CompoundAudioProfileRule = _CompoundAudioProfileRule;
4823
5047
  const _AudioProfileRule = class _AudioProfileRule extends Rule {
@@ -4902,17 +5126,29 @@ const _AudioValidatorRule = class _AudioValidatorRule extends Rule {
4902
5126
  }
4903
5127
  when(matches, _context) {
4904
5128
  const ret = [];
4905
- const audioProps = [...matches.named("audio_codec"), ...matches.named("audio_profile")];
5129
+ const AUDIO_PROPS = ["audio_codec", "audio_profile", "audio_channels"];
5130
+ const audioProps = AUDIO_PROPS.flatMap((n) => [...matches.named(n)]);
4906
5131
  for (const prop of audioProps) {
4907
5132
  if (!sepsBefore(prop)) {
4908
- const prevMatch = matches.atIndex(prop.start - 1, null, 0);
4909
- if (!prevMatch || prevMatch.name !== "audio_codec" && prevMatch.name !== "audio_profile") {
5133
+ const validBefore = matches.range(
5134
+ prop.start - 1,
5135
+ prop.start,
5136
+ (m) => AUDIO_PROPS.includes(m.name ?? "")
5137
+ );
5138
+ if (!(Array.isArray(validBefore) ? validBefore.length : validBefore)) {
4910
5139
  ret.push(prop);
5140
+ continue;
4911
5141
  }
4912
- } else if (!sepsAfter(prop)) {
4913
- const nextMatch = matches.atIndex(prop.end + 1, null, 0);
4914
- if (!nextMatch || nextMatch.name !== "audio_codec" && nextMatch.name !== "audio_profile" && nextMatch.name !== "audio_channels") {
5142
+ }
5143
+ if (!sepsAfter(prop)) {
5144
+ const validAfter = matches.range(
5145
+ prop.end,
5146
+ prop.end + 1,
5147
+ (m) => AUDIO_PROPS.includes(m.name ?? "")
5148
+ );
5149
+ if (!(Array.isArray(validAfter) ? validAfter.length : validAfter)) {
4915
5150
  ret.push(prop);
5151
+ continue;
4916
5152
  }
4917
5153
  }
4918
5154
  }
@@ -5019,7 +5255,8 @@ function screenSize(config) {
5019
5255
  const frameRatePattern = buildOrPattern(frameRates, "frame_rate");
5020
5256
  const interlacedPattern = buildOrPattern([...interlaced], "height");
5021
5257
  const progressivePattern = buildOrPattern([...progressive], "height");
5022
- const resPattern = `(?:(?<width>\\d{3,4})(?:x|\\*))?`;
5258
+ const resSeparator = `(?:x|\\*|×)`;
5259
+ const resPattern = `(?:(?<width>\\d{3,4})${resSeparator})?`;
5023
5260
  rebulk.regex(resPattern + interlacedPattern + `(?<scan_type>i)` + frameRatePattern + `?`);
5024
5261
  rebulk.regex(resPattern + progressivePattern + `(?<scan_type>p)` + frameRatePattern + `?`);
5025
5262
  rebulk.regex(resPattern + progressivePattern + `(?<scan_type>p)?(?:hd)`);
@@ -5028,7 +5265,7 @@ function screenSize(config) {
5028
5265
  value: "2160p",
5029
5266
  conflictSolver: (match, other2) => other2.name === "screen_size" ? "__default__" : match
5030
5267
  });
5031
- rebulk.regex(`(?<width>\\d{3,4})-?(?:x|\\*)-?(?<height>\\d{3,4})`, {
5268
+ rebulk.regex(`(?<width>\\d{3,4})(?:${resSeparator}|-${resSeparator}-)(?<height>\\d{3,4})(?:up)?`, {
5032
5269
  conflictSolver: (match, other2) => other2.name === "screen_size" ? "__default__" : other2
5033
5270
  });
5034
5271
  rebulk.regex(frameRatePattern + `-?(?:p|fps)`, {
@@ -5062,7 +5299,7 @@ const _PostProcessScreenSize = class _PostProcessScreenSize extends Rule {
5062
5299
  let values = match.children.toDict();
5063
5300
  if (!("height" in values)) {
5064
5301
  const raw = String(match.raw ?? "");
5065
- const rxWxH = /^(\d{3,4})\s*[xX*]\s*(\d{3,4})$/i;
5302
+ const rxWxH = /^(\d{3,4})\s*[xX*×]\s*(\d{3,4})(?:up)?$/i;
5066
5303
  const mWxH = rxWxH.exec(raw);
5067
5304
  if (mWxH) {
5068
5305
  values = { width: mWxH[1], height: mWxH[2], scan_type: void 0 };
@@ -5127,10 +5364,19 @@ const _ResolveScreenSizeConflicts = class _ResolveScreenSizeConflicts extends Ru
5127
5364
  const conflicts = matches.conflicting(screenSizeMatch, (m) => ["season", "episode"].includes(m.name ?? "")) ?? [];
5128
5365
  if (conflicts.length === 0) continue;
5129
5366
  let hasNeighbor = false;
5130
- const videoProfile = matches.range(screenSizeMatch.end, filepart.end, (m) => m.name === "video_profile", 0);
5131
- if (videoProfile && matches.holes(screenSizeMatch.end, videoProfile.start, { predicate: (h) => !!(h.value && String(h.value).replace(new RegExp(`[${sepsPattern}]`, "g"), "")) }).length === 0) {
5132
- toRemove.push(...conflicts);
5133
- hasNeighbor = true;
5367
+ const allScreensizes = matches.range(filepart.start, filepart.end, (m) => m.name === "screen_size") ?? [];
5368
+ const groupOf = (m) => matches.markers.atMatch(m, (marker) => marker.name === "group", 0);
5369
+ const following = matches.range(
5370
+ screenSizeMatch.end,
5371
+ filepart.end,
5372
+ (m) => m.name === "video_profile" || m.name === "video_codec",
5373
+ 0
5374
+ );
5375
+ if (following && matches.holes(screenSizeMatch.end, following.start, { predicate: (h) => !!(h.value && String(h.value).replace(new RegExp(`[${sepsPattern}]`, "g"), "")) }).length === 0) {
5376
+ if (following.name === "video_profile" || allScreensizes.length === 1 && groupOf(screenSizeMatch) === groupOf(following)) {
5377
+ toRemove.push(...conflicts);
5378
+ hasNeighbor = true;
5379
+ }
5134
5380
  }
5135
5381
  const previous = matches.previous(screenSizeMatch, (m) => ["date", "source", "other", "streaming_service"].includes(m.name ?? ""), 0);
5136
5382
  if (previous && matches.holes(previous.end, screenSizeMatch.start, { predicate: (h) => !!(h.value && String(h.value).replace(new RegExp(`[${sepsPattern}]`, "g"), "")) }).length === 0) {
@@ -5146,47 +5392,12 @@ const _ResolveScreenSizeConflicts = class _ResolveScreenSizeConflicts extends Ru
5146
5392
  };
5147
5393
  _ResolveScreenSizeConflicts.consequence = RemoveMatch;
5148
5394
  let ResolveScreenSizeConflicts = _ResolveScreenSizeConflicts;
5149
- const DEFAULT_TLDS = [
5150
- "com",
5151
- "org",
5152
- "net",
5153
- "edu",
5154
- "gov",
5155
- "mil",
5156
- "int",
5157
- "co",
5158
- "uk",
5159
- "ca",
5160
- "de",
5161
- "fr",
5162
- "it",
5163
- "es",
5164
- "nl",
5165
- "be",
5166
- "ch",
5167
- "se",
5168
- "no",
5169
- "dk",
5170
- "fi",
5171
- "pl",
5172
- "ru",
5173
- "cn",
5174
- "jp",
5175
- "au",
5176
- "nz",
5177
- "in",
5178
- "br",
5179
- "mx",
5180
- "za",
5181
- "kr",
5182
- "tw",
5183
- "hk"
5184
- ];
5395
+ const TLDS = ["aarp", "abb", "abbott", "abbvie", "abc", "able", "abogado", "abudhabi", "ac", "academy", "accenture", "accountant", "accountants", "aco", "actor", "ad", "ads", "adult", "ae", "aeg", "aero", "aetna", "af", "afl", "africa", "ag", "agakhan", "agency", "ai", "aig", "airbus", "airforce", "airtel", "akdn", "al", "alibaba", "alipay", "allfinanz", "allstate", "ally", "alsace", "alstom", "am", "amazon", "americanexpress", "americanfamily", "amex", "amfam", "amica", "amsterdam", "analytics", "android", "anquan", "anz", "ao", "aol", "apartments", "app", "apple", "aq", "aquarelle", "ar", "arab", "aramco", "archi", "army", "arpa", "art", "arte", "as", "asda", "asia", "associates", "at", "athleta", "attorney", "au", "auction", "audi", "audible", "audio", "auspost", "author", "auto", "autos", "aw", "aws", "ax", "axa", "az", "azure", "ba", "baby", "baidu", "banamex", "band", "bank", "bar", "barcelona", "barclaycard", "barclays", "barefoot", "bargains", "baseball", "basketball", "bauhaus", "bayern", "bb", "bbc", "bbt", "bbva", "bcg", "bcn", "bd", "be", "beats", "beauty", "beer", "berlin", "best", "bestbuy", "bet", "bf", "bg", "bh", "bharti", "bi", "bible", "bid", "bike", "bing", "bingo", "bio", "biz", "bj", "black", "blackfriday", "blockbuster", "blog", "bloomberg", "blue", "bm", "bms", "bmw", "bn", "bnpparibas", "bo", "boats", "boehringer", "bofa", "bom", "bond", "boo", "book", "booking", "bosch", "bostik", "boston", "bot", "boutique", "box", "br", "bradesco", "bridgestone", "broadway", "broker", "brother", "brussels", "bs", "bt", "build", "builders", "business", "buy", "buzz", "bv", "bw", "by", "bz", "bzh", "ca", "cab", "cafe", "cal", "call", "calvinklein", "cam", "camera", "camp", "canon", "capetown", "capital", "capitalone", "car", "caravan", "cards", "care", "career", "careers", "cars", "casa", "case", "cash", "casino", "cat", "catering", "catholic", "cba", "cbn", "cbre", "cc", "cd", "center", "ceo", "cern", "cf", "cfa", "cfd", "cg", "ch", "chanel", "channel", "charity", "chase", "chat", "cheap", "chintai", "christmas", "chrome", "church", "ci", "cipriani", "circle", "cisco", "citadel", "citi", "citic", "city", "ck", "cl", "claims", "cleaning", "click", "clinic", "clinique", "clothing", "cloud", "club", "clubmed", "cm", "cn", "co", "coach", "codes", "coffee", "college", "cologne", "com", "commbank", "community", "company", "compare", "computer", "comsec", "condos", "construction", "consulting", "contact", "contractors", "cooking", "cool", "coop", "corsica", "country", "coupon", "coupons", "courses", "cpa", "cr", "credit", "creditcard", "creditunion", "cricket", "crown", "crs", "cruise", "cruises", "cu", "cuisinella", "cv", "cw", "cx", "cy", "cymru", "cyou", "cz", "dad", "dance", "data", "date", "dating", "datsun", "day", "dclk", "dds", "de", "deal", "dealer", "deals", "degree", "delivery", "dell", "deloitte", "delta", "democrat", "dental", "dentist", "desi", "design", "dev", "dhl", "diamonds", "diet", "digital", "direct", "directory", "discount", "discover", "dish", "diy", "dj", "dk", "dm", "dnp", "do", "docs", "doctor", "dog", "domains", "dot", "download", "drive", "dtv", "dubai", "dupont", "durban", "dvag", "dvr", "dz", "earth", "eat", "ec", "eco", "edeka", "edu", "education", "ee", "eg", "email", "emerck", "energy", "engineer", "engineering", "enterprises", "epson", "equipment", "er", "ericsson", "erni", "es", "esq", "estate", "et", "eu", "eurovision", "eus", "events", "exchange", "expert", "exposed", "express", "extraspace", "fage", "fail", "fairwinds", "faith", "family", "fan", "fans", "farm", "farmers", "fashion", "fast", "fedex", "feedback", "ferrari", "ferrero", "fi", "fidelity", "fido", "film", "final", "finance", "financial", "fire", "firestone", "firmdale", "fish", "fishing", "fit", "fitness", "fj", "fk", "flickr", "flights", "flir", "florist", "flowers", "fly", "fm", "fo", "foo", "food", "football", "ford", "forex", "forsale", "forum", "foundation", "fox", "fr", "free", "fresenius", "frl", "frogans", "frontier", "ftr", "fujitsu", "fun", "fund", "furniture", "futbol", "fyi", "ga", "gal", "gallery", "gallo", "gallup", "game", "games", "gap", "garden", "gay", "gb", "gbiz", "gd", "gdn", "ge", "gea", "gent", "genting", "george", "gf", "gg", "ggee", "gh", "gi", "gift", "gifts", "gives", "giving", "gl", "glass", "gle", "global", "globo", "gm", "gmail", "gmbh", "gmo", "gmx", "gn", "godaddy", "gold", "goldpoint", "golf", "goodyear", "goog", "google", "gop", "got", "gov", "gp", "gq", "gr", "grainger", "graphics", "gratis", "green", "gripe", "grocery", "group", "gs", "gt", "gu", "gucci", "guge", "guide", "guitars", "guru", "gw", "gy", "hair", "hamburg", "hangout", "haus", "hbo", "hdfc", "hdfcbank", "health", "healthcare", "help", "helsinki", "here", "hermes", "hiphop", "hisamitsu", "hitachi", "hiv", "hk", "hkt", "hm", "hn", "hockey", "holdings", "holiday", "homedepot", "homegoods", "homes", "homesense", "honda", "horse", "hospital", "host", "hosting", "hot", "hotels", "hotmail", "house", "how", "hr", "hsbc", "ht", "hu", "hughes", "hyatt", "hyundai", "ibm", "icbc", "ice", "icu", "id", "ie", "ieee", "ifm", "ikano", "il", "im", "imamat", "imdb", "immo", "immobilien", "in", "inc", "industries", "infiniti", "info", "ing", "ink", "institute", "insurance", "insure", "int", "international", "intuit", "investments", "io", "ipiranga", "iq", "ir", "irish", "is", "ismaili", "ist", "istanbul", "it", "itau", "itv", "jaguar", "java", "jcb", "je", "jeep", "jetzt", "jewelry", "jio", "jll", "jm", "jmp", "jnj", "jo", "jobs", "joburg", "jot", "joy", "jp", "jpmorgan", "jprs", "juegos", "juniper", "kaufen", "kddi", "ke", "kerryhotels", "kerryproperties", "kfh", "kg", "kh", "ki", "kia", "kids", "kim", "kindle", "kitchen", "kiwi", "km", "kn", "koeln", "komatsu", "kosher", "kp", "kpmg", "kpn", "kr", "krd", "kred", "kuokgroup", "kw", "ky", "kyoto", "kz", "la", "lacaixa", "lamborghini", "lamer", "land", "landrover", "lanxess", "lasalle", "lat", "latino", "latrobe", "law", "lawyer", "lb", "lc", "lds", "lease", "leclerc", "lefrak", "legal", "lego", "lexus", "lgbt", "li", "lidl", "life", "lifeinsurance", "lifestyle", "lighting", "like", "lilly", "limited", "limo", "lincoln", "link", "live", "living", "lk", "llc", "llp", "loan", "loans", "locker", "locus", "lol", "london", "lotte", "lotto", "love", "lpl", "lplfinancial", "lr", "ls", "lt", "ltd", "ltda", "lu", "lundbeck", "luxe", "luxury", "lv", "ly", "ma", "madrid", "maif", "maison", "makeup", "man", "management", "mango", "map", "market", "marketing", "markets", "marriott", "marshalls", "mattel", "mba", "mc", "mckinsey", "md", "me", "med", "media", "meet", "melbourne", "meme", "memorial", "men", "menu", "merck", "merckmsd", "mg", "mh", "miami", "microsoft", "mil", "mini", "mint", "mit", "mitsubishi", "mk", "ml", "mlb", "mls", "mm", "mma", "mn", "mo", "mobi", "mobile", "moda", "moe", "moi", "mom", "monash", "money", "monster", "mormon", "mortgage", "moscow", "moto", "motorcycles", "mov", "movie", "mp", "mq", "mr", "ms", "msd", "mt", "mtn", "mtr", "mu", "museum", "music", "mv", "mw", "mx", "my", "mz", "na", "nab", "nagoya", "name", "navy", "nba", "nc", "ne", "nec", "net", "netbank", "netflix", "network", "neustar", "new", "news", "next", "nextdirect", "nexus", "nf", "nfl", "ng", "ngo", "nhk", "ni", "nico", "nike", "nikon", "ninja", "nissan", "nissay", "nl", "no", "nokia", "norton", "now", "nowruz", "nowtv", "np", "nr", "nra", "nrw", "ntt", "nu", "nyc", "nz", "obi", "observer", "office", "okinawa", "olayan", "olayangroup", "ollo", "om", "omega", "one", "ong", "onl", "online", "ooo", "open", "oracle", "orange", "org", "organic", "origins", "osaka", "otsuka", "ott", "ovh", "pa", "page", "panasonic", "paris", "pars", "partners", "parts", "party", "pay", "pccw", "pe", "pet", "pf", "pfizer", "pg", "ph", "pharmacy", "phd", "philips", "phone", "photo", "photography", "photos", "physio", "pics", "pictet", "pictures", "pid", "pin", "ping", "pink", "pioneer", "pizza", "pk", "pl", "place", "play", "playstation", "plumbing", "plus", "pm", "pn", "pnc", "pohl", "poker", "politie", "porn", "post", "pr", "praxi", "press", "prime", "pro", "prod", "productions", "prof", "progressive", "promo", "properties", "property", "protection", "pru", "prudential", "ps", "pt", "pub", "pw", "pwc", "py", "qa", "qpon", "quebec", "quest", "racing", "radio", "re", "read", "realestate", "realtor", "realty", "recipes", "red", "redumbrella", "rehab", "reise", "reisen", "reit", "reliance", "ren", "rent", "rentals", "repair", "report", "republican", "rest", "restaurant", "review", "reviews", "rexroth", "rich", "richardli", "ricoh", "ril", "rio", "rip", "ro", "rocks", "rodeo", "rogers", "room", "rs", "rsvp", "ru", "rugby", "ruhr", "run", "rw", "rwe", "ryukyu", "sa", "saarland", "safe", "safety", "sakura", "sale", "salon", "samsclub", "samsung", "sandvik", "sandvikcoromant", "sanofi", "sap", "sarl", "sas", "save", "saxo", "sb", "sbi", "sbs", "sc", "scb", "schaeffler", "schmidt", "scholarships", "school", "schule", "schwarz", "science", "scot", "sd", "se", "search", "seat", "secure", "security", "seek", "select", "sener", "services", "seven", "sew", "sex", "sexy", "sfr", "sg", "sh", "shangrila", "sharp", "shell", "shia", "shiksha", "shoes", "shop", "shopping", "shouji", "show", "si", "silk", "sina", "singles", "site", "sj", "sk", "ski", "skin", "sky", "skype", "sl", "sling", "sm", "smart", "smile", "sn", "sncf", "so", "soccer", "social", "softbank", "software", "sohu", "solar", "solutions", "song", "sony", "soy", "spa", "space", "sport", "spot", "sr", "srl", "ss", "st", "stada", "staples", "star", "statebank", "statefarm", "stc", "stcgroup", "stockholm", "storage", "store", "stream", "studio", "study", "style", "su", "sucks", "supplies", "supply", "support", "surf", "surgery", "suzuki", "sv", "swatch", "swiss", "sx", "sy", "sydney", "systems", "sz", "tab", "taipei", "talk", "taobao", "target", "tatamotors", "tatar", "tattoo", "tax", "taxi", "tc", "tci", "td", "tdk", "team", "tech", "technology", "tel", "temasek", "tennis", "teva", "tf", "tg", "th", "thd", "theater", "theatre", "tiaa", "tickets", "tienda", "tips", "tires", "tirol", "tj", "tjmaxx", "tjx", "tk", "tkmaxx", "tl", "tm", "tmall", "tn", "to", "today", "tokyo", "tools", "top", "toray", "toshiba", "total", "tours", "town", "toyota", "toys", "tr", "trade", "trading", "training", "travel", "travelers", "travelersinsurance", "trust", "trv", "tt", "tube", "tui", "tunes", "tushu", "tv", "tvs", "tw", "tz", "ua", "ubank", "ubs", "ug", "uk", "unicom", "university", "uno", "uol", "ups", "us", "uy", "uz", "va", "vacations", "vana", "vanguard", "vc", "ve", "vegas", "ventures", "verisign", "versicherung", "vet", "vg", "vi", "viajes", "video", "vig", "viking", "villas", "vin", "vip", "virgin", "visa", "vision", "viva", "vivo", "vlaanderen", "vn", "vodka", "volvo", "vote", "voting", "voto", "voyage", "vu", "wales", "walmart", "walter", "wang", "wanggou", "watch", "watches", "weather", "weatherchannel", "webcam", "weber", "website", "wed", "wedding", "weibo", "weir", "wf", "whoswho", "wien", "wiki", "williamhill", "win", "windows", "wine", "winners", "wme", "woodside", "work", "works", "world", "wow", "ws", "wtc", "wtf", "xbox", "xerox", "xihuan", "xin", "xxx", "xyz", "yachts", "yahoo", "yamaxun", "yandex", "ye", "yodobashi", "yoga", "yokohama", "you", "youtube", "yt", "yun", "za", "zappos", "zara", "zero", "zip", "zm", "zone", "zuerich", "zw"];
5185
5396
  function website(config) {
5186
5397
  const rebulk = new Rebulk({ disabled: (context) => isDisabled(context, "website") });
5187
5398
  rebulk.regexDefaults({ flags: "i" }).stringDefaults({ ignoreCase: true });
5188
5399
  rebulk.defaults({ name: "website" });
5189
- const tlds = config["tlds"] || DEFAULT_TLDS;
5400
+ const tlds = config["tlds"] || TLDS;
5190
5401
  const safeTlds = config["safe_tlds"] || ["com", "org", "net"];
5191
5402
  const safeSubdomains = config["safe_subdomains"] || ["www"];
5192
5403
  const safePrefix = config["safe_prefixes"] || [];
@@ -5209,10 +5420,10 @@ function website(config) {
5209
5420
  tags: ["website.prefix"]
5210
5421
  });
5211
5422
  class PreferTitleOverWebsiteWithConfig extends Rule {
5212
- constructor(safeTldsArg, safePrefixArg) {
5423
+ constructor(safeSubdomainsArg, safePrefixArg) {
5213
5424
  super();
5214
5425
  this.consequence = RemoveMatch;
5215
- this.safeTlds = safeTldsArg;
5426
+ this.safeSubdomains = safeSubdomainsArg;
5216
5427
  this.safePrefix = safePrefixArg;
5217
5428
  }
5218
5429
  validFollowers(match) {
@@ -5222,7 +5433,7 @@ function website(config) {
5222
5433
  const toRemove = [];
5223
5434
  for (const websiteMatch of matches.named("website")) {
5224
5435
  let safe = false;
5225
- for (const safeStart of [...this.safeTlds, ...this.safePrefix]) {
5436
+ for (const safeStart of [...this.safeSubdomains, ...this.safePrefix]) {
5226
5437
  if (String(websiteMatch.value ?? "").toLowerCase().startsWith(safeStart)) {
5227
5438
  safe = true;
5228
5439
  break;
@@ -5253,7 +5464,7 @@ function website(config) {
5253
5464
  return toRemove;
5254
5465
  }
5255
5466
  }
5256
- rebulk.rules(new PreferTitleOverWebsiteWithConfig(safeTlds, safePrefix), ValidateWebsitePrefix);
5467
+ rebulk.rules(new PreferTitleOverWebsiteWithConfig(safeSubdomains, safePrefix), ValidateWebsitePrefix);
5257
5468
  return rebulk;
5258
5469
  }
5259
5470
  const _ValidateWebsitePrefix = class _ValidateWebsitePrefix extends Rule {
@@ -5561,9 +5772,46 @@ function date(config) {
5561
5772
  disabled: (context) => isDisabled(context, "date"),
5562
5773
  conflictSolver: (match, other2) => other2.name === "episode" || other2.name === "season" || other2.name === "crc32" ? other2 : "__default__"
5563
5774
  });
5564
- rebulk.rules(KeepMarkedYearInFilepart, RemoveGroupedYearWithSxxExx);
5775
+ rebulk.rules(KeepMarkedYearInFilepart, RemoveGroupedYearWithSxxExx, new AbsorbWeekdayPrefix(config["weekday_words"] ?? []));
5565
5776
  return rebulk;
5566
5777
  }
5778
+ class AbsorbWeekdayPrefix extends Rule {
5779
+ constructor(weekdayWords) {
5780
+ super();
5781
+ this.consequence = RemoveMatch;
5782
+ const sepsClass = "[" + seps.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "]";
5783
+ this.weekdayRe = new RegExp(
5784
+ "(?:^|" + sepsClass + ")(" + buildOrPattern(weekdayWords.length ? weekdayWords : ["\\bnever\\b"]) + ")" + sepsClass + "*$",
5785
+ "i"
5786
+ );
5787
+ }
5788
+ enabled(context) {
5789
+ return !isDisabled(context, "date");
5790
+ }
5791
+ when(matches, _context) {
5792
+ const input = matches.inputString ?? "";
5793
+ const ret = [];
5794
+ for (const dateMatch of matches.named("date") ?? []) {
5795
+ const filepart = matches.markers.atMatch(dateMatch, (m) => m.name === "path", 0);
5796
+ const lower = filepart ? filepart.start : 0;
5797
+ const segment = input.slice(lower, dateMatch.start);
5798
+ const weekday = this.weekdayRe.exec(segment);
5799
+ if (!weekday) continue;
5800
+ const groupStart = lower + weekday.index + weekday[0].indexOf(weekday[1]);
5801
+ const claimed = matches.range(groupStart, dateMatch.start, (m) => !m.private);
5802
+ if ((Array.isArray(claimed) ? claimed.length : claimed ? 1 : 0) > 0) continue;
5803
+ ret.push([dateMatch, groupStart]);
5804
+ }
5805
+ return ret.length ? ret : false;
5806
+ }
5807
+ then(matches, whenResponse, _context) {
5808
+ for (const [dateMatch, newStart] of whenResponse) {
5809
+ matches.remove(dateMatch);
5810
+ dateMatch.start = newStart;
5811
+ matches.append(dateMatch);
5812
+ }
5813
+ }
5814
+ }
5567
5815
  function markerComparatorPredicate(m) {
5568
5816
  return !m.private && m.name !== "proper_count" && m.name !== "title" && !(m.name === "container" && m.tags?.includes("extension")) && !(m.name === "other" && m.value === "Rip");
5569
5817
  }
@@ -5575,10 +5823,11 @@ function markerWeight(matches, marker, predicate) {
5575
5823
  }
5576
5824
  function markerSorted(markers, matches, predicate = markerComparatorPredicate) {
5577
5825
  const markersArr = [...markers];
5826
+ const originalIndex = new Map(markersArr.map((m, i) => [m, i]));
5578
5827
  return markersArr.sort((a, b) => {
5579
5828
  const weightDiff = markerWeight(matches, b, predicate) - markerWeight(matches, a, predicate);
5580
5829
  if (weightDiff !== 0) return weightDiff;
5581
- return markersArr.indexOf(b) - markersArr.indexOf(a);
5830
+ return (originalIndex.get(b) ?? 0) - (originalIndex.get(a) ?? 0);
5582
5831
  });
5583
5832
  }
5584
5833
  function buildExpectedFunction(optionName) {
@@ -5791,7 +6040,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5791
6040
  * Check and extract titles from a filepart.
5792
6041
  * Mirrors Python's TitleBaseRule.check_titles_in_filepart().
5793
6042
  */
5794
- checkTitlesInFilepart(filepart, matches) {
6043
+ checkTitlesInFilepart(filepart, matches, context) {
5795
6044
  const toAppend = [];
5796
6045
  const toRemove = [];
5797
6046
  const firstYearInFilepart = matches.range(
@@ -5862,6 +6111,16 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5862
6111
  (m) => this.isIgnored(m)
5863
6112
  );
5864
6113
  const ignoredArray = Array.isArray(ignoredInHole) ? ignoredInHole : ignoredInHole ? [ignoredInHole] : [];
6114
+ if (ignoredArray.length > 0 && ignoredArray.every((m) => m.name === "language" || m.name === "country")) {
6115
+ const inpFull = matches.inputString ?? "";
6116
+ let rest = inpFull.slice(hole.start, hole.end);
6117
+ for (const m of ignoredArray) {
6118
+ const rel = m.start - hole.start;
6119
+ rest = rest.slice(0, rel) + " ".repeat(m.end - m.start) + rest.slice(m.end - hole.start);
6120
+ }
6121
+ const hasTitleText = [...rest].some((c) => !seps.includes(c) && c !== " ");
6122
+ if (!hasTitleText) continue;
6123
+ }
5865
6124
  let trimmedHole = hole;
5866
6125
  const inp = matches.inputString ?? "";
5867
6126
  while (trimmedHole.start < trimmedHole.end && seps.includes(inp[trimmedHole.start])) {
@@ -5967,7 +6226,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
5967
6226
  console.log(` result: hole=[${trimmedHole.start},${trimmedHole.end}) length=${trimmedHole.length} value="${trimmedHole.value}"`);
5968
6227
  }
5969
6228
  if (trimmedHole.length > 0 && !this.shouldRemove(trimmedHole) && trimmedHole.value) {
5970
- const splitResult = this.splitTitleAlternative(trimmedHole, inp);
6229
+ const splitResult = this.alternativePropertyName && !isDisabled(context, this.alternativePropertyName) ? this.splitTitleAlternative(trimmedHole, inp) : null;
5971
6230
  if (splitResult) {
5972
6231
  splitResult.title.name = this.matchName;
5973
6232
  toAppend.push(splitResult.title);
@@ -6093,7 +6352,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
6093
6352
  for (const filepart of sortedFileparts) {
6094
6353
  yearFileparts.delete(filepart);
6095
6354
  if (!this.filepartFilter(filepart)) continue;
6096
- const result = this.checkTitlesInFilepart(filepart, matches);
6355
+ const result = this.checkTitlesInFilepart(filepart, matches, context);
6097
6356
  if (result.toAppend.length > 0 || result.toRemove.length > 0) {
6098
6357
  if (serieNameMatch) {
6099
6358
  const normTitle = (s) => foldDiacritics(s).replace(/[''`]/g, "").replace(/\.+$/, "").toLowerCase().trim();
@@ -6110,7 +6369,7 @@ const _TitleBaseRule = class _TitleBaseRule extends Rule {
6110
6369
  }
6111
6370
  for (const filepart of yearFileparts) {
6112
6371
  if (!this.filepartFilter(filepart)) continue;
6113
- const result = this.checkTitlesInFilepart(filepart, matches);
6372
+ const result = this.checkTitlesInFilepart(filepart, matches, context);
6114
6373
  const filteredAppend = [];
6115
6374
  for (const newTitle of result.toAppend) {
6116
6375
  if (newTitle.name !== this.matchName) {
@@ -6244,7 +6503,11 @@ const _ExtendLoneArticleTitle = class _ExtendLoneArticleTitle extends Rule {
6244
6503
  const inp = matches.inputString || "";
6245
6504
  const out = [];
6246
6505
  const titles = matches.named("title");
6247
- const titleArr = Array.isArray(titles) ? titles : titles ? [titles] : [];
6506
+ const epTitles = matches.named("episode_title");
6507
+ const titleArr = [
6508
+ ...Array.isArray(titles) ? titles : titles ? [titles] : [],
6509
+ ...Array.isArray(epTitles) ? epTitles : epTitles ? [epTitles] : []
6510
+ ];
6248
6511
  for (const title2 of titleArr) {
6249
6512
  if (!ARTICLES.has(String(title2.value ?? "").trim().toLowerCase())) continue;
6250
6513
  const filepart = matches.markers.atMatch(title2, (m) => m.name === "path", 0);
@@ -6300,11 +6563,18 @@ const _CountryAtTitlePosition = class _CountryAtTitlePosition extends Rule {
6300
6563
  const filepart = matches.markers.atMatch(c, (m) => m.name === "path", 0);
6301
6564
  if (!filepart) continue;
6302
6565
  if (![...inp.slice(filepart.start, c.start)].every((ch) => seps.includes(ch))) continue;
6303
- const year = matches.range(c.end, filepart.end, (m) => !m.private && m.name === "year", 0);
6304
- if (!year) continue;
6305
- const se = matches.range(c.end, year.start, (m) => !m.private && ["season", "episode", "date"].includes(m.name ?? ""), 0);
6306
- if (se) continue;
6307
- if (![...inp.slice(c.end, year.start)].every((ch) => seps.includes(ch))) continue;
6566
+ if (["release-group-prefix", "streaming_service.prefix", "streaming_service.suffix"].some((t) => c.tags?.includes(t))) continue;
6567
+ if (matches.markers.atMatch(c, (m) => m.name === "group", 0)) continue;
6568
+ const anchor = matches.range(
6569
+ c.end,
6570
+ filepart.end,
6571
+ (m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
6572
+ 0
6573
+ );
6574
+ if (!anchor) continue;
6575
+ if (![...inp.slice(c.end, anchor.start)].every((ch) => seps.includes(ch))) {
6576
+ if (matches.range(c.end, anchor.start, (m) => !m.private && m.value != null, 0)) continue;
6577
+ }
6308
6578
  out.push(c);
6309
6579
  }
6310
6580
  return out.length ? out : false;
@@ -6312,6 +6582,76 @@ const _CountryAtTitlePosition = class _CountryAtTitlePosition extends Rule {
6312
6582
  };
6313
6583
  _CountryAtTitlePosition.priority = 64;
6314
6584
  let CountryAtTitlePosition = _CountryAtTitlePosition;
6585
+ const _TitleWordAtTitlePosition = class _TitleWordAtTitlePosition extends Rule {
6586
+ constructor() {
6587
+ super(...arguments);
6588
+ this.priority = 64;
6589
+ this.consequence = RemoveMatch;
6590
+ }
6591
+ when(matches, _context) {
6592
+ const toRemove = [];
6593
+ const tagged = matches.tagged("title-word") ?? [];
6594
+ for (const candidate of Array.isArray(tagged) ? tagged : [tagged]) {
6595
+ if (!candidate || candidate.private) continue;
6596
+ const filepart = matches.markers.atMatch(candidate, (m) => m.name === "path", 0);
6597
+ if (!filepart) continue;
6598
+ const anchor = matches.range(
6599
+ filepart.start,
6600
+ filepart.end,
6601
+ (m) => !m.private && ["year", "season", "episode", "date"].includes(m.name ?? ""),
6602
+ 0
6603
+ );
6604
+ if (!anchor || candidate.start >= anchor.start) continue;
6605
+ toRemove.push(candidate);
6606
+ }
6607
+ return toRemove.length ? toRemove : false;
6608
+ }
6609
+ };
6610
+ _TitleWordAtTitlePosition.priority = 64;
6611
+ let TitleWordAtTitlePosition = _TitleWordAtTitlePosition;
6612
+ const NON_LATIN_SCRIPT_RE = /[\u0370-\u03FF\u0400-\u04FF\u0590-\u05FF\u0600-\u06FF\u0E00-\u0E7F\u3000-\u303F\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uAC00-\uD7AF\uFF00-\uFFEF]/;
6613
+ const _SplitOriginalScriptTitle = class _SplitOriginalScriptTitle extends Rule {
6614
+ constructor() {
6615
+ super(...arguments);
6616
+ this.priority = POST_PROCESS;
6617
+ this.consequence = [RemoveMatch, AppendMatch];
6618
+ }
6619
+ when(matches, context) {
6620
+ if (isDisabled(context, "alternative_title")) return false;
6621
+ const input = matches.inputString ?? "";
6622
+ const toRemove = [];
6623
+ const toAppend = [];
6624
+ for (const titleMatch of matches.named("title")) {
6625
+ if (titleMatch.tags?.includes("expected")) continue;
6626
+ const raw = input.slice(titleMatch.start, titleMatch.end);
6627
+ const latin = new RegExp("(?:^|[" + sepsPattern + "])([A-Za-z])").exec(raw);
6628
+ if (!latin) continue;
6629
+ const latinOffset = latin.index + latin[0].indexOf(latin[1]);
6630
+ const prefix = raw.slice(0, latinOffset);
6631
+ if (!NON_LATIN_SCRIPT_RE.test(prefix)) continue;
6632
+ let prefixTrim = prefix;
6633
+ while (prefixTrim.length && seps.includes(prefixTrim[prefixTrim.length - 1])) prefixTrim = prefixTrim.slice(0, -1);
6634
+ const prefixEnd = titleMatch.start + prefixTrim.length;
6635
+ const latinStart = titleMatch.start + latinOffset;
6636
+ if (prefixEnd <= titleMatch.start) continue;
6637
+ toRemove.push(titleMatch);
6638
+ toAppend.push(new Match(titleMatch.start, prefixEnd, {
6639
+ name: "alternative_title",
6640
+ value: cleanup(input.slice(titleMatch.start, prefixEnd)),
6641
+ inputString: input
6642
+ }));
6643
+ toAppend.push(new Match(latinStart, titleMatch.end, {
6644
+ name: "title",
6645
+ tags: ["title"],
6646
+ value: cleanup(input.slice(latinStart, titleMatch.end)),
6647
+ inputString: input
6648
+ }));
6649
+ }
6650
+ return toRemove.length || toAppend.length ? [toRemove, toAppend] : false;
6651
+ }
6652
+ };
6653
+ _SplitOriginalScriptTitle.priority = POST_PROCESS;
6654
+ let SplitOriginalScriptTitle = _SplitOriginalScriptTitle;
6315
6655
  const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle extends Rule {
6316
6656
  constructor() {
6317
6657
  super(...arguments);
@@ -6332,6 +6672,7 @@ const _PropertyAtTitlePositionAsTitle = class _PropertyAtTitlePositionAsTitle ex
6332
6672
  const lead = matches.range(filepart.start, filepart.end, (m) => !m.private && !!m.value, 0);
6333
6673
  if (!lead || !["other", "country", "edition"].includes(lead.name ?? "")) continue;
6334
6674
  if (lead.start >= anchor.start) continue;
6675
+ if ((lead.raw ?? "") === String(lead.value ?? "")) continue;
6335
6676
  if (![...inp.slice(filepart.start, lead.start)].every((c) => seps.includes(c))) continue;
6336
6677
  out.push(lead);
6337
6678
  }
@@ -6458,7 +6799,7 @@ function title(config) {
6458
6799
  const rebulk = new Rebulk({
6459
6800
  disabled: (context) => isDisabled(context, "title")
6460
6801
  });
6461
- rebulk.rules(CountryAtTitlePosition, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle);
6802
+ rebulk.rules(CountryAtTitlePosition, TitleWordAtTitlePosition, SplitOriginalScriptTitle, TitleFromPosition, PreferTitleWithYear, ExtendLoneArticleTitle, PropertyAtTitlePositionAsTitle, RemoveNumericAlternativeTitle, RemoveTailAlternativeTitle, RemoveTailTitle);
6462
6803
  const expectedTitle = buildExpectedFunction("expected_title");
6463
6804
  rebulk.functional(expectedTitle, {
6464
6805
  name: "title",
@@ -7248,7 +7589,9 @@ class Filepart2EpisodeTitle extends Rule {
7248
7589
  );
7249
7590
  if (episodeNumber) {
7250
7591
  const season = matches.range(directory.start, directory.end, (m) => m.name === "season", 0) || matches.range(filename.start, filename.end, (m) => m.name === "season", 0);
7251
- if (season) {
7592
+ const anySeason = matches.named("season");
7593
+ const hasAnySeason = Array.isArray(anySeason) ? anySeason.length > 0 : !!anySeason;
7594
+ if (season || !hasAnySeason) {
7252
7595
  const hole = parentTitleHole(matches, directory.start, directory.end);
7253
7596
  if (hole) {
7254
7597
  const groupMarkers = matches.markers.named("group");
@@ -8447,14 +8790,6 @@ class DashSeparatedReleaseGroup extends Rule {
8447
8790
  if (matches.range(candidate.start, candidate.end, (m) => m.name === "episode", 0)) {
8448
8791
  return false;
8449
8792
  }
8450
- if (candidate.start === start && matches.range(
8451
- candidate.end,
8452
- end,
8453
- (m) => ["season", "episode", "date"].includes(m.name ?? "") && !m.private,
8454
- 0
8455
- )) {
8456
- return false;
8457
- }
8458
8793
  const firstHole = matches.holes(
8459
8794
  candidate.end,
8460
8795
  end,
@@ -8463,6 +8798,16 @@ class DashSeparatedReleaseGroup extends Rule {
8463
8798
  if (!firstHole) {
8464
8799
  return false;
8465
8800
  }
8801
+ const holeRaw = String(firstHole.raw ?? "");
8802
+ const holeCore = holeRaw.replace(new RegExp("^[" + sepsPattern + "]+|[" + sepsPattern + "]+$", "g"), "");
8803
+ if (candidate.start === start && !holeCore.includes(".") && !holeCore.includes(" ") && matches.range(
8804
+ candidate.end,
8805
+ end,
8806
+ (m) => ["season", "episode", "date"].includes(m.name ?? "") && !m.private,
8807
+ 0
8808
+ )) {
8809
+ return false;
8810
+ }
8466
8811
  const rawValue = firstHole.raw;
8467
8812
  return rawValue[0] === "-" && !rawValue.slice(1).includes("-") && rawValue.includes(".") && !rawValue.includes(" ");
8468
8813
  }
@@ -8631,6 +8976,32 @@ const _SceneReleaseGroup = class _SceneReleaseGroup extends Rule {
8631
8976
  }
8632
8977
  );
8633
8978
  if (lastHole) {
8979
+ const holeGroup = matches.markers.atMatch(lastHole, (m) => m.name === "group", 0);
8980
+ if (holeGroup && String(holeGroup.raw ?? "").startsWith("(")) {
8981
+ const hasEpisodeish = (matches.range(
8982
+ start,
8983
+ end,
8984
+ (m) => m.name === "episode" || m.name === "season"
8985
+ ) ?? []).length > 0;
8986
+ if (hasEpisodeish) {
8987
+ const firstGroup = matches.markers.range(
8988
+ start,
8989
+ end,
8990
+ (m) => m.name === "group" && m.start === start,
8991
+ 0
8992
+ );
8993
+ if (firstGroup) {
8994
+ const inner = matches.range(
8995
+ firstGroup.start,
8996
+ firstGroup.end,
8997
+ (mm) => !mm.tags.includes("weak-language")
8998
+ ) ?? [];
8999
+ const core = String(firstGroup.value ?? "").replace(new RegExp(`[${sepsPattern}]`, "g"), "");
9000
+ const emptyish = inner.length === 0 || inner.every((mm) => mm.name === "container" && mm.tags?.includes("subtitle"));
9001
+ if (emptyish && core && !intCoercable(core)) continue;
9002
+ }
9003
+ }
9004
+ }
8634
9005
  const previousMatchFilter = (match) => {
8635
9006
  if (match.start < filepart.start) {
8636
9007
  return false;
@@ -8694,7 +9065,6 @@ const _AnimeReleaseGroup = class _AnimeReleaseGroup extends Rule {
8694
9065
  (mm) => !mm.tags.includes("weak-language")
8695
9066
  );
8696
9067
  if (innerMatches.length === 0) return true;
8697
- if (innerMatches.every((mm) => mm.name === "other")) return true;
8698
9068
  if (m.start === filepart.start && innerMatches.every((mm) => mm.name === "container" && mm.tags?.includes("subtitle"))) {
8699
9069
  return true;
8700
9070
  }
@@ -8863,7 +9233,11 @@ function other(config) {
8863
9233
  rebulk.regexDefaults({ flags: "i", abbreviations: [dash] }).stringDefaults({ ignoreCase: true });
8864
9234
  rebulk.defaults({ name: "other", validator: sepsSurround });
8865
9235
  loadConfigPatterns(rebulk, config["other"]);
9236
+ openingEndingCredits(rebulk);
8866
9237
  rebulk.rules(
9238
+ AppendCreditless,
9239
+ AppendOpedEndingCredits,
9240
+ ValidateStereoVRContext,
8867
9241
  RenameAnotherToOther,
8868
9242
  ValidateHasNeighbor,
8869
9243
  ValidateHasNeighborAfter,
@@ -8928,9 +9302,132 @@ const _ImageArtKeywordToOther = class _ImageArtKeywordToOther extends Rule {
8928
9302
  };
8929
9303
  _ImageArtKeywordToOther.priority = POST_PROCESS;
8930
9304
  let ImageArtKeywordToOther = _ImageArtKeywordToOther;
8931
- function completeWords(rebulk, seasonWords, completeArticleWords) {
8932
- const seasonWordsPattern = buildOrPattern(seasonWords);
8933
- const completeArticleWordsPattern = buildOrPattern(completeArticleWords);
9305
+ const CREDITS_NUMBER = `(?P<credits_number>\\d+(?:(?![vV]\\d)[^\\W\\d_])?)?`;
9306
+ const CREDITS_VERSION = `(?:-?[vV](?P<version>\\d+))?`;
9307
+ const CREDITS_SUFFIX = CREDITS_NUMBER + CREDITS_VERSION;
9308
+ function formatCreditsNumber(value) {
9309
+ const m = /^(\d+)(\w?)$/.exec(value);
9310
+ if (!m) return value;
9311
+ return String(parseInt(m[1], 10)) + m[2].toLowerCase();
9312
+ }
9313
+ function openingEndingCredits(rebulk) {
9314
+ const add = (pattern, value, ignoreCase) => {
9315
+ rebulk.regex(
9316
+ `(?P<other>` + pattern + `)` + CREDITS_SUFFIX,
9317
+ {
9318
+ flags: ignoreCase ? "i" : "",
9319
+ name: "other",
9320
+ children: true,
9321
+ privateParent: true,
9322
+ validateAll: true,
9323
+ validator: { __parent__: sepsSurround },
9324
+ formatter: {
9325
+ other: () => value,
9326
+ credits_number: formatCreditsNumber,
9327
+ version: (v) => parseInt(v, 10)
9328
+ },
9329
+ disabled: (context) => isDisabled(context, "other")
9330
+ }
9331
+ );
9332
+ };
9333
+ add(`NC-?OP|creditless-?op(?:ening)?`, "Opening Credits", true);
9334
+ add(`NC-?ED|creditless-?(?:ed|ending)`, "Ending Credits", true);
9335
+ add(`OPED|OP`, "Opening Credits", false);
9336
+ add(`ED`, "Ending Credits", false);
9337
+ }
9338
+ const _AppendCreditless = class _AppendCreditless extends Rule {
9339
+ constructor() {
9340
+ super(...arguments);
9341
+ this.priority = POST_PROCESS;
9342
+ this.consequence = AppendMatch;
9343
+ }
9344
+ when(matches, _context) {
9345
+ const toAppend = [];
9346
+ for (const match of matches.named("other", (m) => m.value === "Opening Credits" || m.value === "Ending Credits") ?? []) {
9347
+ const raw = (match.raw ?? "").toLowerCase().replace(/[\s._-]+/g, "");
9348
+ if (raw.startsWith("nc") || raw.includes("creditless")) {
9349
+ toAppend.push(new Match(match.start, match.end, {
9350
+ name: "other",
9351
+ value: "Creditless",
9352
+ inputString: matches.inputString
9353
+ }));
9354
+ }
9355
+ }
9356
+ return toAppend.length ? toAppend : false;
9357
+ }
9358
+ };
9359
+ _AppendCreditless.priority = POST_PROCESS;
9360
+ _AppendCreditless.properties = { other: ["Creditless"] };
9361
+ let AppendCreditless = _AppendCreditless;
9362
+ const _AppendOpedEndingCredits = class _AppendOpedEndingCredits extends Rule {
9363
+ constructor() {
9364
+ super(...arguments);
9365
+ this.priority = POST_PROCESS;
9366
+ this.consequence = AppendMatch;
9367
+ }
9368
+ when(matches, _context) {
9369
+ const toAppend = [];
9370
+ for (const match of matches.named("other", (m) => m.value === "Opening Credits") ?? []) {
9371
+ if ((match.raw ?? "").toLowerCase().replace(/[\s._-]+/g, "") === "oped") {
9372
+ toAppend.push(new Match(match.start, match.end, {
9373
+ name: "other",
9374
+ value: "Ending Credits",
9375
+ inputString: matches.inputString
9376
+ }));
9377
+ }
9378
+ }
9379
+ return toAppend.length ? toAppend : false;
9380
+ }
9381
+ };
9382
+ _AppendOpedEndingCredits.priority = POST_PROCESS;
9383
+ _AppendOpedEndingCredits.properties = { other: ["Ending Credits"] };
9384
+ let AppendOpedEndingCredits = _AppendOpedEndingCredits;
9385
+ const STEREO_VR_CONTEXT_TAG = "stereo-vr-context";
9386
+ const VR_CONTEXT_VALUES = /* @__PURE__ */ new Set(["Virtual Reality", "3D"]);
9387
+ const _ValidateStereoVRContext = class _ValidateStereoVRContext extends Rule {
9388
+ constructor() {
9389
+ super(...arguments);
9390
+ this.priority = 64;
9391
+ this.consequence = RemoveMatch;
9392
+ }
9393
+ when(matches, _context) {
9394
+ const toRemove = [];
9395
+ const fileparts = matches.markers.named("path");
9396
+ for (const filepart of Array.isArray(fileparts) ? fileparts : fileparts ? [fileparts] : []) {
9397
+ const gated = matches.range(
9398
+ filepart.start,
9399
+ filepart.end,
9400
+ (m) => m.name === "other" && m.tags.includes(STEREO_VR_CONTEXT_TAG)
9401
+ );
9402
+ if (!gated?.length) continue;
9403
+ const hasVrContext = matches.range(
9404
+ filepart.start,
9405
+ filepart.end,
9406
+ (m) => m.name === "other" && VR_CONTEXT_VALUES.has(String(m.value))
9407
+ )?.length > 0;
9408
+ if (hasVrContext) {
9409
+ for (const stereo of gated) {
9410
+ toRemove.push(...matches.range(
9411
+ stereo.start,
9412
+ stereo.end,
9413
+ (m) => m.name === "streaming_service"
9414
+ ) ?? []);
9415
+ }
9416
+ } else {
9417
+ toRemove.push(...gated);
9418
+ }
9419
+ }
9420
+ return toRemove.length ? toRemove : false;
9421
+ }
9422
+ };
9423
+ _ValidateStereoVRContext.priority = 64;
9424
+ let ValidateStereoVRContext = _ValidateStereoVRContext;
9425
+ const TOKEN_START = `(?<![^\\W_])`;
9426
+ function completeWords(rebulk, opts) {
9427
+ const completeMarkerPattern = buildOrPattern(opts.completeMarkerWords);
9428
+ const seasonWordsPattern = buildOrPattern(opts.seasonWords);
9429
+ const completeArticleWordsPattern = buildOrPattern(opts.completeArticleWords);
9430
+ const seasonNumbersPattern = `(?:-+(?:\\d+|` + buildOrPattern(opts.seasonNumberSeparators, void 0, true) + `))+-+`;
8934
9431
  function validateComplete(match) {
8935
9432
  const children = match.children;
8936
9433
  if (!children.named("completeWordsBefore") && !children.named("completeWordsAfter")) {
@@ -8939,7 +9436,7 @@ function completeWords(rebulk, seasonWords, completeArticleWords) {
8939
9436
  return true;
8940
9437
  }
8941
9438
  rebulk.regex(
8942
- `(?P<completeArticle>${completeArticleWordsPattern}-)?(?P<completeWordsBefore>${seasonWordsPattern}-)?Complete(?P<completeWordsAfter>-${seasonWordsPattern})?`,
9439
+ TOKEN_START + `(?P<completeArticle>${completeArticleWordsPattern}-)?(?P<completeWordsBefore>${seasonWordsPattern}-)?` + completeMarkerPattern + `(?P<completeWordsAfter>-${seasonWordsPattern})?`,
8943
9440
  {
8944
9441
  privateNames: ["completeArticle", "completeWordsBefore", "completeWordsAfter"],
8945
9442
  value: { other: "Complete" },
@@ -8949,6 +9446,26 @@ function completeWords(rebulk, seasonWords, completeArticleWords) {
8949
9446
  }
8950
9447
  }
8951
9448
  );
9449
+ rebulk.regex(
9450
+ seasonWordsPattern + seasonNumbersPattern + `(?P<other>` + completeMarkerPattern + `)`,
9451
+ {
9452
+ children: true,
9453
+ privateParent: true,
9454
+ validateAll: true,
9455
+ value: { other: "Complete" },
9456
+ tags: ["release-group-prefix"],
9457
+ validator: { __parent__: sepsSurround }
9458
+ }
9459
+ );
9460
+ rebulk.regex(
9461
+ TOKEN_START + `(?P<completePrefix>` + buildOrPattern(opts.completePrefixWords) + `-?)` + completeMarkerPattern,
9462
+ {
9463
+ privateNames: ["completePrefix"],
9464
+ value: { other: "Complete" },
9465
+ tags: ["release-group-prefix"],
9466
+ validator: { __parent__: sepsSurround }
9467
+ }
9468
+ );
8952
9469
  }
8953
9470
  const _ProperCountRule = class _ProperCountRule extends Rule {
8954
9471
  when(matches, context) {
@@ -9242,10 +9759,20 @@ const _RemoveTitleCaseAmbiguous = class _RemoveTitleCaseAmbiguous extends Rule {
9242
9759
  // lowercase scene spellings are unaffected; only the Title-Case word is removed.
9243
9760
  when(matches) {
9244
9761
  const TITLE_WORDS = /* @__PURE__ */ new Set(["Real", "Cam", "Convert"]);
9762
+ const RELEASE_META = /* @__PURE__ */ new Set(["screen_size", "video_codec", "audio_codec", "video_profile", "release_group"]);
9245
9763
  const ret = [];
9246
9764
  for (const m of matches.range(0, matches.inputString?.length ?? 0)) {
9247
9765
  if (m.name !== "other" && m.name !== "source") continue;
9248
- if (TITLE_WORDS.has(m.raw ?? "")) ret.push(m);
9766
+ if (!TITLE_WORDS.has(m.raw ?? "")) continue;
9767
+ const filepart = matches.markers.atMatch(m, (marker) => marker.name === "path", 0);
9768
+ const searchEnd = filepart?.end ?? (matches.inputString?.length ?? m.end);
9769
+ const metaAfter = matches.range(
9770
+ m.end,
9771
+ searchEnd,
9772
+ (o) => !o.private && RELEASE_META.has(o.name ?? "")
9773
+ ) ?? [];
9774
+ if (metaAfter.length > 0) continue;
9775
+ ret.push(m);
9249
9776
  }
9250
9777
  return ret.length ? ret : false;
9251
9778
  }
@@ -9580,9 +10107,35 @@ function film(config) {
9580
10107
  rebulk.regexDefaults({ flags: "i", abbreviations: [dash] }).stringDefaults({ ignoreCase: true });
9581
10108
  rebulk.defaults({ name: "film", validator: sepsSurround });
9582
10109
  loadConfigPatterns(rebulk, config["film"]);
9583
- rebulk.rules(FilmTitleRule);
10110
+ rebulk.rules(LeadingFilmNumberRule, FilmTitleRule);
9584
10111
  return rebulk;
9585
10112
  }
10113
+ const _LeadingFilmNumberRule = class _LeadingFilmNumberRule extends Rule {
10114
+ constructor() {
10115
+ super(...arguments);
10116
+ this.consequence = RemoveMatch;
10117
+ }
10118
+ when(matches, _context) {
10119
+ const toRemove = [];
10120
+ const films = matches.named("film", (m) => !m.private) ?? [];
10121
+ for (const filmMatch of Array.isArray(films) ? films : [films]) {
10122
+ const filepath = matches.markers.atMatch(filmMatch, (m) => m.name === "path", 0);
10123
+ if (!filepath) continue;
10124
+ const hole = matches.holes(
10125
+ filepath.start,
10126
+ filmMatch.start + 1,
10127
+ { formatter: cleanup, index: 0 }
10128
+ );
10129
+ if (!(hole && hole.value)) {
10130
+ toRemove.push(filmMatch);
10131
+ if (filmMatch.parent) toRemove.push(filmMatch.parent);
10132
+ }
10133
+ }
10134
+ return toRemove.length ? toRemove : false;
10135
+ }
10136
+ };
10137
+ _LeadingFilmNumberRule.consequence = RemoveMatch;
10138
+ let LeadingFilmNumberRule = _LeadingFilmNumberRule;
9586
10139
  const _FilmTitleRule = class _FilmTitleRule extends Rule {
9587
10140
  enabled(context) {
9588
10141
  return !isDisabled(context, "film_title");
@@ -9908,6 +10461,13 @@ const _TypeProcessor = class _TypeProcessor extends Rule {
9908
10461
  return "episode";
9909
10462
  }
9910
10463
  }
10464
+ const completeSeries = matches.named(
10465
+ "other",
10466
+ (m) => m.value === "Complete" && !!(m.children?.named?.("completeWordsBefore")?.length || m.children?.named?.("completeWordsAfter")?.length)
10467
+ );
10468
+ if (completeSeries && (Array.isArray(completeSeries) ? completeSeries.length > 0 : true)) {
10469
+ return "episode";
10470
+ }
9911
10471
  const film2 = matches.named("film");
9912
10472
  if (film2 && (Array.isArray(film2) ? film2.length > 0 : true)) {
9913
10473
  return "movie";
@@ -9932,6 +10492,10 @@ const _TypeProcessor = class _TypeProcessor extends Rule {
9932
10492
  if (crc32 && (Array.isArray(crc32) ? crc32.length > 0 : true) && animeReleaseGroup && (Array.isArray(animeReleaseGroup) ? animeReleaseGroup.length > 0 : true)) {
9933
10493
  return "episode";
9934
10494
  }
10495
+ const complete = matches.named("other", (m) => m.value === "Complete");
10496
+ if (complete && (Array.isArray(complete) ? complete.length > 0 : true) && (!year || (Array.isArray(year) ? year.length === 0 : false))) {
10497
+ return "episode";
10498
+ }
9935
10499
  return "movie";
9936
10500
  }
9937
10501
  then(matches, whenResponse, _context) {
@@ -10136,17 +10700,40 @@ const _RemoveAmbiguous = class _RemoveAmbiguous extends Rule {
10136
10700
  _RemoveAmbiguous.priority = POST_PROCESS;
10137
10701
  _RemoveAmbiguous.consequence = RemoveMatch;
10138
10702
  let RemoveAmbiguous = _RemoveAmbiguous;
10703
+ const sxxExxWeightPredicate = (m) => (m.name === "season" || m.name === "episode") && m.tags.includes("SxxExx");
10139
10704
  class RemoveLessSpecificSeasonEpisode extends RemoveAmbiguous {
10140
10705
  constructor(name) {
10141
10706
  super(
10142
- (markers, matches) => markerSorted(
10143
- [...[...markers].reverse()],
10144
- matches,
10145
- (m) => m.name === name && m.tags.includes("SxxExx")
10146
- ),
10707
+ // Sort fileparts most-valuable-first: a SxxExx-tagged season/episode outweighs a
10708
+ // weaker one, so the filename's S44E03 beats a season-only or weak-number parent
10709
+ // directory (upstream #797/#772).
10710
+ (markers, matches) => markerSorted(markers, matches, sxxExxWeightPredicate),
10147
10711
  (m) => m.name === name
10148
10712
  );
10149
10713
  }
10714
+ when(matches, context) {
10715
+ const markers = matches.markers.named("path");
10716
+ const markerArr = Array.isArray(markers) ? markers : markers ? [markers] : [];
10717
+ if (markerArr.length > 1) {
10718
+ const weights = markerArr.map((marker) => {
10719
+ const inRange = matches.range(marker.start, marker.end, sxxExxWeightPredicate);
10720
+ return new Set((Array.isArray(inRange) ? inRange : []).map((m) => m.name)).size;
10721
+ });
10722
+ const top = Math.max(...weights);
10723
+ if (weights.filter((w) => w === top).length > 1) return [];
10724
+ }
10725
+ return super.when(matches, context);
10726
+ }
10727
+ }
10728
+ class RemoveLessSpecificSeason extends RemoveLessSpecificSeasonEpisode {
10729
+ constructor() {
10730
+ super("season");
10731
+ }
10732
+ }
10733
+ class RemoveLessSpecificEpisode extends RemoveLessSpecificSeasonEpisode {
10734
+ constructor() {
10735
+ super("episode");
10736
+ }
10150
10737
  }
10151
10738
  const _SeasonYear = class _SeasonYear extends Rule {
10152
10739
  when(matches, _context) {
@@ -10239,8 +10826,8 @@ function processors(_config) {
10239
10826
  return new Rebulk().rules(
10240
10827
  EnlargeGroupMatches,
10241
10828
  EquivalentHoles,
10242
- new RemoveLessSpecificSeasonEpisode("season"),
10243
- new RemoveLessSpecificSeasonEpisode("episode"),
10829
+ RemoveLessSpecificSeason,
10830
+ RemoveLessSpecificEpisode,
10244
10831
  RemoveAmbiguous,
10245
10832
  SeasonYear,
10246
10833
  YearSeason,
@@ -10273,9 +10860,13 @@ function rebulkBuilder(config) {
10273
10860
  rebulk.rebulk(streamingService(cfg("streaming_service")));
10274
10861
  const otherRebulk = other(cfg("other"));
10275
10862
  cfg("episodes");
10276
- const completeSeasonWords = ["seasons?", "series?"];
10277
- const completeArticleWords = ["The"];
10278
- completeWords(otherRebulk, completeSeasonWords, completeArticleWords);
10863
+ completeWords(otherRebulk, {
10864
+ completeMarkerWords: ["Complete", "Int[ée]grale"],
10865
+ seasonWords: ["seasons?", "mini-?series?", "series?"],
10866
+ completeArticleWords: ["The"],
10867
+ completePrefixWords: ["L['’]?", "Coffret"],
10868
+ seasonNumberSeparators: ["&", "and"]
10869
+ });
10279
10870
  rebulk.rebulk(otherRebulk);
10280
10871
  rebulk.rebulk(size(cfg("size")));
10281
10872
  rebulk.rebulk(bitRate(cfg("bit_rate")));
@@ -10414,7 +11005,10 @@ const advanced_config = {
10414
11005
  "True-?HD"
10415
11006
  ]
10416
11007
  },
10417
- Opus: "Opus",
11008
+ Opus: {
11009
+ string: "Opus",
11010
+ tags: "title-word"
11011
+ },
10418
11012
  Vorbis: "Vorbis",
10419
11013
  PCM: "PCM",
10420
11014
  LPCM: "LPCM"
@@ -10918,27 +11512,104 @@ const advanced_config = {
10918
11512
  "saisons",
10919
11513
  "tem",
10920
11514
  "temp",
10921
- "temporada",
10922
- "temporadas",
10923
- "stagione"
11515
+ {
11516
+ value: "temporada",
11517
+ numfirst: true
11518
+ },
11519
+ {
11520
+ value: "temporadas",
11521
+ numfirst: true
11522
+ },
11523
+ "stagione",
11524
+ {
11525
+ value: "сезон",
11526
+ numfirst: true
11527
+ },
11528
+ {
11529
+ value: "sezon",
11530
+ numfirst: true
11531
+ },
11532
+ {
11533
+ value: "staffel",
11534
+ numfirst: true
11535
+ },
11536
+ "sezonul",
11537
+ "säsong",
11538
+ "sesong",
11539
+ "sæson",
11540
+ {
11541
+ value: "évad",
11542
+ numfirst: true
11543
+ }
10924
11544
  ],
10925
11545
  episode_words: [
10926
11546
  "episode",
10927
11547
  "episodes",
11548
+ "épisode",
11549
+ "épisodes",
10928
11550
  "eps",
10929
11551
  "ep",
10930
11552
  "episodio",
10931
11553
  "episodios",
10932
11554
  "capitulo",
10933
- "capitulos"
11555
+ "capitulos",
11556
+ {
11557
+ value: "серия",
11558
+ numfirst: true
11559
+ },
11560
+ {
11561
+ value: "серии",
11562
+ numfirst: true
11563
+ },
11564
+ {
11565
+ value: "эпизод",
11566
+ numfirst: true
11567
+ },
11568
+ {
11569
+ value: "seria",
11570
+ numfirst: true
11571
+ },
11572
+ {
11573
+ value: "serii",
11574
+ numfirst: true
11575
+ },
11576
+ {
11577
+ value: "serija",
11578
+ numfirst: true
11579
+ },
11580
+ {
11581
+ value: "bölüm",
11582
+ numfirst: true
11583
+ },
11584
+ {
11585
+ value: "bolum",
11586
+ numfirst: true
11587
+ },
11588
+ "aflevering",
11589
+ "afl",
11590
+ "folge",
11591
+ "odcinek",
11592
+ "episodul",
11593
+ "avsnitt",
11594
+ {
11595
+ value: "rész",
11596
+ numfirst: true
11597
+ }
10934
11598
  ],
10935
11599
  of_words: [
10936
11600
  "of",
10937
- "sur"
11601
+ "sur",
11602
+ "de",
11603
+ "di",
11604
+ "von",
11605
+ "van",
11606
+ "din",
11607
+ "из"
10938
11608
  ],
10939
11609
  all_words: [
10940
11610
  "All"
10941
- ]
11611
+ ],
11612
+ ordinal_suffix: "(?:ª|º|°|a|o|-?(?:й|я|е|го|ая|ый|ое))?"
10942
11613
  },
10943
11614
  film: {
10944
11615
  film: {
@@ -11245,52 +11916,14 @@ const advanced_config = {
11245
11916
  },
11246
11917
  "Virtual Reality": {
11247
11918
  string: [
11248
- "VR"
11919
+ "VR",
11920
+ "EAC360"
11249
11921
  ],
11250
11922
  regex: [
11251
11923
  "VR180",
11252
- "VR360"
11253
- ],
11254
- tags: "has-neighbor"
11255
- },
11256
- "Opening Credits": {
11257
- string: [
11258
- "NCOP",
11259
- "OPED"
11260
- ],
11261
- regex: [
11262
- "NC-?OP",
11263
- "creditless-?opening"
11264
- ],
11265
- tags: "has-neighbor"
11266
- },
11267
- "Ending Credits": {
11268
- string: [
11269
- "NCED"
11270
- ],
11271
- regex: [
11272
- "NC-?ED",
11273
- "creditless-?ending"
11274
- ],
11275
- tags: "has-neighbor"
11276
- },
11277
- "Half SBS": {
11278
- string: [
11279
- "HSBS"
11280
- ],
11281
- regex: [
11282
- "Half-?SBS"
11283
- ],
11284
- tags: "has-neighbor"
11285
- },
11286
- "Half OU": {
11287
- string: [
11288
- "HOU",
11289
- "HTAB"
11290
- ],
11291
- regex: [
11292
- "Half-?OU",
11293
- "Half-?TAB"
11924
+ "VR360",
11925
+ "VR-180",
11926
+ "VR-360"
11294
11927
  ],
11295
11928
  tags: "has-neighbor"
11296
11929
  },
@@ -11480,7 +12113,7 @@ const advanced_config = {
11480
12113
  tags: "uhdbluray-neighbor"
11481
12114
  },
11482
12115
  "Dolby Vision": {
11483
- regex: "(?:Dolby-?Vision|DV)",
12116
+ regex: "(?:Dolby-?Vision|DoVi|DV)",
11484
12117
  tags: "uhdbluray-neighbor"
11485
12118
  },
11486
12119
  "BT.2020": {
@@ -11537,6 +12170,48 @@ const advanced_config = {
11537
12170
  complete_article_words: [
11538
12171
  "The"
11539
12172
  ]
12173
+ },
12174
+ "Side By Side": {
12175
+ string: [
12176
+ "SBS",
12177
+ "LR"
12178
+ ],
12179
+ tags: [
12180
+ "has-neighbor",
12181
+ "stereo-vr-context"
12182
+ ]
12183
+ },
12184
+ "Over Under": {
12185
+ string: [
12186
+ "TB",
12187
+ "OU"
12188
+ ],
12189
+ tags: [
12190
+ "has-neighbor",
12191
+ "stereo-vr-context"
12192
+ ]
12193
+ },
12194
+ "Half Side By Side": {
12195
+ string: [
12196
+ "HSBS"
12197
+ ],
12198
+ regex: [
12199
+ "h-?sbs",
12200
+ "half-?sbs"
12201
+ ],
12202
+ tags: "has-neighbor"
12203
+ },
12204
+ "Half Over Under": {
12205
+ string: [
12206
+ "HOU",
12207
+ "HTAB"
12208
+ ],
12209
+ regex: [
12210
+ "h-?ou",
12211
+ "half-?ou",
12212
+ "half-?tab"
12213
+ ],
12214
+ tags: "has-neighbor"
11540
12215
  }
11541
12216
  }
11542
12217
  },
@@ -11865,6 +12540,26 @@ const advanced_config = {
11865
12540
  date: {
11866
12541
  week_words: [
11867
12542
  "week"
12543
+ ],
12544
+ weekday_words: [
12545
+ "monday",
12546
+ "tuesday",
12547
+ "wednesday",
12548
+ "thursday",
12549
+ "friday",
12550
+ "saturday",
12551
+ "sunday",
12552
+ "mon",
12553
+ "tue",
12554
+ "tues",
12555
+ "wed",
12556
+ "weds",
12557
+ "thu",
12558
+ "thur",
12559
+ "thurs",
12560
+ "fri",
12561
+ "sat",
12562
+ "sun"
11868
12563
  ]
11869
12564
  }
11870
12565
  };
@@ -12341,7 +13036,6 @@ const GUESSIT_SCHEMA = {
12341
13036
  "Dual",
12342
13037
  "Dual Audio",
12343
13038
  "East Coast Feed",
12344
- "Ending Credits",
12345
13039
  "Extras",
12346
13040
  "Fan Subtitled",
12347
13041
  "Fanart",
@@ -12352,8 +13046,8 @@ const GUESSIT_SCHEMA = {
12352
13046
  "Fix",
12353
13047
  "Fixed",
12354
13048
  "Full HD",
12355
- "Half OU",
12356
- "Half SBS",
13049
+ "Half Over Under",
13050
+ "Half Side By Side",
12357
13051
  "Hardcoded Subtitles",
12358
13052
  "HC",
12359
13053
  "HD",
@@ -12388,7 +13082,6 @@ const GUESSIT_SCHEMA = {
12388
13082
  "Obfuscated",
12389
13083
  "Ona",
12390
13084
  "Open Matte",
12391
- "Opening Credits",
12392
13085
  "Original Animated Video",
12393
13086
  "Original Animation DVD",
12394
13087
  "Original Aspect Ratio",
@@ -12396,6 +13089,7 @@ const GUESSIT_SCHEMA = {
12396
13089
  "Original Video",
12397
13090
  "OV",
12398
13091
  "Ova",
13092
+ "Over Under",
12399
13093
  "PAL",
12400
13094
  "postbot",
12401
13095
  "Poster",
@@ -12420,6 +13114,7 @@ const GUESSIT_SCHEMA = {
12420
13114
  "Screener",
12421
13115
  "SDR",
12422
13116
  "SECAM",
13117
+ "Side By Side",
12423
13118
  "Standard Dynamic Range",
12424
13119
  "Straight to Video",
12425
13120
  "STV",
@@ -12525,6 +13220,7 @@ const GUESSIT_SCHEMA = {
12525
13220
  "HD Telesync",
12526
13221
  "HD-DVD",
12527
13222
  "HDTV",
13223
+ "Laserdisc",
12528
13224
  "Pay-per-view",
12529
13225
  "Satellite",
12530
13226
  "Telecine",