summary refs log tree commit diff stats
path: root/pkg/unsplash
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/unsplash')
-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
+}