Unsplash wallpaper

Share and discuss your flows and ideas with other users.

Moderator: Martin

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Unsplash wallpaper

Post by anuraag » 17 Jan 2020 13:45

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
Last edited by anuraag on 02 Apr 2020 07:24, edited 4 times in total.

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Unsplash wallpaper

Post by anuraag » 09 Feb 2020 12:31

Updated flow to fix issue with display size wallpaper url.

User avatar
Rafi4
Posts: 281
Joined: 01 Dec 2017 05:23

Re: Unsplash wallpaper

Post by Rafi4 » 21 Feb 2020 12:20

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
No.1 Automation app in play store Automagic Premium
Samsung Galaxy j2 non rooted.
Android 5.1.1

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Unsplash wallpaper

Post by anuraag » 21 Feb 2020 12:35

Files are stored at
/storage/emulated/0/Android/data/ch.gridvision.ppam.androidautomagic/files/unsplash

suraj d
Posts: 3
Joined: 23 Aug 2018 15:03

Re: Unsplash wallpaper

Post by suraj d » 08 Mar 2020 10:26

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

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Unsplash wallpaper

Post by anuraag » 08 Mar 2020 11:16

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
Last edited by anuraag on 09 Mar 2020 12:49, edited 1 time in total.

suraj d
Posts: 3
Joined: 23 Aug 2018 15:03

Re: Unsplash wallpaper

Post by suraj d » 09 Mar 2020 12:28

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])

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Unsplash wallpaper

Post by anuraag » 09 Mar 2020 12:44

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

anuraag
Posts: 371
Joined: 24 Jan 2015 02:06

Re: Unsplash wallpaper

Post by anuraag » 09 Mar 2020 12:55

Here is flow.
Modify first action to change path. Make sure it exits.
Attachments
flow_Unsplash_copy_20200309_182338.xml
(32.81 KiB) Downloaded 231 times

suraj d
Posts: 3
Joined: 23 Aug 2018 15:03

Re: Unsplash wallpaper

Post by suraj d » 09 Mar 2020 13:42

Error :shock: using-unsplash copy

Code: Select all

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

Post Reply