Feat: Cookie authentication #130
@@ -127,15 +127,12 @@ class Plex {
|
|||||||
findPlexItemByTitleAndYear(title, year) {
|
findPlexItemByTitleAndYear(title, year) {
|
||||||
const query = { title, year };
|
const query = { title, year };
|
||||||
|
|
||||||
return this.search(query.title).then(plexSearchResults => {
|
return this.search(title).then(plexResults => {
|
||||||
const matchesInPlex = plexSearchResults.map(plex =>
|
const matchesInPlex = plexResults.map(plex =>
|
||||||
this.matchTmdbAndPlexMedia(plex, query)
|
this.matchTmdbAndPlexMedia(plex, query)
|
||||||
);
|
);
|
||||||
|
const matchesIndex = matchesInPlex.findIndex(el => el === true);
|
||||||
if (matchesInPlex.includes(true) === false) return false;
|
return matchesInPlex != -1 ? plexResults[matchesIndex] : null;
|
||||||
|
|
||||||
const firstMatchIndex = matchesInPlex.indexOf(true);
|
|
||||||
return plexSearchResults[firstMatchIndex][0];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user