- Fix artist/album/track images
This commit is contained in:
Daniel Mason 2021-04-17 11:34:53 +12:00
parent 8bc462878a
commit 65b4c78137
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
12 changed files with 29 additions and 12 deletions

View File

@ -3,7 +3,7 @@ stages:
- bundle - bundle
variables: variables:
VERSION: 0.0.29 VERSION: 0.0.30
build-go: build-go:
image: golang:1.16.2 image: golang:1.16.2

View File

@ -1,3 +1,6 @@
# 0.0.30
- Fix artist/album/track images
# 0.0.29 # 0.0.29
- Add image handler - Add image handler
- Store images locally - Store images locally

View File

@ -38,9 +38,13 @@ func importImage(uuid string, url string) error {
return err return err
} }
// Goroutine the resize to keep it _faaaast_
go resizeImage(uuid)
return nil return nil
} }
func resizeImage(uuid string) error { func resizeImage(uuid string) {
return nil // resize to 300x300 and maybe smaller?
return
} }

View File

@ -238,7 +238,7 @@ func (user *User) updateImageDataFromSpotify() error {
client := auth.NewClient(token) client := auth.NewClient(token)
client.AutoRetry = true client.AutoRetry = true
rows, err := db.Query("SELECT BIN_TO_UUID(`uuid`, true), `name` FROM `artists` WHERE IFNULL(`img`,'') NOT IN ('pending', 'complete') LIMIT 50") rows, err := db.Query("SELECT BIN_TO_UUID(`uuid`, true), `name` FROM `artists` WHERE IFNULL(`img`,'') NOT IN ('pending', 'complete') LIMIT 100")
if err != nil { if err != nil {
log.Printf("Failed to fetch config: %+v", err) log.Printf("Failed to fetch config: %+v", err)
return errors.New("Failed to fetch artists") return errors.New("Failed to fetch artists")
@ -282,7 +282,7 @@ func (user *User) updateImageDataFromSpotify() error {
} }
tx.Commit() tx.Commit()
rows, err = db.Query("SELECT BIN_TO_UUID(`uuid`, true), `name` FROM `albums` WHERE IFNULL(`img`,'') NOT IN ('pending', 'complete') LIMIT 50") rows, err = db.Query("SELECT BIN_TO_UUID(`uuid`, true), `name` FROM `albums` WHERE IFNULL(`img`,'') NOT IN ('pending', 'complete') LIMIT 100")
if err != nil { if err != nil {
log.Printf("Failed to fetch config: %+v", err) log.Printf("Failed to fetch config: %+v", err)
return errors.New("Failed to fetch artists") return errors.New("Failed to fetch artists")

View File

@ -740,7 +740,7 @@ func getServerInfo(w http.ResponseWriter, r *http.Request) {
} }
info := ServerInfo{ info := ServerInfo{
Version: "0.0.29", Version: "0.0.30",
RegistrationEnabled: cachedRegistrationEnabled, RegistrationEnabled: cachedRegistrationEnabled,
} }

View File

@ -8,9 +8,6 @@ import (
var endTicker chan bool var endTicker chan bool
func StartBackgroundWorkers() { func StartBackgroundWorkers() {
user, _ := getUserByUsername("idanoo")
go user.updateImageDataFromSpotify()
endTicker := make(chan bool) endTicker := make(chan bool)
hourTicker := time.NewTicker(time.Duration(1) * time.Hour) hourTicker := time.NewTicker(time.Duration(1) * time.Hour)

View File

@ -11,5 +11,5 @@
} }
.homeBannerItemCount { .homeBannerItemCount {
font-size: 22pt; font-size: 1.9rem;
} }

View File

@ -49,6 +49,7 @@ const Album = (route) => {
{album.name} {album.name}
</h1> </h1>
<div className="pageBody"> <div className="pageBody">
<img src={process.env.REACT_APP_API_URL + "/img/" + album.uuid + "_full.jpg"} alt={album.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/>
{album.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/album/" + album.mbid}>Open on MusicBrainz<br/></a>} {album.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/album/" + album.mbid}>Open on MusicBrainz<br/></a>}
{album.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/album/" + album.spotify_id}>Open on Spotify<br/></a>} {album.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/album/" + album.spotify_id}>Open on Spotify<br/></a>}
</div> </div>

View File

@ -49,7 +49,7 @@ const Artist = (route) => {
{artist.name} {artist.name}
</h1> </h1>
<div className="pageBody" style={{textAlign: `center`}}> <div className="pageBody" style={{textAlign: `center`}}>
<img src={artist.img} alt={artist.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/> <img src={process.env.REACT_APP_API_URL + "/img/" + artist.uuid + "_full.jpg"} alt={artist.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/>
{artist.mbid && <a rel="noreferrer" target="_blank" href={"https://musicbrainz.org/artist/" + artist.mbid}>Open on MusicBrainz<br/></a>} {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>} {artist.spotify_id && <a rel="noreferrer" target="_blank" href={"https://open.spotify.com/artist/" + artist.spotify_id}>Open on Spotify<br/></a>}
</div> </div>

View File

@ -0,0 +1,11 @@
.homeText {
margin: 0;
font-size: 2rem;
}
.subHomeText {
margin-top: -5px;
font-style: italic;
color: #CCC;
font-size: 1.4rem;
}

View File

@ -9,6 +9,7 @@ const Home = () => {
<div className="pageWrapper"> <div className="pageWrapper">
<img src={logo} className="App-logo" alt="logo" /> <img src={logo} className="App-logo" alt="logo" />
<p className="homeText">GoScrobble is an open source music scrobbling service.</p> <p className="homeText">GoScrobble is an open source music scrobbling service.</p>
<p className="subHomeText">Supports Spotify, Jellyfin, Navidrome / Subsonic / Airsonic.</p>
<HomeBanner /> <HomeBanner />
</div> </div>
); );

View File

@ -57,7 +57,7 @@ const Track = (route) => {
</h1> </h1>
<div className="pageBody" style={{textAlign: `center`}}> <div className="pageBody" style={{textAlign: `center`}}>
<img src={track.img} alt={track.name} style={{maxWidth: `300px`, maxHeight: `300px`}}/><br/><br/> <img src={process.env.REACT_APP_API_URL + "/img/" + track.img + "_full.jpg"} 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.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.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}