Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Wifsimster committed Aug 11, 2019
1 parent 39e7f17 commit 30ec22d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,3 +240,7 @@ Return an image.
- `height` `<number>`, default: `96`
- `minSize` `<number>`, default: `1`
- `upscale` `<number>`, default: `1`
- `opacity` `<number>`, ie: `30`
- `background` `<hexadecimal>`, ie: `36383b`
- `format` `<string>`, ie: `png`
- `blur` `<number>`, ie: `56`
13 changes: 11 additions & 2 deletions pavie.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,12 +369,21 @@ module.exports = class {
* url: /library/metadata/25963/thumb/1557058611?X-Plex-Token=fPHNF2Wkg84qDPprCbqy
*/
async getImage(url, options = {}) {
options = Object.assign({ width: 170, height: 96, minSize: 1, upscale: 1, url: url }, options)
options = Object.assign(
{
width: 170,
height: 96,
minSize: 1,
upscale: 1,
url: url
},
options
)

const response = await this.instance.get(`/photo/:/transcode?${querystring.stringify(options)}`)

if (response.status < 400) {
return response.data.MediaContainer
return response.data
}
}
}
15 changes: 15 additions & 0 deletions test/image.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const settings = require("../settings.json")

const Pavie = require("../pavie")

const pavie = new Pavie(settings)

pavie
.signin()
.then(async () => {
const response = await pavie.getImage(`/library/metadata/25963/thumb/1557058611?X-Plex-Token=fPHNF2Wkg84qDPprCbqy`)
console.log(response)
})
.catch(err => {
console.error(err)
})

0 comments on commit 30ec22d

Please sign in to comment.