Page 1 of 2

Unsplash wallpaper

Posted: 17 Jan 2020 13:45
by anuraag
Here is flow to grab wallpaper from unsplash. It contains 2 flows.

1) First flow is to change wallpaper and excluding photo using tags. This flow will trigger hourly using Global Variable Date/Time. If screen off then 2nd flow will enable with User present trigger.

2) I have added cache option to change wallpaper when no network or battery is lower than 30%.

3) There is wallpaper_scrolling boolean available to enable/disable scrolling wallpapers.

Download
http://automagic4android.com/forum/down ... hp?id=1928

Re: Unsplash wallpaper

Posted: 09 Feb 2020 12:31
by anuraag
Updated flow to fix issue with display size wallpaper url.

Re: Unsplash wallpaper

Posted: 21 Feb 2020 12:20
by Rafi4
Hi anuraag
Good. Working fine. Are the images stored in internal memory? If yes. Where can I find them?

Thanks for making a good and amazing flow. Keep it up.

From record4

Re: Unsplash wallpaper

Posted: 21 Feb 2020 12:35
by anuraag
Files are stored at
/storage/emulated/0/Android/data/ch.gridvision.ppam.androidautomagic/files/unsplash

Re: Unsplash wallpaper

Posted: 08 Mar 2020 10:26
by suraj d
Hi anuraag,

Can you please explain how your flow work as I want to make some change.

1. Change only lock screen wallpaper
2. Add file extension (.jpg) in image saved, possibly change image save location as well.

I want flow to change only lockscreen wallpaper as I am using klwp as home screen wallpaper and it is not able to set wallpaper without image extension.

Thanks

Re: Unsplash wallpaper

Posted: 08 Mar 2020 11:16
by anuraag
1) To change image save path modify action Init Variable Text File:. Change File path to something like this

Code: Select all

{cachedir = callJavaConstructor("java.io.File", "File(java.lang.String)", "/storage/emulated/0/Pictures/unsplash")}/.cache
2) To change only lockscreen wallpaper replace action Script: change wall with action Set Wallpaper. Set type lockscreen. Set path to

Code: Select all

{cachedir+"/"+photoid}
3) To add jpg extension modify action HTTP Request: GET {url} store in {cachedir+"/"+photoid}. Change File to

Code: Select all

{cachedir+"/"+photoid}.jpg
Also change in Set Wallpaper action.


If you don't want to store images and directly apply images there is simple api available at source.unsplash.com.
example: get random wallpaper from a collection of 1065976 with specified size

Code: Select all

https://source.unsplash.com/collection/1065976/1960x1080

Re: Unsplash wallpaper

Posted: 09 Mar 2020 12:28
by suraj d
Am I suppose to make any changes in Expression: if (length(unsplash["cache"]) > 0 ...

It gives error when network is not connected
Error:

Code: Select all

ch.gridvision.ppam.androidautomagic.simplelang.a.d: No method with name listFiles found in class java.lang.String (Expression: callJavaMethod(cachedir, "java.io.File", "listFiles()")[line 0], Cause: java.lang.String.listFiles []).
Also Script: for (i in fromJSON(response)) ... gives error.
Error:

Code: Select all

ch.gridvision.ppam.androidautomagic.simplelang.a.d: Expression must return a collection but returned null (Expression: for (i in fromJSON(response)) {
	id = i['id'];
	if (!containsElement(unsplash["wall"], id) and !containsElement(unsplash["old_wall"], id)) {		addElement(unsplash["wall"], id)
	}
}[line 0])

Re: Unsplash wallpaper

Posted: 09 Mar 2020 12:44
by anuraag
Change Init variable text file to

Code: Select all

{cachedir = callJavaConstructor("java.io.File", "File(java.lang.String)", "/storage/emulated/0/Pictures/unsplash")}/.cache
Make sure path exits in your phone. Else create it.
/storage/emulated/0/Pictures/unsplash

Re: Unsplash wallpaper

Posted: 09 Mar 2020 12:55
by anuraag
Here is flow.
Modify first action to change path. Make sure it exits.

Re: Unsplash wallpaper

Posted: 09 Mar 2020 13:42
by suraj d
Error :shock: using-unsplash copy

Code: Select all

Index: 0, Size: 0 (Expression: unsplash["cache"][index][line 8])
With network connection, lockscreen updates successful