Hi,
I‘d like to create a realtime database of face images of this homepage beeing saved automatically in a FOLDER DAT:
as this website has two buttons, one „refresh“ and one „download image“, I d like to automate refresh and download, to create a real time updating image folder for a presentation of these images on touchdesigner.
is it possible to do so via the WEB RENDER TOP or WEBSOCKETS?
if yes, how would a possible approach be?
How can I automate this process to get a infinite database automatically refreshing?
the folder could be limited to 20 Images and the would add always new ones and erase the oldest ones (stack principle).
thanks for any suggestion,
greetz,
Sirom
1 Like
this is certainly possible. But this post of mine you linked to above is very old, these days there are better methods.
Anyway in your case it’s pretty easy. If you look in the sourcecode of the site, you’ll see clicking the reload button calls an reImage()
function, which generates an url like this:
?new='+timeInMs+imageType
where timeInMs is the javascript Date.now(), meaning milliseconds since epoch, and imageType is “auto” for persons.
So to translate into Python use this to generate a valid url:
import time
millisec = int(time.time() * 1000)
url = f"https://this-person-does-not-exist.com?new={millisec}auto"
Loading that url gives you a page with some JSON containing the new image url.
Very rough example attached, click the button to load new image in the Movie File In TOP.
Using an Info CHOP you can read the fully_pre_read
member of the Movie File In TOP so see when downloading is complete, and trigger a saving to disk action for instance…
load_new_image.tox (2.4 KB)
2 Likes
@nettoyeur Thank you so much! i ll try that asap.
greetz,
Sirom
what could a code look like to save images into a folder automatically (as you supoosed in exec2)?
how would I setup a storage folder, with around max. 30 pics? which would be overwritten with a new generated image, once outputted through a screen?
goal should be a continuous presentation of those images, and i decided to have a folder of 30 just to keep it more fluently (as a puffer).