summary refs log tree commit diff stats
path: root/pkg/unsplash/unsplash.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/unsplash/unsplash.go')
-rw-r--r--pkg/unsplash/unsplash.go21
1 files changed, 13 insertions, 8 deletions
diff --git a/pkg/unsplash/unsplash.go b/pkg/unsplash/unsplash.go
index e40503d..689f8c4 100644
--- a/pkg/unsplash/unsplash.go
+++ b/pkg/unsplash/unsplash.go
@@ -20,17 +20,22 @@ import (
 	"framagit.org/andinus/cetus/pkg"
 )
 
-// SetFromID sets background from Unsplash Photo ID
-func SetFromID(photoID string, width int, height int) error {
-	var (
-		path string
-		size string
-
-		err error
-	)
+// GetPathFromID returns path of the photo from Unsplash Photo ID
+func GetPathFromID(photoID string, width int, height int) string {
+	var path string
+	var size string
 
 	size = fmt.Sprintf("%dx%d", width, height)
 	path = fmt.Sprintf("%s/%s/%s", "https://source.unsplash.com", photoID, size)
+	return path
+}
+
+// SetFromID sets background from Unsplash Photo ID
+func SetFromID(photoID string, width int, height int) error {
+	var path string
+	var err error
+
+	path = GetPathFromID(photoID, width, height)
 	err = background.Set(path)
 
 	return err
ain&id=5763322b9cc8cf8c8caed6b62919a680ed907c9a'>5763322b ^
f0cf7af7 ^
5763322b ^
f0cf7af7 ^
b22e5e14 ^
5763322b ^

34514ae8 ^
f898ee7a ^
f0cf7af7 ^


34514ae8 ^

f0cf7af7 ^


c912b731 ^
5763322b ^



f0cf7af7 ^
5763322b ^
f0cf7af7 ^
53172ce1 ^
34514ae8 ^
f0cf7af7 ^
c912b731 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46