Plex params are now parsed with URI encoder.
This commit is contained in:
@@ -15,9 +15,11 @@ class PlexRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
search(query) {
|
search(query) {
|
||||||
console.log('searching:', query)
|
console.log(`Searching plex with query ${query}`)
|
||||||
|
let uri_query = encodeURIComponent(query)
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
uri: `http://10.0.0.44:32400/search?query=${query}`,
|
uri: `http://10.0.0.44:32400/search?query=${uri_query}`,
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
},
|
},
|
||||||
@@ -26,6 +28,7 @@ class PlexRepository {
|
|||||||
|
|
||||||
return rp(options)
|
return rp(options)
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
throw new Error('Unable to search plex.')
|
throw new Error('Unable to search plex.')
|
||||||
})
|
})
|
||||||
.then(result => this.mapResults(result))
|
.then(result => this.mapResults(result))
|
||||||
@@ -52,7 +55,6 @@ class PlexRepository {
|
|||||||
mapResults(response) {
|
mapResults(response) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log('plexResponse:', response)
|
|
||||||
if (!response.MediaContainer.hasOwnProperty('Metadata')) return [[], 0];
|
if (!response.MediaContainer.hasOwnProperty('Metadata')) return [[], 0];
|
||||||
|
|
||||||
const mappedResults = response.MediaContainer.Metadata.filter((element) => {
|
const mappedResults = response.MediaContainer.Metadata.filter((element) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user