summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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
6 57 58 59