Astronomy pictures of the day as Wallpaper

Koubiack

New member
Hello All,
As a brand new user of Macrodroid, I'm trying to create a macro that change my phone wallpaper by the Nasa APOD picture.

I was able to create a macro that daily :
- get the JSON from NASA API,
- put it in a dictionnary,
- catch the value I want (hd picture URL)
- and save the image as wallpaper.jpg on my phone.

With another macro (Timed 30min after the one above) I try to put wallpaper.jpg as wallpaper but it doesn't work.
I dont have any error in the logs files but nothing change on my phone until I choose again wallpaper.jpg in the action and test It. As soon as it's launch "normaly" nothing change...

When I choose the file I want to put as wallpaper it only show a number as the file name (instead of the wallpaper.jpg) that the only thing that seems odd to me, so maybe that it or am I doing something wrong ?

Thanks for your help :D
 

Endercraft

Moderator (& bug finder :D)
Hello All,
As a brand new user of Macrodroid, I'm trying to create a macro that change my phone wallpaper by the Nasa APOD picture.

I was able to create a macro that daily :
- get the JSON from NASA API,
- put it in a dictionnary,
- catch the value I want (hd picture URL)
- and save the image as wallpaper.jpg on my phone.

With another macro (Timed 30min after the one above) I try to put wallpaper.jpg as wallpaper but it doesn't work.
I dont have any error in the logs files but nothing change on my phone until I choose again wallpaper.jpg in the action and test It. As soon as it's launch "normaly" nothing change...

When I choose the file I want to put as wallpaper it only show a number as the file name (instead of the wallpaper.jpg) that the only thing that seems odd to me, so maybe that it or am I doing something wrong ?

Thanks for your help :D
I think it may be because the wallpaper action uses static filenames. I'm not sure why dynamic files names haven't been added yet.
But @Dimlos probably has a shell script for that ;):D
 

Dimlos

Well-known member
Shell scripts don't seem to be able to solve this problem.
Tasker makes it easy.
With Termux, you can specify a URL, so you can set the wallpaper without downloading it.
Code:
termux-wallpaper -u https://apod.nasa.gov/apod/image/2303/TaurusDust_Chander_4096.jpg
 

Dimlos

Well-known member
The unintelligible string of numbers is called a URI.
I thought it would work if I overwrote the same file name in the same hierarchy, but it didn't.
Only @MacroDroidDev can tell what is being done internally.
 

Dimlos

Well-known member
If you use Termux, you can pass MacroDroid variables to Termux to handle URL changes.
However, it will take time to download the image from the Internet since the image size is also large.
 

Attachments

  • Macro.jpg
    Macro.jpg
    449.1 KB · Views: 10
  • Plugin.jpg
    Plugin.jpg
    298.7 KB · Views: 10
  • Termux.jpg
    Termux.jpg
    210.6 KB · Views: 10

Koubiack

New member
The unintelligible string of numbers is called a URI.
I thought it would work if I overwrote the same file name in the same hierarchy, but it didn't.
Only @MacroDroidDev can tell what is being done internally.
I thought of the same solution but it didn't work :ROFLMAO:
I wasn't able to find a free version of termux so, I've installed autotools and it seems to have done the trick.
As i use de free version i'll check if it works tomorrow

I'll let you know about that.
Thank for you answers
 

Dimlos

Well-known member
It is true that the AutoTools can also set the wallpaper by specifying a URL.
That's easier than using Termux.
 

Koubiack

New member
Thanks for the links.
AutoTools doesnt work for long (I have to manually click in the app to make it work)
More over I've to change a bit my macro has i discover that I need to make some action wait (like decode the json)
I'll try to make it work with termux and I let you know
 

Koubiack

New member
With your help i'm moving closer to the solution :D

I added some delay between my action and now everything before the termux works as intented.
BUT, i'm unable to make termux-wallpaper to work.
even when I try to use it on the console itself, it seems stucked :'( a curl -LO on the same url works fine but termux-wallpaper seems to have trouble to get the file back...

here is the example :
termux-wallpaper -u https://apod.nasa.gov/apod/image/2303/ArcticHenge_Letelier_1765.jpg

And it stay stuck with no error what so ever...

I might be doing something wrong but can't figure it out.

Any intel on this behaviour ? (the google search wasn't successful)

Thanks
 

Dimlos

Well-known member
If you run termux-wallpaper on Termux, you will see the error.
Since termux-wallpaper is an instruction of Termux:API, it cannot be used without Termux:API installed.
 

Koubiack

New member
Termux-api is installed since it's madatory to execute the termux-wallpaper.
Here is a screenshot of the command when executed.
(I've waited several minutes but it remains stuck)
 

Attachments

  • Screenshot_20230327_120658_Termux.jpg
    Screenshot_20230327_120658_Termux.jpg
    236.1 KB · Views: 5

Koubiack

New member
Ok that's weird... the command I've launched to make the screenshot is still running...
How long did you wait ?

I really dont get it, if the curl works, it means that termux is able to get online.

Is it possible that termux-wallpaper do not use the same configuration or permission set as curl ?
Is there a specific permission to set a wallpaper maybe ?

Maybe do you know a way to have debug logs or something like that ?

Thanks a lot for your help :D
 
Top