Removed the entire save data logic as its unnecessary
All checks were successful
/ publish (push) Successful in 1m40s
All checks were successful
/ publish (push) Successful in 1m40s
This commit is contained in:
parent
d411667a3e
commit
8bd3474c4b
3 changed files with 1 additions and 40 deletions
|
|
@ -2,8 +2,6 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"os"
|
||||
"sort"
|
||||
"time"
|
||||
|
|
@ -11,31 +9,12 @@ import (
|
|||
|
||||
const CropBottom = "bottom"
|
||||
|
||||
var ErrNon200Error = errors.New("non 200 status code")
|
||||
|
||||
type PendingImage struct {
|
||||
Date time.Time `json:"date"`
|
||||
URL string `json:"url"`
|
||||
Crop string `json:"crop"`
|
||||
}
|
||||
|
||||
func LoadPendingImageFromURL(url string) (pi PendingImage, err error) {
|
||||
resp, err := http.Get(url)
|
||||
if err != nil {
|
||||
return PendingImage{}, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return PendingImage{}, ErrNon200Error
|
||||
}
|
||||
|
||||
if err := json.NewDecoder(resp.Body).Decode(&pi); err != nil {
|
||||
return PendingImage{}, err
|
||||
}
|
||||
return pi, nil
|
||||
}
|
||||
|
||||
type PendingImages struct {
|
||||
Images []PendingImage `json:"images"`
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue