How to: Set NASA astronomy picture of the day (APOD) as wallpaper

163 views
Skip to first unread message

Bill Stewart

unread,
Jan 30, 2018, 7:18:47 PM1/30/18
to Tasker
First, create a directory at the root of your device called apod.

Task:

Task name: Set APOD
    A1: Variable Set [ Name:%apod_path To:apod/apod.jpg Recurse Variables:Off Do Maths:Off Append:Off ]
    A2: HTTP Get [ Server:Port:https://apod.nasa.gov/ Timeout:10 Mime Type:text/html Trust Any Certificate:Off ]
    A3: Variable Set [ Name:%httpd To:%HTTPD Recurse Variables:Off Do Maths:Off Append:Off ]
    A4: Variable Clear [ Name:%HTTPD Pattern Matching:Off Local Variables Only:Off ]
    A5: Variable Search Replace [ Variable:%httpd Search:\<img src="([^"]+)" Ignore Case:On Multi-Line:Off One Match Only:On Store Matches In:%imagesource Replace Matches:Off ]
    A6: Variable Search Replace [ Variable:%imagesource1 Search:"([^"]+)" Ignore Case:Off Multi-Line:Off One Match Only:On Store Matches In:%imagename Replace Matches:Off ]
    A7: Variable Search Replace [ Variable:%imagename1 Search:" Ignore Case:Off Multi-Line:Off One Match Only:Off Replace Matches:On Replace With: ]
    A8: HTTP Get [ Server:Port:https://apod.nasa.gov/%imagename1 Timeout:10 Mime Type:image/jpeg Output File:%apod_path Trust Any Certificate:Off ]
    A9: Set Wallpaper [ Type:All Image:%apod_path Scale:On Crop:Off ]

First HTTP Get action - retrieve the content of the page so the task can find the path of the file.

First Variable Search Replace action - get the first string containing <img src="..." in the page. Variable %imagesource1 will contain this part of the HTML tag.

Second Variable Search Replace action - get only the string enclosed in quotes (will be in variable %imagename1).

Third Variable Search Replace action - remove the quotes from the filename - search for " and Replace With is empty - now %imagename1 contains the path of the file without quotes.

Second HTTP Get action - get the image as text/jpeg and save as a file.

Bill

Jay M

unread,
Jan 31, 2018, 5:13:47 AM1/31/18
to tas...@googlegroups.com

theres a project for this in the wiki IIRC


--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.


--

Jay M ︻芫══一

ktmom

unread,
Feb 2, 2018, 1:27:58 PM2/2/18
to Tasker
This is an out of date way to achieve this goal. APOD had an API to grab images and data. It's preferrable to go through the API.

Bill Stewart

unread,
Feb 2, 2018, 7:27:05 PM2/2/18
to Tasker
Feel free to post your solution.

ktmom

unread,
Feb 3, 2018, 2:49:56 PM2/3/18
to Tasker
Not my solution. I just use the AutoApps project http://forum.joaoapps.com/index.php?resources/apod-wallpaper.148/
Reply all
Reply to author
Forward
0 new messages