@jjdenhertog/plex-music-search 1.0.5 → 1.0.7

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/index.js CHANGED
@@ -303,20 +303,21 @@ var PlexMusicSearch = /** @class */ (function () {
303
303
  };
304
304
  PlexMusicSearch.prototype._findTrack = function (approaches, find, includeMatching) {
305
305
  return __awaiter(this, void 0, void 0, function () {
306
- var searchResult, id, artist, title, _a, album, musicSearch, performSearch, searchApproachIndex, approach, trim, filtered, removeQuotes, searchArtist, searchAlbum, searchTrack, altSearchArtist, altSearchTrack, _e_3;
306
+ var searchResult, id, artist, title, _a, album, queries, musicSearch, performSearch, searchApproachIndex, approach, approachId, trim, filtered, removeQuotes, searchArtist, searchAlbum, searchTrack, altSearchArtist, altSearchTrack, _e_3;
307
307
  var _this = this;
308
308
  return __generator(this, function (_b) {
309
309
  switch (_b.label) {
310
310
  case 0:
311
311
  searchResult = [];
312
312
  id = find.id, artist = find.artist, title = find.title, _a = find.album, album = _a === void 0 ? '' : _a;
313
+ queries = [];
313
314
  musicSearch = music_search_1.default.getInstance();
314
- performSearch = function (artist_1, title_1, album_2) {
315
+ performSearch = function (approach_1, artist_1, title_1, album_2) {
315
316
  var args_1 = [];
316
- for (var _i = 3; _i < arguments.length; _i++) {
317
- args_1[_i - 3] = arguments[_i];
317
+ for (var _i = 4; _i < arguments.length; _i++) {
318
+ args_1[_i - 4] = arguments[_i];
318
319
  }
319
- return __awaiter(_this, __spreadArray([artist_1, title_1, album_2], args_1, true), void 0, function (artist, title, album, searchAlbumTracks) {
320
+ return __awaiter(_this, __spreadArray([approach_1, artist_1, title_1, album_2], args_1, true), void 0, function (approach, artist, title, album, searchAlbumTracks) {
320
321
  var cacheId, foundCache, searchHandler, searchResults, musicSearchResult, plexTracks;
321
322
  if (searchAlbumTracks === void 0) { searchAlbumTracks = false; }
322
323
  return __generator(this, function (_a) {
@@ -341,6 +342,7 @@ var PlexMusicSearch = /** @class */ (function () {
341
342
  .filter(function (item) { return !!item; })
342
343
  .map(function (item) { return (__assign(__assign({}, (0, hubSearchToPlexTrack_1.default)(item)), { matching: item.matching, reason: item.reason })); });
343
344
  this._cache.push({ id: cacheId, result: plexTracks });
345
+ queries.push({ approach: approach, artist: artist, title: title, album: album });
344
346
  return [2 /*return*/, plexTracks];
345
347
  }
346
348
  });
@@ -358,11 +360,11 @@ var PlexMusicSearch = /** @class */ (function () {
358
360
  searchApproachIndex++;
359
361
  return [3 /*break*/, 2];
360
362
  }
361
- trim = approach.trim, filtered = approach.filtered, removeQuotes = approach.ignoreQuotes;
363
+ approachId = approach.id, trim = approach.trim, filtered = approach.filtered, removeQuotes = approach.ignoreQuotes;
362
364
  searchArtist = (0, music_search_1.filterOutWords)(artist.toLowerCase(), filtered, trim, removeQuotes);
363
365
  searchAlbum = (0, music_search_1.filterOutWords)(album.toLowerCase(), filtered, trim, removeQuotes);
364
366
  searchTrack = (0, music_search_1.filterOutWords)(title.toLowerCase(), filtered, trim, removeQuotes);
365
- return [4 /*yield*/, performSearch(searchArtist, searchTrack, searchAlbum)
367
+ return [4 /*yield*/, performSearch(approachId, searchArtist, searchTrack, searchAlbum)
366
368
  ////////////////////////////////////////
367
369
  // Rewrite "&"" to "and"
368
370
  ////////////////////////////////////////
@@ -373,13 +375,13 @@ var PlexMusicSearch = /** @class */ (function () {
373
375
  if (!(searchResult.length == 0 && (searchArtist.indexOf("&") || searchTrack.indexOf("&") > -1))) return [3 /*break*/, 5];
374
376
  altSearchArtist = searchArtist.split('&').join('and');
375
377
  altSearchTrack = searchTrack.split('&').join('and');
376
- return [4 /*yield*/, performSearch(altSearchArtist, altSearchTrack, searchAlbum)];
378
+ return [4 /*yield*/, performSearch(approachId, altSearchArtist, altSearchTrack, searchAlbum)];
377
379
  case 4:
378
380
  searchResult = _b.sent();
379
381
  _b.label = 5;
380
382
  case 5:
381
383
  if (!(searchResult.length == 0)) return [3 /*break*/, 7];
382
- return [4 /*yield*/, performSearch(searchArtist, searchTrack, searchAlbum, true)];
384
+ return [4 /*yield*/, performSearch(approachId, searchArtist, searchTrack, searchAlbum, true)];
383
385
  case 6:
384
386
  searchResult = _b.sent();
385
387
  _b.label = 7;
@@ -391,6 +393,7 @@ var PlexMusicSearch = /** @class */ (function () {
391
393
  artist: artist,
392
394
  album: album,
393
395
  title: title,
396
+ queries: queries,
394
397
  result: searchResult
395
398
  }];
396
399
  case 9:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjdenhertog/plex-music-search",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Library to find tracks in your Plex Library",
5
5
  "keywords": [
6
6
  "plex",
@@ -4,5 +4,12 @@ export type SearchResponse = {
4
4
  artist: string;
5
5
  title: string;
6
6
  album: string;
7
+ queries?: SearchQuery[];
7
8
  result: PlexTrack[];
8
9
  };
10
+ export type SearchQuery = {
11
+ approach: string;
12
+ artist: string;
13
+ title: string;
14
+ album: string;
15
+ };