@torrent-tv/proxy 2.94.0 → 2.94.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torrent-tv/proxy",
3
- "version": "2.94.0",
3
+ "version": "2.94.1",
4
4
  "description": "Torrent proxy client that exposes webseed-like HTTP stream endpoint.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "repository": {
@@ -102,7 +102,7 @@ export class AviContainer extends Container {
102
102
  if (!(error instanceof OutsideReadableEdges)) throw error;
103
103
  tags.outsideEdges = true;
104
104
  }
105
- tags.trackTitles = textList((await this.readTracks()).map((track) => track.name));
105
+ tags.trackTitles = await this.trackTitlesForWork();
106
106
  if (!tags.outsideEdges) this.#workTags = tags;
107
107
  return tags;
108
108
  }
@@ -12,7 +12,8 @@
12
12
  * - AVI RIFF §: LIST hdrl, idx1
13
13
  */
14
14
 
15
- import { strictReader } from "./unavailable.js";
15
+ import { isUnavailable, strictReader } from "./unavailable.js";
16
+ import { textList } from "./work-tags.js";
16
17
 
17
18
  /**
18
19
  * What one file declares about itself. Every field is either a value the
@@ -514,6 +515,23 @@ export class Container {
514
515
  return null;
515
516
  }
516
517
 
518
+ /**
519
+ * The titles of the file's tracks, for what it states about its work. A
520
+ * track table this program refuses to read costs only the titles: the
521
+ * statements about the work are read from other elements. Bytes that have
522
+ * not arrived are still "not here yet".
523
+ *
524
+ * @returns {Promise<string[]>}
525
+ */
526
+ async trackTitlesForWork() {
527
+ try {
528
+ return textList((await this.readTracks()).map((track) => track.name));
529
+ } catch (error) {
530
+ if (isUnavailable(error)) throw error;
531
+ return [];
532
+ }
533
+ }
534
+
517
535
  /**
518
536
  * The cover image the file carries, checked to be an image by its bytes.
519
537
  * `null` where it carries none.
@@ -437,7 +437,7 @@ export class MatroskaContainer extends Container {
437
437
  const cover = await this.#coverAddress(reader, layout);
438
438
  if (cover && cover.size > 0 && cover.size <= MAX_COVER_BYTES) tags.cover = { type: cover.mediaType, size: cover.size };
439
439
  } catch (error) { leftOut(error); }
440
- tags.trackTitles = textList((await this.readTracks()).map((track) => track.name));
440
+ tags.trackTitles = await this.trackTitlesForWork();
441
441
  if (!tags.outsideEdges) this.#workTags = tags;
442
442
  return tags;
443
443
  }
@@ -28,7 +28,7 @@ import { hevcConfiguration } from "./hevc-configuration.js";
28
28
  import { mpegAudioFrame } from "./mpeg-audio-frame.js";
29
29
  import { readMp4Fragments } from "./mp4-fragments.js";
30
30
  import { workFromMoov } from "./mp4-work-tags.js";
31
- import { COVER_TYPES, MAX_COVER_BYTES, emptyWorkTags, imageTypeOf, textList } from "./work-tags.js";
31
+ import { COVER_TYPES, MAX_COVER_BYTES, emptyWorkTags, imageTypeOf } from "./work-tags.js";
32
32
 
33
33
  /** A box header is eight bytes, or sixteen when the size field says 1 (§4.2). */
34
34
  const HEADER_BYTES = 8;
@@ -532,7 +532,7 @@ export class Mp4Container extends Container {
532
532
  Object.assign(tags, work);
533
533
  if (cover && cover.size > 0 && cover.size <= MAX_COVER_BYTES) tags.cover = { type: cover.type, size: cover.size };
534
534
  }
535
- tags.trackTitles = textList((await this.readTracks()).map((track) => track.name));
535
+ tags.trackTitles = await this.trackTitlesForWork();
536
536
  this.workTags = tags;
537
537
  return tags;
538
538
  }