alphatheta-connect 0.28.4 → 0.28.5

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/index.js CHANGED
@@ -12325,6 +12325,10 @@ var ItemType;
12325
12325
  ItemType[ItemType["MenuBit"] = 147] = "MenuBit";
12326
12326
  ItemType[ItemType["MenuFilename"] = 148] = "MenuFilename";
12327
12327
  ItemType[ItemType["MenuHistory"] = 149] = "MenuHistory";
12328
+ // Native streaming players return the track title and artist together in
12329
+ // this otherwise undocumented item instead of the normal 0x0004/0x0007
12330
+ // pair. Observed from direct Beatport streaming (NP3-591).
12331
+ ItemType[ItemType["StreamingTrackMetadata"] = 153] = "StreamingTrackMetadata";
12328
12332
  ItemType[ItemType["MenuAll"] = 160] = "MenuAll";
12329
12333
  ItemType[ItemType["TrackTitleAlbum"] = 516] = "TrackTitleAlbum";
12330
12334
  ItemType[ItemType["TrackTitleGenre"] = 1540] = "TrackTitleGenre";
@@ -12371,6 +12375,10 @@ const transformItem = {
12371
12375
  title: a.label1,
12372
12376
  artworkId: a.artworkId,
12373
12377
  }),
12378
+ [ItemType.StreamingTrackMetadata]: (a) => ({
12379
+ title: a.label1,
12380
+ artist: a.label2,
12381
+ }),
12374
12382
  [ItemType.AlbumTitle]: mapIdName,
12375
12383
  [ItemType.Artist]: mapIdName,
12376
12384
  [ItemType.Genre]: mapIdName,
@@ -12769,7 +12777,7 @@ const utils_1 = __webpack_require__(/*! ./utils */ "./src/remotedb/utils.ts");
12769
12777
  * Lookup track metadata from rekordbox and coerce it into a Track entity
12770
12778
  */
