mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 08:25:14 +00:00
Tidy up logging
This commit is contained in:
parent
91e1e83466
commit
c267f5a7ef
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
@ -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()
|
||||||
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user