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 ( -
- - - - - - - - - - - { - props.data && - props.data.map(function (element) { - let localTime = new Date(element.time); - return - - - - - ; - }) - } - -
TimestampTrackArtistAlbum
{localTime.toLocaleString()} - {element.track.name} - - {element.artist}{element.album}
+
+ { + props.data && + props.data.map(function (element) { + let localTime = new Date(element.time); + return
+ {localTime.toLocaleString()}
+ {element.artist.name} - + {element.track.name} +
; + + }) + }
); } diff --git a/web/src/Components/TopTable.css b/web/src/Components/TopTable.css index a84d5996..698f9ad6 100644 --- a/web/src/Components/TopTable.css +++ b/web/src/Components/TopTable.css @@ -1,6 +1,8 @@ .biggestWrapper { display: flex; flex-wrap: wrap; + align-items: center; + justify-content: center; } .biggestBox { diff --git a/web/src/Components/TopTable.js b/web/src/Components/TopTable.js index 4e5b378b..b44a2891 100644 --- a/web/src/Components/TopTable.js +++ b/web/src/Components/TopTable.js @@ -12,7 +12,7 @@ const TopTable = (props) => { let tracks = props.items; return ( -
+
Top {props.type}s
diff --git a/web/src/Pages/Album.js b/web/src/Pages/Album.js index 1de56645..da968978 100644 --- a/web/src/Pages/Album.js +++ b/web/src/Pages/Album.js @@ -49,8 +49,8 @@ const Album = (route) => { {album.name}
- MusicBrainzId: {album.mbid}
- SpotifyID: {album.spotify_id} + {album.mbid && Open on MusicBrainz
} + {album.spotify_id && Open on Spotify
}
); diff --git a/web/src/Pages/Artist.js b/web/src/Pages/Artist.js index 1d54eb53..952f61b5 100644 --- a/web/src/Pages/Artist.js +++ b/web/src/Pages/Artist.js @@ -48,9 +48,10 @@ const Artist = (route) => {

{artist.name}

-
- MusicBrainzId: {artist.mbid}
- SpotifyID: {artist.spotify_id} +
+ {artist.name}

+ {artist.mbid && Open on MusicBrainz
} + {artist.spotify_id && Open on Spotify
}
); diff --git a/web/src/Pages/Track.js b/web/src/Pages/Track.js index 3ea9be02..3b883d69 100644 --- a/web/src/Pages/Track.js +++ b/web/src/Pages/Track.js @@ -43,6 +43,7 @@ const Track = (route) => { ) } + console.log(track) let length = "0"; if (track.length && track.length !== '') { length = new Date(track.length * 1000).toISOString().substr(11, 8) @@ -54,9 +55,11 @@ const Track = (route) => {

{track.name}

-
- MusicBrainzId: {track.mbid}
- SpotifyID: {track.spotify_id}
+ +
+ {track.name}

+ {track.mbid && Open on MusicBrainz
} + {track.spotify_id && Open on Spotify
} Track Length: {length && length}