12771
12779
  async function getMetadata(opts) {
12772
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
12780
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
12773
12781
  const { conn, lookupDescriptor, span, args } = opts;
12774
12782
  const { trackId, onResponse } = args;
12775
12783
  const request = new message_1.Message({
@@ -12790,24 +12798,25 @@ async function getMetadata(opts) {
12790
12798
  onResponse === null || onResponse === void 0 ? void 0 : onResponse({ itemsAvailable: resp.data.itemsAvailable, items: received });
12791
12799
  // Translate our trackItems into a (partial) Track entity.
12792
12800
  // Use optional chaining for all fields since streaming tracks may omit some.
12801
+ const streamingMetadata = trackItems[item_1.ItemType.StreamingTrackMetadata];
12793
12802
  const track = {
12794
12803
  id: (_b = (_a = trackItems[item_1.ItemType.TrackTitle]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 0,
12795
- title: (_d = (_c = trackItems[item_1.ItemType.TrackTitle]) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : '',
12796
- duration: (_f = (_e = trackItems[item_1.ItemType.Duration]) === null || _e === void 0 ? void 0 : _e.duration) !== null && _f !== void 0 ? _f : 0,
12797
- tempo: (_h = (_g = trackItems[item_1.ItemType.Tempo]) === null || _g === void 0 ? void 0 : _g.bpm) !== null && _h !== void 0 ? _h : 0,
12798
- comment: (_k = (_j = trackItems[item_1.ItemType.Comment]) === null || _j === void 0 ? void 0 : _j.comment) !== null && _k !== void 0 ? _k : '',
12799
- rating: (_m = (_l = trackItems[item_1.ItemType.Rating]) === null || _l === void 0 ? void 0 : _l.rating) !== null && _m !== void 0 ? _m : 0,
12800
- year: (_o = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.Year]) === null || _o === void 0 ? void 0 : _o.year,
12801
- bitrate: (_p = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.BitRate]) === null || _p === void 0 ? void 0 : _p.bitrate,
12802
- artwork: { id: (_r = (_q = trackItems[item_1.ItemType.TrackTitle]) === null || _q === void 0 ? void 0 : _q.artworkId) !== null && _r !== void 0 ? _r : 0 },
12803
- album: (_s = trackItems[item_1.ItemType.AlbumTitle]) !== null && _s !== void 0 ? _s : null,
12804
- artist: (_t = trackItems[item_1.ItemType.Artist]) !== null && _t !== void 0 ? _t : null,
12805
- genre: (_u = trackItems[item_1.ItemType.Genre]) !== null && _u !== void 0 ? _u : null,
12806
- key: (_v = trackItems[item_1.ItemType.Key]) !== null && _v !== void 0 ? _v : null,
12807
- color: (_w = (0, utils_1.findColor)(Object.values(trackItems))) !== null && _w !== void 0 ? _w : null,
12808
- label: (_x = trackItems[item_1.ItemType.Label]) !== null && _x !== void 0 ? _x : null,
12809
- remixer: (_y = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.Remixer]) !== null && _y !== void 0 ? _y : null,
12810
- originalArtist: (_z = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.OriginalArtist]) !== null && _z !== void 0 ? _z : null,
12804
+ title: (_e = (_d = (_c = trackItems[item_1.ItemType.TrackTitle]) === null || _c === void 0 ? void 0 : _c.title) !== null && _d !== void 0 ? _d : streamingMetadata === null || streamingMetadata === void 0 ? void 0 : streamingMetadata.title) !== null && _e !== void 0 ? _e : '',
12805
+ duration: (_g = (_f = trackItems[item_1.ItemType.Duration]) === null || _f === void 0 ? void 0 : _f.duration) !== null && _g !== void 0 ? _g : 0,
12806
+ tempo: (_j = (_h = trackItems[item_1.ItemType.Tempo]) === null || _h === void 0 ? void 0 : _h.bpm) !== null && _j !== void 0 ? _j : 0,
12807
+ comment: (_l = (_k = trackItems[item_1.ItemType.Comment]) === null || _k === void 0 ? void 0 : _k.comment) !== null && _l !== void 0 ? _l : '',
12808
+ rating: (_o = (_m = trackItems[item_1.ItemType.Rating]) === null || _m === void 0 ? void 0 : _m.rating) !== null && _o !== void 0 ? _o : 0,
12809
+ year: (_p = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.Year]) === null || _p === void 0 ? void 0 : _p.year,
12810
+ bitrate: (_q = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.BitRate]) === null || _q === void 0 ? void 0 : _q.bitrate,
12811
+ artwork: { id: (_s = (_r = trackItems[item_1.ItemType.TrackTitle]) === null || _r === void 0 ? void 0 : _r.artworkId) !== null && _s !== void 0 ? _s : 0 },
12812
+ album: (_t = trackItems[item_1.ItemType.AlbumTitle]) !== null && _t !== void 0 ? _t : null,
12813
+ artist: (_u = trackItems[item_1.ItemType.Artist]) !== null && _u !== void 0 ? _u : ((streamingMetadata === null || streamingMetadata === void 0 ? void 0 : streamingMetadata.artist) ? { id: 0, name: streamingMetadata.artist } : null),
12814
+ genre: (_v = trackItems[item_1.ItemType.Genre]) !== null && _v !== void 0 ? _v : null,
12815
+ key: (_w = trackItems[item_1.ItemType.Key]) !== null && _w !== void 0 ? _w : null,
12816
+ color: (_x = (0, utils_1.findColor)(Object.values(trackItems))) !== null && _x !== void 0 ? _x : null,
12817
+ label: (_y = trackItems[item_1.ItemType.Label]) !== null && _y !== void 0 ? _y : null,
12818
+ remixer: (_z = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.Remixer]) !== null && _z !== void 0 ? _z : null,
12819
+ originalArtist: (_0 = trackItems === null || trackItems === void 0 ? void 0 : trackItems[item_1.ItemType.OriginalArtist]) !== null && _0 !== void 0 ? _0 : null,
12811
12820
  composer: null,
12812
12821
  fileName: '',
12813
12822
  filePath: '',