guessit-js 4.4.1 → 4.4.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.
@@ -3519,7 +3519,7 @@ function episodes(config) {
3519
3519
  chainBreaker: (matches) => episodesSeasonChainBreaker(matches, config),
3520
3520
  disabled: isSeasonEpisodeDisabled
3521
3521
  }).defaults({ tags: ["SxxExx"] }).regex(
3522
- seasonMarkerPattern + `(?<season>\\d+)@?` + episodeMarkerPattern + `@?(?<episode>\\d+)`
3522
+ seasonMarkerPattern + `(?<season>\\d+)@?` + episodeMarkerPattern + `@?(?<episode>\\d+)(?:[a-d](?![a-z0-9]))?`
3523
3523
  ).repeater("+").regex(
3524
3524
  allSeparatorsPattern + `@?(?<episode>\\d+)`
3525
3525
  ).repeater("*");
@@ -3561,6 +3561,10 @@ function episodes(config) {
3561
3561
  `(?<season>\\d{1,2})(?:st|nd|rd|th)@?(?:season)(?![^\\W_])`,
3562
3562
  { tags: ["SxxExx", "numfirst"], disabled: isSeasonEpisodeDisabled }
3563
3563
  );
3564
+ rebulk.regex(
3565
+ `(?<!\\d)(?<season>\\d{1,2})(?<episodeMarker>x)(?<episode>\\d{2})(?!\\d)`,
3566
+ { tags: ["SxxExx"], disabled: isSeasonEpisodeDisabled }
3567
+ );
3564
3568
  const seasonOnlySepPattern = buildOrPattern(
3565
3569
  [...config.season_markers, ...discreteSeparators, ...config.range_separators],
3566
3570
  "seasonSeparator",
@@ -3603,7 +3607,8 @@ function episodes(config) {
3603
3607
  validator: { season: seasonWordNotYear, season_count: validateRoman },
3604
3608
  conflictSolver: seasonEpisodeConflictSolver
3605
3609
  }).regex(seasonWordPattern + `@?(?P<season>${numeralWithWords})`).regex(ofWordPattern + `@?(?P<season_count>${numeral})`).repeater("?").regex(
3606
- `@?` + buildOrPattern(
3610
+ // an optional comma before the separator covers list forms like ", & 6"
3611
+ `(?:,@?)?@?` + buildOrPattern(
3607
3612
  [...config.range_separators, ...discreteSeparators, "@"],
3608
3613
  "seasonSeparator",
3609
3614
  true
@@ -3631,6 +3636,24 @@ function episodes(config) {
3631
3636
  );
3632
3637
  }
3633
3638
  const episodeWordPattern = buildOrPattern(episodeWords, "episodeMarker");
3639
+ rebulk.regex(
3640
+ buildOrPattern(episodeWords, "episodeMarker") + `@?(?<season>\\d{1,2})\\.(?<episode>\\d{2,3})(?!\\d)`,
3641
+ { tags: ["SxxExx"], disabled: isSeasonEpisodeDisabled }
3642
+ );
3643
+ rebulk.regex(
3644
+ `(?<=[\\s([_-][\\s._-]?)(?<season>\\d{1,2})\\.(?<episode>\\d{2,3})(?=[\\s)\\]._-]|$)(?!\\.\\d)`,
3645
+ {
3646
+ tags: ["SxxExx", "decimal-episode"],
3647
+ validator: {
3648
+ __parent__: (m) => {
3649
+ const inp = m.inputString ?? "";
3650
+ const before = inp.slice(Math.max(0, m.start - 3), m.start);
3651
+ return /[-([]\s?$|^\s*$|\s-\s$/.test(before) || /[([]/.test(before);
3652
+ }
3653
+ },
3654
+ disabled: isSeasonEpisodeDisabled
3655
+ }
3656
+ );
3634
3657
  rebulk.regex(
3635
3658
  `(?<![a-zA-Z\\d])` + episodeWordPattern + `@?(?<episode>\\d+)(?:v(?<version>\\d+))?(?:@?` + ofWordPattern + `@?(?<count>\\d+))?`,
3636
3659
  {
@@ -4169,7 +4192,8 @@ class RangeExpansionRule extends Rule {
4169
4192
  const betweenClean = between.replace(/[\s.]/g, "").toLowerCase();
4170
4193
  const betweenStripMarkers = betweenClean.replace(/[sexp]/gi, "");
4171
4194
  const hasRangeChar = /[-~_]/.test(between);
4172
- const isRange = hasRangeChar || rangeSeps.has(betweenClean) || rangeSeps.has(betweenStripMarkers);
4195
+ const seasonColon = name === "season" && betweenClean === ":";
4196
+ const isRange = hasRangeChar || seasonColon || rangeSeps.has(betweenClean) || rangeSeps.has(betweenStripMarkers);
4173
4197
  if (isRange) {
4174
4198
  for (let v = curVal + 1; v < nextVal; v++) {
4175
4199
  const m = new Match(current.start, next.end, {
@@ -11939,7 +11963,8 @@ const advanced_config = {
11939
11963
  episode_max_range: 100,
11940
11964
  max_range_gap: 1,
11941
11965
  season_markers: [
11942
- "s"
11966
+ "s",
11967
+ "sn"
11943
11968
  ],
11944
11969
  season_ep_markers: [
11945
11970
  "x",