-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.go
More file actions
39 lines (32 loc) · 690 Bytes
/
utils.go
File metadata and controls
39 lines (32 loc) · 690 Bytes
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
package main
import (
"encoding/base64"
"io"
"net/http"
)
func getImageAsBase64(url string) (string, error) {
resp, err := http.Get(url)
if err != nil {
return "", err
}
defer resp.Body.Close()
imageBytes, err := io.ReadAll(resp.Body)
if err != nil {
return "", err
}
base64Image := base64.StdEncoding.EncodeToString(imageBytes)
return base64Image, nil
}
func DefaultPayload() map[string]any {
ErrorFeedbackPayload := map[string]interface{}{
"title": "YTMD Remote",
"value": "Waiting for data...",
"play-icon": nil,
"like-icon": nil,
"indicator": map[string]interface{}{
"value": 0,
"enabled": false,
},
}
return ErrorFeedbackPayload
}