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