koel/resources/assets/js/components/main-wrapper/extra/artist-info.vue
An Phan cf27ed713d First integration with Last.fm
Koel can now integrate and use the rich information from Last.fm. Now
whenever a song is played, its album and artist information will be
queried from Last.fm and cached for later use. What's better, if an
album has no cover, Koel will try to update its cover if one is found on
Last.fm.

In order to use this feature, users only need to provide valid Last.fm
API credentials (namely LASTFM_API_KEY and LASTFM_API_SECRET) in .env. A
npm and gulp rebuild is also required - just like with every update.
2015-12-20 00:36:44 +08:00

77 lines
2.2 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<article v-if="song" id="artistInfo">
<h1>
<span>{{ song ? song.album.artist.name : '' }}</span>
<a class="shuffle" @click.prevent="shuffleAll"><i class="fa fa-random"></i></a>
</h1>
<div v-if="song.album.artist.info">
<img v-if="song.album.artist.info.image" :src="song.album.artist.info.image"
title="They see me posin, they hatin"
class="cool-guys-posing cover">
<div class="bio" v-if="song.album.artist.info.bio.summary">
<div class="summary" v-show="!showingFullBio">{{{ song.album.artist.info.bio.summary }}}</div>
<div class="full" v-show="showingFullBio">{{{ song.album.artist.info.bio.full }}}</div>
<button class="more" v-show="!showingFullBio" @click.prevent="showingFullBio = !showingFullBio">
Full Bio
</button>
</div>
<p class="none" v-else>This artist has no Last.fm biography yet.</p>
<footer>Data &copy; <a target="_blank" href="{{{ song.album.artist.info.url }}}">Last.fm</a></footer>
</div>
<p class="none" v-else>Nothing can be found. This artist is a mystery.</p>
</article>
</template>
<script>
import playback from '../../../services/playback';
export default {
replace: false,
data() {
return {
song: null,
showingFullBio: false,
};
},
methods: {
resetState() {
this.song = null;
this.showingFullBio = false;
},
shuffleAll() {
playback.playAllByArtist(this.song.album.artist);
},
},
events: {
'song:info-loaded': function (song) {
this.song = song;
},
},
}
</script>
<style lang="sass">
@import "resources/assets/sass/partials/_vars.scss";
@import "resources/assets/sass/partials/_mixins.scss";
#artistInfo {
img.cool-guys-posing {
width: 100%;
height: auto;
}
.bio {
margin-top: 16px;
}
}
</style>