From c267f5a7ef1b58e3e3cd9bda192cddff7a81427e Mon Sep 17 00:00:00 2001 From: Daniel Mason Date: Sun, 28 Mar 2021 22:17:39 +1300 Subject: [PATCH] Tidy up logging --- internal/goscrobble/album.go | 2 ++ internal/goscrobble/jellyfin.go | 2 -- internal/goscrobble/server.go | 2 +- internal/goscrobble/utils.go | 4 +--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/internal/goscrobble/album.go b/internal/goscrobble/album.go index de3c0cac..2618549a 100644 --- a/internal/goscrobble/album.go +++ b/internal/goscrobble/album.go @@ -28,6 +28,7 @@ func insertAlbum(name string, mbid string, artists []string, tx *sql.Tx) (Album, } album = fetchAlbum("mbid", mbid, tx) + album.linkAlbumToArtists(artists, tx) } } else { 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.linkAlbumToArtists(artists, tx) } } diff --git a/internal/goscrobble/jellyfin.go b/internal/goscrobble/jellyfin.go index 154beac7..c480037a 100644 --- a/internal/goscrobble/jellyfin.go +++ b/internal/goscrobble/jellyfin.go @@ -10,8 +10,6 @@ import ( // ParseJellyfinInput - Transform API data into a common struct 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 artist, err := insertArtist(fmt.Sprintf("%s", data["Artist"]), fmt.Sprintf("%s", data["Provider_musicbrainzartist"]), tx) if err != nil { diff --git a/internal/goscrobble/server.go b/internal/goscrobble/server.go index 2791baad..5627f912 100644 --- a/internal/goscrobble/server.go +++ b/internal/goscrobble/server.go @@ -223,7 +223,7 @@ func handleIngress(w http.ResponseWriter, r *http.Request) { return } ingressType := strings.Replace(r.URL.Path, "/api/v1/ingress/", "", 1) - log.Println(ingressType) + switch ingressType { case "jellyfin": tx, _ := db.Begin() diff --git a/internal/goscrobble/utils.go b/internal/goscrobble/utils.go index 7796ece6..29c11c9e 100644 --- a/internal/goscrobble/utils.go +++ b/internal/goscrobble/utils.go @@ -4,7 +4,6 @@ import ( "encoding/hex" "encoding/json" "io" - "log" "math/big" "net" "net/http" @@ -40,7 +39,7 @@ func contains(s []string, e string) bool { 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 { var ip net.IP host, _, _ := net.SplitHostPort(r.RemoteAddr) @@ -57,7 +56,6 @@ func getUserIp(r *http.Request) net.IP { } ip = net.ParseIP(host) - log.Printf("%+v", ip) return ip }