Irishsmurf / LastFM-PHP-Album-Collage

Small Script that creates an album collage based upon your Lastfm activity
https://lastfm.paddez.com/
9 stars 3 forks source link

Static image doesn't get regenerated until forcing a new request via lastfm.php #26

Open fireattack opened 8 years ago

fireattack commented 8 years ago

TL;DR: The static image didn't re-generate/update until it's requested again via lastfm.php

Story: I used this URL: http://content.paddez.com/images/fireattack-1month.jpg in my ift.tt recipe to post the image to twitch every month. Today I noticed that image never actually refreshs until I made an explicit request via http://lastfm.paddez.com/lastfm.php?user=fireattack&period=1month&cols=3&rows=3&info=1&playcount=1

(Obviously, it has been refreshed by now since I used that URL again when testing. You can check my tweets for the record:

https://twitter.com/ikenaikoto/status/755599778872979456 [July 20] https://twitter.com/ikenaikoto/status/744727996024655873 [June 20] https://twitter.com/ikenaikoto/status/733493703743000576 [May 20]

)

Irishsmurf commented 7 years ago

Hey,

This is sort of working as intended. Originally the idea was to use provide a static image that doesn't force regeneration of the image every so often, as to improve response times (Regenerating the image each time is pretty costly in terms of time, especially for the large 15x15 tables.)

I guess workaround I could implement would be to have some sort of scheduler just make a call to regenerate a subset of images during low load.

I'll file this under "Feature Request" and I'll pick it up shortly.

In the meantime, if you link the lastfm.php URL to twitter, I believe twitter will take the image and host it independently - so it's somewhat static - although I'm not sure, I haven't tried it ¯(ツ)

Irishsmurf commented 7 years ago

Another point I guess is that a long term goal (RE: When I get time :D) is to have the static link to be unique to each generation - which I guess makes more sense than the really lazy way I'm doing it now - concatenating the options together.

fireattack commented 7 years ago

Originally the idea was to use provide a static image that doesn't force regeneration of the image every so often, as to improve response times

That makes sense, I guess I just misunderstood the purpose of this service.

Because there were (before Last.fm shut down the sidebar) lots services that do the similar thing: generate an image (static-ish) URL about your last.fm stats so people can put it on the sidebar to show. Needless to say it should be auto-updating from time to time to reflect your new stats; otherwise it would be no point to waste server resource to host it (you can just download and re-host it to whatever image hosting site, since it doesn't change). But it doesn't need to regenerate every time people request it, just after an interval or when the data is outdated.

Anyway, currently I am using http://lastfm.paddez.com/lastfm.php?user=fireattack&period=1month&cols=3&rows=3&info=1&playcount=1 as the image URL for IFTTT. And it seems work fine. Like I said before If I am using it as some signatures on some public places (like the sidebar thing I mentioned above) it would be resource-intensive for your server but since it only requests once every month, I think it should be OK for now.

Thanks for your reply.