mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-22 08:25:14 +00:00
0.0.20
- Return related data on artist/album/track endpoints - Scrobble table now links to tracks
This commit is contained in:
parent
99f9e7cfb3
commit
7c3b98a828
@ -3,7 +3,7 @@ stages:
|
|||||||
- bundle
|
- bundle
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
VERSION: 0.0.19
|
VERSION: 0.0.20
|
||||||
|
|
||||||
build-go:
|
build-go:
|
||||||
image: golang:1.16.2
|
image: golang:1.16.2
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
# 0.0.20
|
||||||
|
- Return related data on artist/album/track endpoints
|
||||||
|
- Scrobble table now links to tracks
|
||||||
|
|
||||||
# 0.0.19
|
# 0.0.19
|
||||||
- Tidy init/goscrobble.service
|
- Tidy init/goscrobble.service
|
||||||
- Add routers for Artist/Album/Track endpoints + basic pages
|
- Add routers for Artist/Album/Track endpoints + basic pages
|
||||||
|
@ -29,12 +29,17 @@ type ScrobbleResponseMeta struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ScrobbleResponseItem struct {
|
type ScrobbleResponseItem struct {
|
||||||
UUID string `json:"uuid"`
|
UUID string `json:"uuid"`
|
||||||
Timestamp time.Time `json:"time"`
|
Timestamp time.Time `json:"time"`
|
||||||
Artist string `json:"artist"`
|
Artist string `json:"artist"`
|
||||||
Album string `json:"album"`
|
Album string `json:"album"`
|
||||||
Track string `json:"track"`
|
Track ScrobbleTrackItem `json:"track"`
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ScrobbleTrackItem struct {
|
||||||
|
UUID string `json:"uuid"`
|
||||||
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// insertScrobble - This will return if it exists or create it based on MBID > Name
|
// insertScrobble - This will return if it exists or create it based on MBID > Name
|
||||||
@ -62,7 +67,7 @@ func getScrobblesForUser(userUuid string, limit int, page int) (ScrobbleResponse
|
|||||||
}
|
}
|
||||||
|
|
||||||
rows, err := db.Query(
|
rows, err := db.Query(
|
||||||
"SELECT BIN_TO_UUID(`scrobbles`.`uuid`, true), `scrobbles`.`created_at`, GROUP_CONCAT(`artists`.`name` separator ','), `albums`.`name`, `tracks`.`name`, `scrobbles`.`source` FROM `scrobbles` "+
|
"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` "+
|
||||||
"JOIN tracks ON scrobbles.track = tracks.uuid "+
|
"JOIN tracks ON scrobbles.track = tracks.uuid "+
|
||||||
"JOIN track_artist ON track_artist.track = tracks.uuid "+
|
"JOIN track_artist ON track_artist.track = tracks.uuid "+
|
||||||
"JOIN track_album ON track_album.track = tracks.uuid "+
|
"JOIN track_album ON track_album.track = tracks.uuid "+
|
||||||
@ -82,7 +87,7 @@ func getScrobblesForUser(userUuid string, limit int, page int) (ScrobbleResponse
|
|||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
item := ScrobbleResponseItem{}
|
item := ScrobbleResponseItem{}
|
||||||
err := rows.Scan(&item.UUID, &item.Timestamp, &item.Artist, &item.Album, &item.Track, &item.Source)
|
err := rows.Scan(&item.UUID, &item.Timestamp, &item.Artist, &item.Album, &item.Track.UUID, &item.Track.Name, &item.Source)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to fetch scrobbles: %+v", err)
|
log.Printf("Failed to fetch scrobbles: %+v", err)
|
||||||
return scrobbleReq, errors.New("Failed to fetch scrobbles")
|
return scrobbleReq, errors.New("Failed to fetch scrobbles")
|
||||||
|
@ -556,7 +556,7 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info := ServerInfo{
|
info := ServerInfo{
|
||||||
Version: "0.0.19",
|
Version: "0.0.20",
|
||||||
RegistrationEnabled: cachedRegistrationEnabled,
|
RegistrationEnabled: cachedRegistrationEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
const ScrobbleTable = (props) => {
|
const ScrobbleTable = (props) => {
|
||||||
return (
|
return (
|
||||||
@ -19,11 +20,17 @@ const ScrobbleTable = (props) => {
|
|||||||
props.data.map(function (element) {
|
props.data.map(function (element) {
|
||||||
let localTime = new Date(element.time);
|
let localTime = new Date(element.time);
|
||||||
return <tr key={element.uuid}>
|
return <tr key={element.uuid}>
|
||||||
<td>{localTime.toLocaleString()}</td>
|
<td>{localTime.toLocaleString()}</td>
|
||||||
<td>{element.track}</td>
|
<td>
|
||||||
<td>{element.artist}</td>
|
<Link
|
||||||
<td>{element.album}</td>
|
key={element.track.uuid}
|
||||||
<td>{element.source}</td>
|
to={"/track/"+element.track.uuid}
|
||||||
|
>{element.track.name}
|
||||||
|
</Link>
|
||||||
|
</td>
|
||||||
|
<td>{element.artist}</td>
|
||||||
|
<td>{element.album}</td>
|
||||||
|
<td>{element.source}</td>
|
||||||
</tr>;
|
</tr>;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ const Profile = (route) => {
|
|||||||
getProfile(username)
|
getProfile(username)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
setProfile(data);
|
setProfile(data);
|
||||||
console.log(data)
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
}, [username])
|
}, [username])
|
||||||
|
@ -35,7 +35,6 @@ const Reset = (route) => {
|
|||||||
validateResetPassword(reqToken)
|
validateResetPassword(reqToken)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
setReset(data);
|
setReset(data);
|
||||||
console.log(data)
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
})
|
})
|
||||||
}, [reqToken])
|
}, [reqToken])
|
||||||
|
@ -44,7 +44,7 @@ const Track = (route) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let length = "0";
|
let length = "0";
|
||||||
if (track.length !== '') {
|
if (track.length && track.length !== '') {
|
||||||
length = new Date(track.length * 1000).toISOString().substr(11, 8)
|
length = new Date(track.length * 1000).toISOString().substr(11, 8)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ const Track = (route) => {
|
|||||||
<div className="pageBody">
|
<div className="pageBody">
|
||||||
MusicBrainzId: {track.mbid}<br/>
|
MusicBrainzId: {track.mbid}<br/>
|
||||||
SpotifyID: {track.spotify_id}<br/>
|
SpotifyID: {track.spotify_id}<br/>
|
||||||
Track Length: {length}
|
Track Length: {length && length}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user