diff --git a/README.md b/README.md index 0643b6d..01f3b1f 100644 --- a/README.md +++ b/README.md @@ -240,3 +240,7 @@ Return an image. - `height` ``, default: `96` - `minSize` ``, default: `1` - `upscale` ``, default: `1` + - `opacity` ``, ie: `30` + - `background` ``, ie: `36383b` + - `format` ``, ie: `png` + - `blur` ``, ie: `56` diff --git a/pavie.js b/pavie.js index 04bee9a..2282f43 100644 --- a/pavie.js +++ b/pavie.js @@ -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 } } } diff --git a/test/image.js b/test/image.js new file mode 100644 index 0000000..efd0a0b --- /dev/null +++ b/test/image.js @@ -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) + })