all repos — breadsite @ 3ffe747a9db18cbbd2fdded2e459fb1be13f70ab

Unnamed repository; edit this file 'description' to name the repository.

backend/net.go (view raw)

 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
package main

import (
	"fmt"
	"log"
	"net/http"
	"reflect"
)

func handler(w http.ResponseWriter, r *http.Request) {
	playingInfo := getInfo()

	v := reflect.ValueOf(playingInfo)
	k := v.Type()
	for i := range v.NumField() {
		log.Printf("%s: %s\n", k.Field(i).Name, v.Field(i))
	}

    fmt.Fprintf(
		w,
		"<p>%s</p><p>%s</p><p>%s</p><a href=\"%s\"><img src=\"%s\"></a>",
		playingInfo.artistName,
		playingInfo.recordingName,
		playingInfo.releaseName,
		playingInfo.recordingUrl,
		playingInfo.coverUrl,
	)
}