Create Image request daemon
trenton-telge opened this issue · comments
Every night, request new images and cache
Images API index request: http://eventhorizonwebdesign.com/framed/api/index.php/images
Relevant Stack Overflow: https://stackoverflow.com/questions/8089189/get-the-response-of-a-http-get-request
Make actions in this class open a new thread when they start network actions, otherwise the app will have freezing issues when this is called from the settings or dreamservice activities.
Here is documentation on multithreading in Java: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html
The data should flow like this:
- App sends a request for the remote API to send the JSON list of image addresses and info
- JSON list is recieved by app and stored
- JSON list is split into string groups, and stored in RemoteImage objects
- RemoteImage objects, when created, are filtered. If the RemoteImage object author is also an author checked in the settings panel, it is added to a Results vector. If not, it is discarded.
- The Result vector is looped through, downloading the urls contained to local locations. The local path should be stored in the RemoteImage it corresponds to.
I can help with multithreading after this is done. None of this needs to directly modify the UI thread, so that should be fairly simple.