♻️ Add custom http functions so that User-Agent is always sent
This commit is contained in:
parent
cfef5a6c7a
commit
2208b1de55
3 changed files with 62 additions and 15 deletions
|
|
@ -5,12 +5,12 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
u "net/url"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"codeberg.org/danjones000/strip-beats/config"
|
||||
h "codeberg.org/danjones000/strip-beats/utils/http"
|
||||
)
|
||||
|
||||
type FPrint struct {
|
||||
|
|
@ -61,13 +61,14 @@ func LookupFingerprint(print FPrint) (IdResults, error) {
|
|||
return res, errors.New("Missing acoustic_id_key from config")
|
||||
}
|
||||
url := "https://api.acoustid.org/v2/lookup"
|
||||
|
||||
form := u.Values{
|
||||
"format": {"json"},
|
||||
"client": {key},
|
||||
"duration": {fmt.Sprintf("%.0f", print.Duration)},
|
||||
"fingerprint": {print.Fingerprint},
|
||||
"meta": {"recordingids"}}
|
||||
resp, err := http.PostForm(url, form)
|
||||
resp, err := h.PostForm(url, form)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue