Tidy up logging

This commit is contained in:
Daniel Mason 2021-03-28 22:17:39 +13:00
parent 91e1e83466
commit c267f5a7ef
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
4 changed files with 4 additions and 6 deletions

View File

@ -28,6 +28,7 @@ func insertAlbum(name string, mbid string, artists []string, tx *sql.Tx) (Album,
} }
album = fetchAlbum("mbid", mbid, tx) album = fetchAlbum("mbid", mbid, tx)
album.linkAlbumToArtists(artists, tx)
} }
} else { } else {
album = fetchAlbum("name", name, tx) album = fetchAlbum("name", name, tx)
@ -39,6 +40,7 @@ func insertAlbum(name string, mbid string, artists []string, tx *sql.Tx) (Album,
} }
album = fetchAlbum("name", name, tx) album = fetchAlbum("name", name, tx)
album.linkAlbumToArtists(artists, tx)
} }
} }

View File

@ -10,8 +10,6 @@ import (
// ParseJellyfinInput - Transform API data into a common struct // ParseJellyfinInput - Transform API data into a common struct
func ParseJellyfinInput(userUUID string, data map[string]interface{}, ip net.IP, tx *sql.Tx) error { func ParseJellyfinInput(userUUID string, data map[string]interface{}, ip net.IP, tx *sql.Tx) error {
log.Printf("%+v : %+v", userUUID, data)
// Insert artist if not exist // Insert artist if not exist
artist, err := insertArtist(fmt.Sprintf("%s", data["Artist"]), fmt.Sprintf("%s", data["Provider_musicbrainzartist"]), tx) artist, err := insertArtist(fmt.Sprintf("%s", data["Artist"]), fmt.Sprintf("%s", data["Provider_musicbrainzartist"]), tx)
if err != nil { if err != nil {

View File

@ -223,7 +223,7 @@ func handleIngress(w http.ResponseWriter, r *http.Request) {
return return
} }
ingressType := strings.Replace(r.URL.Path, "/api/v1/ingress/", "", 1) ingressType := strings.Replace(r.URL.Path, "/api/v1/ingress/", "", 1)
log.Println(ingressType)
switch ingressType { switch ingressType {
case "jellyfin": case "jellyfin":
tx, _ := db.Begin() tx, _ := db.Begin()

View File

@ -4,7 +4,6 @@ import (
"encoding/hex" "encoding/hex"
"encoding/json" "encoding/json"
"io" "io"
"log"
"math/big" "math/big"
"net" "net"
"net/http" "net/http"
@ -40,7 +39,7 @@ func contains(s []string, e string) bool {
return false return false
} }
// getUserIp - Returns IP that isn't set in REVERSE_PROXY // getUserIp - Returns IP that isn't set in REVERSE_PROXIES
func getUserIp(r *http.Request) net.IP { func getUserIp(r *http.Request) net.IP {
var ip net.IP var ip net.IP
host, _, _ := net.SplitHostPort(r.RemoteAddr) host, _, _ := net.SplitHostPort(r.RemoteAddr)
@ -57,7 +56,6 @@ func getUserIp(r *http.Request) net.IP {
} }
ip = net.ParseIP(host) ip = net.ParseIP(host)
log.Printf("%+v", ip)
return ip return ip
} }