Adding initial changes for the evening - we have compiling code and some light scaffolding with the client and internal libraries

Signed-off-by: Kris Nóva <kris@nivenly.com>
This commit is contained in:
Kris Nóva 2021-01-30 23:59:44 -08:00
parent 0f880ac1fa
commit ef15a0ac15
6 changed files with 16 additions and 357 deletions

View file

@ -1,12 +1,18 @@
package main
import (
"github.com/kris-nova/logger"
"fmt"
"os"
photoprism "github.com/kris-nova/client-go"
"github.com/kris-nova/logger"
)
func halt(code int, msg string){
logger.Critical(msg)
// format string, a ...interface{}
func halt(code int, msg string, a ...interface{}) {
str := fmt.Sprintf(msg, a...)
logger.Critical(str)
os.Exit(code)
}
@ -17,9 +23,12 @@ func main() {
}
pass := os.Getenv("PHOTOPRISM_PASS")
if pass == "" {
halt(2, 'Missing PHOTOPRISM_PASS')
halt(2, "Missing PHOTOPRISM_PASS")
}
photoclient := photoprism.New()
photo, err := photoclient.V1().GetPhoto("123")
if err != nil {
halt(3, "Error fetching photo: %v", err)
}
fmt.Println(*photo)
}