@apocaliss92/series-scraper-core 0.0.100 → 0.0.101

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.
@@ -912,10 +912,13 @@ let DownloadService = DownloadService_1 = class DownloadService {
912
912
  const childId = childTrackerId(owner.id, epLabel);
913
913
  const tag = this.epTag(entry.title, epLabel);
914
914
  if (!episode) {
915
- const notFoundMsg = siteEpNumber !== epNumber
915
+ const listed = episodes.map((e) => e.number);
916
+ const baseMsg = siteEpNumber !== epNumber
916
917
  ? `Episode ${epNumber} not found on source (looked for site ep ${siteEpNumber})`
917
918
  : `Episode ${epNumber} not found on source`;
918
- const reason = (0, failure_reason_1.missingEpisodeReason)(episodes.map((e) => e.number), siteEpNumber);
919
+ const hint = (0, failure_reason_1.numberingHint)(listed, siteEpNumber);
920
+ const notFoundMsg = hint === null ? baseMsg : `${baseMsg}; ${hint}`;
921
+ const reason = (0, failure_reason_1.missingEpisodeReason)(listed, siteEpNumber);
919
922
  if (reason === 'not_available') {
920
923
  this.noteNotAvailable(entry, missingEp.seasonNumber, epNumber, epLabel, notFoundMsg, tag, undefined, false);
921
924
  return {
@@ -2983,7 +2986,10 @@ let DownloadService = DownloadService_1 = class DownloadService {
2983
2986
  const episodes = await adapter.fetchEpisodes(seasonBinding.url);
2984
2987
  const ep = episodes.find((e) => e.number === siteEp);
2985
2988
  if (!ep) {
2986
- this.recordEpisodeFailure(entry, season, episode, epLabel, 'Episode not found on source', (0, failure_reason_1.missingEpisodeReason)(episodes.map((e) => e.number), siteEp));
2989
+ const listed = episodes.map((e) => e.number);
2990
+ const hint = (0, failure_reason_1.numberingHint)(listed, siteEp);
2991
+ const msg = hint === null ? 'Episode not found on source' : `Episode not found on source; ${hint}`;
2992
+ this.recordEpisodeFailure(entry, season, episode, epLabel, msg, (0, failure_reason_1.missingEpisodeReason)(listed, siteEp));
2987
2993
  this.tracker.finish(entry.id);
2988
2994
  return;
2989
2995
  }
@@ -29,3 +29,9 @@ export declare function isUnavailableCoolingDown(record: {
29
29
  * source/scrape problem, not a release that has not happened.
30
30
  */
31
31
  export declare function missingEpisodeReason(listedNumbers: readonly number[], siteEpisode: number): FailureReason;
32
+ /**
33
+ * Why an episode below the source's whole list is missing: the source most likely numbers
34
+ * episodes continuously across seasons (S02E01 listed as 25). Null when the gap says nothing
35
+ * about numbering.
36
+ */
37
+ export declare function numberingHint(listedNumbers: readonly number[], siteEpisode: number): string | null;
@@ -6,6 +6,7 @@ exports.classifyLinkFailures = classifyLinkFailures;
6
6
  exports.effectiveReason = effectiveReason;
7
7
  exports.isUnavailableCoolingDown = isUnavailableCoolingDown;
8
8
  exports.missingEpisodeReason = missingEpisodeReason;
9
+ exports.numberingHint = numberingHint;
9
10
  const egress_router_1 = require("./egress/egress-router");
10
11
  const uprot_captcha_1 = require("./uprot-captcha");
11
12
  /** A not-available item is not re-queried on every scan; it is re-checked after this. */
@@ -59,3 +60,16 @@ function missingEpisodeReason(listedNumbers, siteEpisode) {
59
60
  return 'fetch_failed';
60
61
  return siteEpisode > Math.max(...listedNumbers) ? 'not_available' : 'fetch_failed';
61
62
  }
63
+ /**
64
+ * Why an episode below the source's whole list is missing: the source most likely numbers
65
+ * episodes continuously across seasons (S02E01 listed as 25). Null when the gap says nothing
66
+ * about numbering.
67
+ */
68
+ function numberingHint(listedNumbers, siteEpisode) {
69
+ if (listedNumbers.length === 0)
70
+ return null;
71
+ const first = Math.min(...listedNumbers);
72
+ if (siteEpisode >= first)
73
+ return null;
74
+ return `the source starts at episode ${first}: it may number episodes across seasons — use absolute numbering on the binding or a season offset`;
75
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apocaliss92/series-scraper-core",
3
- "version": "0.0.100",
3
+ "version": "0.0.101",
4
4
  "description": "Host-agnostic scraper core: services, repositories, controllers and the ports a host supplies",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",