alphatheta-connect 0.26.0 → 0.26.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/lib/cli.js CHANGED
@@ -1467,7 +1467,9 @@ async function viaLocal(local, opts) {
1467
1467
  if (!orm) {
1468
1468
  break;
1469
1469
  }
1470
- yield orm.findTrack(entry.id);
1470
+ // Playlist entries reference the track through trackId; entry.id is the
1471
+ // entry's own row id (or its index, for OneLibrary), not a track.
1472
+ yield orm.findTrack(entry.trackId);
1471
1473
  }
1472
1474
  };
1473
1475
  const tracks = { [Symbol.asyncIterator]: iterateTracks };
@@ -3285,7 +3287,9 @@ var RekordboxAnlz = (function() {
3285
3287
  this.time = this._io.readU4be();
3286
3288
  this.loopTime = this._io.readU4be();
3287
3289
  this.colorId = this._io.readU1();
3288
- this._unnamed9 = this._io.readBytes(11);
3290
+ this._unnamed9 = this._io.readBytes(7);
3291
+ this.loopNumerator = this._io.readU2be();
3292
+ this.loopDenominator = this._io.readU2be();
3289
3293
  if (this.lenEntry > 43) {
3290
3294
  this.lenComment = this._io.readU4be();
3291
3295
  }
@@ -3305,7 +3309,7 @@ var RekordboxAnlz = (function() {
3305
3309
  this.colorBlue = this._io.readU1();
3306
3310
  }
3307
3311
  if ((this.lenEntry - this.lenComment) > 48) {
3308
- this._unnamed16 = this._io.readBytes(((this.lenEntry - 48) - this.lenComment));
3312
+ this._unnamed18 = this._io.readBytes(((this.lenEntry - 48) - this.lenComment));
3309
3313
  }
3310
3314
  }
3311
3315
 
@@ -3337,6 +3341,16 @@ var RekordboxAnlz = (function() {
3337
3341
  * and has been assigned a color.
3338
3342
  */
3339
3343
 
3344
+ /**
3345
+ * The numerator of the loop size fraction for a quantized loop,
3346
+ * e.g. 4 for a 4-beat loop. Zero when the loop is not quantized.
3347
+ */
3348
+
3349
+ /**
3350
+ * The denominator of the loop size fraction for a quantized loop,
3351
+ * e.g. 1 for a 4-beat loop.
3352
+ */
3353
+
3340
3354
  /**
3341
3355
  * The comment assigned to this cue by the DJ, if any, with a trailing NUL.
3342
3356
  */
@@ -5767,16 +5781,20 @@ function makeBeatGrid(data) {
5767
5781
  * Fill cue and loop data from the ANLZ section
5768
5782
  */
5769
5783
  function makeCueAndLoop(data) {
5770
- return data.body.cues.map((entry) => {
5784
+ return data.body.cues
5785
+ .map((entry) => {
5771
5786
  // Cues with the status 0 are likely leftovers that were removed
5772
- const button = entry.hotCue === 0 ? false : entry.type;
5787
+ // `hotCue` is the button number (1-8, A-H); zero marks a memory cue.
5788
+ // `type` only says whether the entry is a cue point (1) or a loop (2).
5789
+ const button = entry.hotCue === 0 ? false : entry.hotCue;
5773
5790
  const isCue = entry.type === 0x01;
5774
5791
  const isLoop = entry.type === 0x02;
5775
5792
  // NOTE: Unlike the remotedb, these entries are already in milliseconds.
5776
5793
  const offset = entry.time;
5777
5794
  const length = entry.loopTime - offset;
5778
5795
  return (0, utils_1.makeCueLoopEntry)(isCue, isLoop, offset, length, button);
5779
- });
5796
+ })
5797
+ .filter((c) => c !== null);
5780
5798
  }
5781
5799
  /**
5782
5800
  * Fill waveform HD data from the ANLZ section
@@ -5812,9 +5830,13 @@ function makeExtendedCues(data) {
5812
5830
  b: (_c = entry.colorBlue) !== null && _c !== void 0 ? _c : 0,
5813
5831
  };
5814
5832
  }
5815
- // Add comment if present
5833
+ // Add comment if present. The tag stores it with a trailing NUL, which
5834
+ // is not part of what the DJ typed.
5816
5835
  if (entry.lenComment > 0 && entry.comment) {
5817
- cue.comment = entry.comment;
5836
+ const comment = entry.comment.replace(/\0+$/, '');
5837
+ if (comment.length > 0) {
5838
+ cue.comment = comment;
5839
+ }
5818
5840
  }
5819
5841
  // Add quantized loop information if present
5820
5842
  if (entry.loopNumerator !== undefined && entry.loopNumerator > 0) {
@@ -5880,19 +5902,24 @@ function makeSongStructure(data) {
5880
5902
  },
5881
5903
  };
5882
5904
  const mood = (_a = moodMap[data.body.mood]) !== null && _a !== void 0 ? _a : 'high';
5883
- const bank = (_b = bankMap[data.body.rawBank]) !== null && _b !== void 0 ? _b : 'default';
5905
+ const bank = (_b = bankMap[data.body.bank]) !== null && _b !== void 0 ? _b : 'default';
5906
+ // Field names follow the Kaitai-generated object (rekordbox_anlz.ksy
5907
+ // `song_structure_entry`): `phraseNumber`, `beatNumber`, `fillIn`,
5908
+ // `fillInBeatNumber`, and `kind` is a `phrase_high` / `phrase_mid` /
5909
+ // `phrase_low` object whose `id` carries the raw kind value.
5884
5910
  const phrases = data.body.entries.map((entry) => {
5885
5911
  var _a;
5912
+ const kind = typeof entry.kind === 'object' ? entry.kind.id : entry.kind;
5886
5913
  const phrase = {
5887
- index: entry.index,
5888
- beat: entry.beat,
5889
- kind: entry.kind,
5890
- phraseType: (_a = phraseTypeMap[mood][entry.kind]) !== null && _a !== void 0 ? _a : 'Unknown',
5914
+ index: entry.phraseNumber,
5915
+ beat: entry.beatNumber,
5916
+ kind,
5917
+ phraseType: (_a = phraseTypeMap[mood][kind]) !== null && _a !== void 0 ? _a : 'Unknown',
5891
5918
  };
5892
5919
  // Add fill-in information if present
5893
- if (entry.fill > 0) {
5894
- phrase.fill = entry.fill;
5895
- phrase.fillBeat = entry.beatFill;
5920
+ if (entry.fillIn > 0) {
5921
+ phrase.fill = entry.fillIn;
5922
+ phrase.fillBeat = entry.fillInBeatNumber;
5896
5923
  }
5897
5924
  return phrase;
5898
5925
  });