I figured out how to add pictures to JList, so now just need to link it with fetcing images from twitter =)
@hamoid,
I totally agree with the fact that it should be decentralized. For the first "prototyping" stage, manual making of thumbs may be fine, but it's not going to be scalable.
It's a good idea to have a dedicated account
@p5tweetThumb
which allow the process of making thumbs be independent from users twitter account.
Then I thought that people could tweet a thumbnail, but doesn't that make it too complicated? It should be easy.
The easiest from user perspective way, is if the user only has to write sketch and press "Share sketch via tweet" and then the thumbnail is made automatically. One solution to make thumbs automatically is to compile and run them headlessly on linux machine. See my reply to makio to get an approximage picture of how this may look like...
The tool currently already uses twitter API keys [but currently embedded keys are readOnly] (As to my understanding, according to latest twitter policies, even to search twitter you need an API key). So adding ability to tweet is a matter of adding couple of lines of code.
@makio,
The infinite loop theoretically has solution as well: let's imagine that sketches are downloaded from twitter feed and are run on linux machine under user with limited rights. All sketches have max execution time (e.g. 10 seconds). If sketch within that time managed to call "saveFrame()" - we consider that extraction of sketche's image was successful. If not - then probably sketch had some infinite loop or smth.
Execution time may be limited by having in memory root-process which will have rights to terminate sketches which have passed their allowed execution time.
This may sound complicated, but I have tried before running processing sketches on ubuntu headless server:
and it seems to work.
I do not have big experience with linux (especially when it goes about running processes under limited permissions), but this is approximate description what sounds like it may work, what do you think? are there any better ways?
linux server
cron job downloads new tweet every minute, compiles the sketch (via processing-java) and runs it
(under which user will the cron run this job? how to make it run under limited permissions?
at the same time there's another process (simple java process?? or shell script?) constantly running in memory under root permissions. This process polls list of running processes and makes sure that if he sees sketch, he terminates sketch processes after 10 seconds of running). ? How to fetch process lists on linux? How to terminate? Is there an easy way? How to run process as root so that it stays in memory?
another cron job runs every couple of minutes, it just scans directory of compiled sketches for images "frame-####.png" or smth like that. if he finds files like that and image isn't completely blank (99% grey or white or black or whatever) it replies to the original tweet of the sketch with the image.
What do you think guys? Isn't it too complicated? What would be the simpliest way to implement this?