mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
0.0.28
- Fix mobile view on user pages - Fix favicon issue - Return Artist UUID with scrobble list
This commit is contained in:
parent
f4bdf3f730
commit
489527c8f9
@ -3,7 +3,7 @@ stages:
|
|||||||
- bundle
|
- bundle
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
VERSION: 0.0.27
|
VERSION: 0.0.28
|
||||||
|
|
||||||
build-go:
|
build-go:
|
||||||
image: golang:1.16.2
|
image: golang:1.16.2
|
||||||
|
@ -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
|
# 0.0.27
|
||||||
- Navidrome works!
|
- Navidrome works!
|
||||||
- Tidy up request/response structure in backend
|
- Tidy up request/response structure in backend
|
||||||
|
@ -31,7 +31,7 @@ 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 ScrobbleTrackItem `json:"artist"`
|
||||||
Album string `json:"album"`
|
Album string `json:"album"`
|
||||||
Track ScrobbleTrackItem `json:"track"`
|
Track ScrobbleTrackItem `json:"track"`
|
||||||
Source string `json:"source"`
|
Source string `json:"source"`
|
||||||
@ -67,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`, 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 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 "+
|
||||||
@ -87,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.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 {
|
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")
|
||||||
|
@ -733,7 +733,7 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
info := ServerInfo{
|
info := ServerInfo{
|
||||||
Version: "0.0.27",
|
Version: "0.0.28",
|
||||||
RegistrationEnabled: cachedRegistrationEnabled,
|
RegistrationEnabled: cachedRegistrationEnabled,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package goscrobble
|
|||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
@ -165,10 +166,15 @@ func (track *Track) updateTrack(col string, val string, tx *sql.Tx) error {
|
|||||||
|
|
||||||
func getTrackByUUID(uuid string) (Track, error) {
|
func getTrackByUUID(uuid string) (Track, error) {
|
||||||
var track Track
|
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)
|
uuid).Scan(&track.UUID, &track.Name, &track.Desc, &track.Img, &track.Length, &track.MusicBrainzID, &track.SpotifyID)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
return track, errors.New("Invalid UUID")
|
return track, errors.New("Invalid UUID")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,37 +3,32 @@ import { Link } from 'react-router-dom';
|
|||||||
|
|
||||||
const ScrobbleTable = (props) => {
|
const ScrobbleTable = (props) => {
|
||||||
return (
|
return (
|
||||||
<div style={{width: `100%`, maxWidth: `900px`}}>
|
<div style={{
|
||||||
<table style={{width: `100%`}} border={1} cellPadding={5}>
|
border: `1px solid #FFFFFF`,
|
||||||
<thead>
|
width: `100%`,
|
||||||
<tr>
|
display: `flex`,
|
||||||
<td>Timestamp</td>
|
flexWrap: `wrap`,
|
||||||
<td>Track</td>
|
minWidth: `300px`,
|
||||||
<td>Artist</td>
|
maxWidth: `900px`,
|
||||||
<td>Album</td>
|
}}>
|
||||||
</tr>
|
{
|
||||||
</thead>
|
props.data &&
|
||||||
<tbody>
|
props.data.map(function (element) {
|
||||||
{
|
let localTime = new Date(element.time);
|
||||||
props.data &&
|
return <div style={{borderBottom: `1px solid #CCC`, width: `100%`, padding: `2px`}} key={"box" + element.time}>
|
||||||
props.data.map(function (element) {
|
{localTime.toLocaleString()}<br/>
|
||||||
let localTime = new Date(element.time);
|
<Link
|
||||||
return <tr key={element.uuid}>
|
key={"artist" + element.time}
|
||||||
<td>{localTime.toLocaleString()}</td>
|
to={"/artist/"+element.artist.uuid}
|
||||||
<td>
|
>{element.artist.name}</Link> -
|
||||||
<Link
|
<Link
|
||||||
key={element.track.uuid}
|
key={"track" + element.time}
|
||||||
to={"/track/"+element.track.uuid}
|
to={"/track/"+element.track.uuid}
|
||||||
>{element.track.name}
|
> {element.track.name}</Link>
|
||||||
</Link>
|
</div>;
|
||||||
</td>
|
|
||||||
<td>{element.artist}</td>
|
})
|
||||||
<td>{element.album}</td>
|
}
|
||||||
</tr>;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
.biggestWrapper {
|
.biggestWrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.biggestBox {
|
.biggestBox {
|
||||||
|
@ -12,7 +12,7 @@ const TopTable = (props) => {
|
|||||||
let tracks = props.items;
|
let tracks = props.items;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div style={{textAlign: `center`}}>
|
||||||
<span>Top {props.type}s</span>
|
<span>Top {props.type}s</span>
|
||||||
<div className="biggestWrapper">
|
<div className="biggestWrapper">
|
||||||
<div className="biggestBox">
|
<div className="biggestBox">
|
||||||
|
@ -49,8 +49,8 @@ const Album = (route) => {
|
|||||||
{album.name}
|
{album.name}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="pageBody">
|
<div className="pageBody">
|
||||||
MusicBrainzId: {album.mbid}<br/>
|
{album.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/album/" + album.mbid}>Open on MusicBrainz<br/></a>}
|
||||||
SpotifyID: {album.spotify_id}
|
{album.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/album/" + album.spotify_id}>Open on Spotify<br/></a>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -48,9 +48,10 @@ const Artist = (route) => {
|
|||||||
<h1>
|
<h1>
|
||||||
{artist.name}
|
{artist.name}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="pageBody">
|
<div className="pageBody" style={{textAlign: `center`}}>
|
||||||
MusicBrainzId: {artist.mbid}<br/>
|
<img src={artist.img} alt={artist.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/>
|
||||||
SpotifyID: {artist.spotify_id}
|
{artist.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/artist/" + artist.mbid}>Open on MusicBrainz<br/></a>}
|
||||||
|
{artist.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/artist/" + artist.spotify_id}>Open on Spotify<br/></a>}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -43,6 +43,7 @@ const Track = (route) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(track)
|
||||||
let length = "0";
|
let length = "0";
|
||||||
if (track.length && 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)
|
||||||
@ -54,9 +55,11 @@ const Track = (route) => {
|
|||||||
<h1>
|
<h1>
|
||||||
{track.name}
|
{track.name}
|
||||||
</h1>
|
</h1>
|
||||||
<div className="pageBody">
|
|
||||||
MusicBrainzId: {track.mbid}<br/>
|
<div className="pageBody" style={{textAlign: `center`}}>
|
||||||
SpotifyID: {track.spotify_id}<br/>
|
<img src={track.img} alt={track.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/>
|
||||||
|
{track.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/track/" + track.mbid}>Open on MusicBrainz<br/></a>}
|
||||||
|
{track.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/track/" + track.spotify_id}>Open on Spotify<br/></a>}
|
||||||
Track Length: {length && length}
|
Track Length: {length && length}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user