From dd37fe84939f6b68e53b6354be483778612ae92b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Mon, 7 Jun 2021 00:28:28 +0200 Subject: [PATCH] Update: Search now searches parent and grandparent titles too --- dist/plex-meets-homeassistant.js | 8 ++++++-- src/plex-meets-homeassistant.ts | 12 ++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index ac2f3bb..16699ae 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -19958,7 +19958,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { let found = false; // eslint-disable-next-line consistent-return lodash.forEach(searchValues, value => { - if (!lodash.isEmpty(value) && lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(value))) { + if ((!lodash.isEmpty(value) && lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(value))) || + lodash.includes(lodash.toUpper(movieData.parentTitle), lodash.toUpper(value)) || + lodash.includes(lodash.toUpper(movieData.grandparentTitle), lodash.toUpper(value))) { found = true; return false; } @@ -19967,7 +19969,9 @@ class PlexMeetsHomeAssistant extends HTMLElement { shouldRender = true; } } - else if (lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(this.searchValue))) { + else if (lodash.includes(lodash.toUpper(movieData.title), lodash.toUpper(this.searchValue)) || + lodash.includes(lodash.toUpper(movieData.parentTitle), lodash.toUpper(this.searchValue)) || + lodash.includes(lodash.toUpper(movieData.grandparentTitle), lodash.toUpper(this.searchValue))) { shouldRender = true; } if (shouldRender) { diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 6a656a9..be51e93 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -253,7 +253,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { let found = false; // eslint-disable-next-line consistent-return _.forEach(searchValues, value => { - if (!_.isEmpty(value) && _.includes(_.toUpper(movieData.title), _.toUpper(value))) { + if ( + (!_.isEmpty(value) && _.includes(_.toUpper(movieData.title), _.toUpper(value))) || + _.includes(_.toUpper(movieData.parentTitle), _.toUpper(value)) || + _.includes(_.toUpper(movieData.grandparentTitle), _.toUpper(value)) + ) { found = true; return false; } @@ -261,7 +265,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (found || _.isEmpty(searchValues[0])) { shouldRender = true; } - } else if (_.includes(_.toUpper(movieData.title), _.toUpper(this.searchValue))) { + } else if ( + _.includes(_.toUpper(movieData.title), _.toUpper(this.searchValue)) || + _.includes(_.toUpper(movieData.parentTitle), _.toUpper(this.searchValue)) || + _.includes(_.toUpper(movieData.grandparentTitle), _.toUpper(this.searchValue)) + ) { shouldRender = true; } if (shouldRender) {