kolbyjack / MMM-Wallpaper

MagicMirror module to display wallpapers from various online sources
https://magicmirror.builders/
MIT License
99 stars 31 forks source link

Fixing MetMuseum images #89

Closed Nikro closed 1 year ago

Nikro commented 1 year ago

Thing fixed:

  1. Looping through all departments to make sure we query those - note, API doesn't accept multi-value ids.
  2. Either we're missing a dependency, but metmuseums uses request - which doesn't exist, instead I switched to https.request.
  3. Return the images.

For now, it takes some time to process these, as it's many request (in my case with 30 images, it's roughly 30s or so) - but images do actually load now ^_^

kolbyjack commented 1 year ago

I fixed this using fetch in master, give it a try

kolbyjack commented 1 year ago

Ah, true, but the way it was implemented initially, each of the requests would have overwritten each other in the cache. I think it would be better to just update the readme and state that only a single department is supported, at least for now.

On Sat, May 13, 2023 at 5:41 AM Nagailic Sergiu (Nikro) @.***> wrote:

@Nikro commented on this pull request.


In node_helper.js:

@@ -570,23 +574,42 @@ module.exports = NodeHelper.create({ for (var id of objectIDs) { var url = https://collectionapi.metmuseum.org/public/collection/v1/objects/${id};

  • request(url, function (error, response, body) {
  • var obj = JSON.parse(body);
  • const req = https.request(url, (res) => {

That should do the trick as well :)

Also we have to either fix docs or the approach on feeding multiple department ids - as unfortunately the API doesn't support multiple IDs 😞

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>