diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 15ddda75..5ed95d39 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - bundle variables: - VERSION: 0.0.27 + VERSION: 0.0.28 build-go: image: golang:1.16.2 diff --git a/docs/changelog.md b/docs/changelog.md index 161ab879..6d498664 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,8 @@ +# 0.0.28 +- Fix mobile view on user pages +- Fix favicon issue +- Return Artist UUID with scrobble list + # 0.0.27 - Navidrome works! - Tidy up request/response structure in backend diff --git a/internal/goscrobble/scrobble.go b/internal/goscrobble/scrobble.go index d5934449..3ae0c844 100644 --- a/internal/goscrobble/scrobble.go +++ b/internal/goscrobble/scrobble.go @@ -31,7 +31,7 @@ type ScrobbleResponseMeta struct { type ScrobbleResponseItem struct { UUID string `json:"uuid"` Timestamp time.Time `json:"time"` - Artist string `json:"artist"` + Artist ScrobbleTrackItem `json:"artist"` Album string `json:"album"` Track ScrobbleTrackItem `json:"track"` Source string `json:"source"` @@ -67,7 +67,7 @@ func getScrobblesForUser(userUuid string, limit int, page int) (ScrobbleResponse } rows, err := db.Query( - "SELECT BIN_TO_UUID(`scrobbles`.`uuid`, true), `scrobbles`.`created_at`, GROUP_CONCAT(`artists`.`name` separator ','), `albums`.`name`, BIN_TO_UUID(`tracks`.`uuid`, true), `tracks`.`name`, `scrobbles`.`source` FROM `scrobbles` "+ + "SELECT BIN_TO_UUID(`scrobbles`.`uuid`, true), `scrobbles`.`created_at`, BIN_TO_UUID(`artists`.`uuid`, true), `artists`.`name`, `albums`.`name`, BIN_TO_UUID(`tracks`.`uuid`, true), `tracks`.`name`, `scrobbles`.`source` FROM `scrobbles` "+ "JOIN tracks ON scrobbles.track = tracks.uuid "+ "JOIN track_artist ON track_artist.track = tracks.uuid "+ "JOIN track_album ON track_album.track = tracks.uuid "+ @@ -87,7 +87,7 @@ func getScrobblesForUser(userUuid string, limit int, page int) (ScrobbleResponse for rows.Next() { item := ScrobbleResponseItem{} - err := rows.Scan(&item.UUID, &item.Timestamp, &item.Artist, &item.Album, &item.Track.UUID, &item.Track.Name, &item.Source) + err := rows.Scan(&item.UUID, &item.Timestamp, &item.Artist.UUID, &item.Artist.Name, &item.Album, &item.Track.UUID, &item.Track.Name, &item.Source) if err != nil { log.Printf("Failed to fetch scrobbles: %+v", err) return scrobbleReq, errors.New("Failed to fetch scrobbles") diff --git a/internal/goscrobble/server.go b/internal/goscrobble/server.go index 1218ab2c..61c64d44 100644 --- a/internal/goscrobble/server.go +++ b/internal/goscrobble/server.go @@ -733,7 +733,7 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) { } info := ServerInfo{ - Version: "0.0.27", + Version: "0.0.28", RegistrationEnabled: cachedRegistrationEnabled, } diff --git a/internal/goscrobble/track.go b/internal/goscrobble/track.go index d920f610..75487891 100644 --- a/internal/goscrobble/track.go +++ b/internal/goscrobble/track.go @@ -3,6 +3,7 @@ package goscrobble import ( "database/sql" "errors" + "fmt" "log" "strings" ) @@ -165,10 +166,15 @@ func (track *Track) updateTrack(col string, val string, tx *sql.Tx) error { func getTrackByUUID(uuid string) (Track, error) { var track Track - err := db.QueryRow("SELECT BIN_TO_UUID(`uuid`, true), `name`, IFNULL(`desc`,''), IFNULL(`img`,''), `length`, `mbid`, `spotify_id` FROM `tracks` WHERE `uuid` = UUID_TO_BIN(?, true)", + err := db.QueryRow("SELECT BIN_TO_UUID(`tracks`.`uuid`, true), `tracks`.`name`, IFNULL(`albums`.`desc`,''), IFNULL(`albums`.`img`,''), `tracks`.`length`, `tracks`.`mbid`, `tracks`.`spotify_id` "+ + "FROM `tracks` "+ + "LEFT JOIN track_album ON track_album.track = tracks.uuid "+ + "LEFT JOIN albums ON track_album.album = albums.uuid "+ + "WHERE `tracks`.`uuid` = UUID_TO_BIN(?, true)", uuid).Scan(&track.UUID, &track.Name, &track.Desc, &track.Img, &track.Length, &track.MusicBrainzID, &track.SpotifyID) if err != nil { + fmt.Println(err) return track, errors.New("Invalid UUID") } diff --git a/web/src/Components/ScrobbleTable.js b/web/src/Components/ScrobbleTable.js index 2937314f..d1b2777b 100644 --- a/web/src/Components/ScrobbleTable.js +++ b/web/src/Components/ScrobbleTable.js @@ -3,37 +3,32 @@ import { Link } from 'react-router-dom'; const ScrobbleTable = (props) => { return ( -
Timestamp | -Track | -Artist | -Album | -
{localTime.toLocaleString()} | -- {element.track.name} - - | -{element.artist} | -{element.album} | -