summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--pkg/unsplash/unsplash.go28
1 files changed, 16 insertions, 12 deletions
diff --git a/pkg/unsplash/unsplash.go b/pkg/unsplash/unsplash.go
index 689f8c4..a284ebc 100644
--- a/pkg/unsplash/unsplash.go
+++ b/pkg/unsplash/unsplash.go
@@ -20,23 +20,27 @@ import (
 	"framagit.org/andinus/cetus/pkg"
 )
 
-// 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)
+	path = getPathFromID(photoID)
+	path = appendSizeToPath(path, width, height)
 	err = background.Set(path)
-
 	return err
 }
+
+func getPathFromID(photoID string) string {
+	var path string
+	path = fmt.Sprintf("%s/%s", "https://source.unsplash.com", photoID)
+	return path
+}
+
+func appendSizeToPath(path string, width int, height int) string {
+	var size string
+
+	size = fmt.Sprintf("%dx%d", width, height)
+	path = fmt.Sprintf("%s/%s", path, size)
+	return path
+}
Blame the previous revision' href='/akkartik/mu/blame/subx/examples/ex10.subx?h=main&id=6607a30415e2bede27c43b57ce3c5cbc42278fa9'>^
ddeed58f ^
33352536 ^


ddeed58f ^
7a583220 ^
33352536 ^
9d27e966 ^

33352536 ^
9d27e966 ^
33352536 ^
ee9a9237 ^
6030d7e2 ^
ecfbbfb5 ^
33352536 ^
ecfbbfb5 ^
ddeed58f ^


71eb22a5 ^
33352536 ^


03d50cc8 ^
33352536 ^




ddeed58f ^
6323661c ^
6070c23e ^
ddeed58f ^
33352536 ^
6070c23e ^
ddeed58f ^
33352536 ^

6030d7e2 ^

03d50cc8 ^
6030d7e2 ^
6323661c ^
6070c23e ^
03d50cc8 ^
33352536 ^
6030d7e2 ^

03d50cc8 ^
33352536 ^
6030d7e2 ^
ed0e64a9 ^
ee9a9237 ^
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69