replay, added this year
This commit is contained in:
parent
6f975a3394
commit
4e569365f8
3 changed files with 17 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
||||||
<vue-horizontal>
|
<vue-horizontal>
|
||||||
<div v-for="items in itemPages">
|
<div v-for="items in itemPages">
|
||||||
<mediaitem-list-item
|
<mediaitem-list-item
|
||||||
v-for="(song, index) in items" :parent="'listitem-hr' + simplifiedParent"
|
v-for="(song, index) in items" :show-library-status="show-library-status" :parent="'listitem-hr' + simplifiedParent"
|
||||||
:index="song.index"
|
:index="song.index"
|
||||||
:item="song"></mediaitem-list-item>
|
:item="song"></mediaitem-list-item>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,6 +19,10 @@
|
||||||
items: {
|
items: {
|
||||||
type: Array,
|
type: Array,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
"show-library-status": {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
|
|
|
@ -74,6 +74,9 @@
|
||||||
<div class="duration" v-if="displayDuration" @dblclick="route()">
|
<div class="duration" v-if="displayDuration" @dblclick="route()">
|
||||||
{{ msToMinSec(item.attributes.durationInMillis ?? 0) }}
|
{{ msToMinSec(item.attributes.durationInMillis ?? 0) }}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="duration" v-if="item.attributes.playCount" @dblclick="route()">
|
||||||
|
{{ item.attributes.playCount }}
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script type="text/x-template" id="replay-page">
|
<script type="text/x-template" id="replay-page">
|
||||||
<div class="content-inner replay-page">
|
<div class="content-inner replay-page">
|
||||||
<h1 class="header-text">Replay</h1>
|
<h1 class="header-text">Replay</h1>
|
||||||
<button v-for="year in years" class="md-btn md-btn-primary" @click="getReplayYear(year)">{{ year.attributes.year }}</button>
|
<button v-for="year in years" class="md-btn md-btn-primary" @click="getReplayYear(year.attributes.year)">{{ year.attributes.year }}</button>
|
||||||
|
<button class="md-btn md-btn-primary" @click="getReplayYear()">This Year</button>
|
||||||
<hr>
|
<hr>
|
||||||
<transition name="replaycard">
|
<transition name="replaycard">
|
||||||
<div class="replay-viewport" v-if="loaded.id != -1">
|
<div class="replay-viewport" v-if="loaded.id != -1">
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<mediaitem-square :item="artistData.relationships.artist.data[0]"></mediaitem-square>
|
<mediaitem-square :item="artistData.relationships.artist.data[0]"></mediaitem-square>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-footer">
|
<div class="card-footer">
|
||||||
{{ artistData.attributes.listenTimeInMinutes }}<br>
|
{{ artistData.attributes.listenTimeInMinutes }} minutes<br>
|
||||||
Listened to: {{ artistData.attributes.playCount }} times
|
Listened to: {{ artistData.attributes.playCount }} times
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<!-- Top Songs-->
|
<!-- Top Songs-->
|
||||||
<h3>Top Songs</h3>
|
<h3>Top Songs</h3>
|
||||||
<div class="well">
|
<div class="well">
|
||||||
<listitem-horizontal :items="songsToArray(loaded.views['top-songs'].data)"></listitem-horizontal>
|
<listitem-horizontal :show-library-status="false" :items="songsToArray(loaded.views['top-songs'].data)"></listitem-horizontal>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</transition>
|
</transition>
|
||||||
|
@ -79,14 +79,15 @@
|
||||||
songsToArray(songsData) {
|
songsToArray(songsData) {
|
||||||
let songs = []
|
let songs = []
|
||||||
songsData.forEach(function (songData) {
|
songsData.forEach(function (songData) {
|
||||||
songs.push(songData.relationships.song.data[0])
|
let song = songData.relationships.song.data[0]
|
||||||
|
song.attributes.playCount = songData.attributes.playCount
|
||||||
|
songs.push(song)
|
||||||
})
|
})
|
||||||
return songs
|
return songs
|
||||||
},
|
},
|
||||||
async getReplayYear(year) {
|
async getReplayYear(year = new Date().getFullYear()) {
|
||||||
this.loaded.id = -1
|
this.loaded.id = -1
|
||||||
console.log(year)
|
let response = await app.mk.api.v3.music(`/v1/me/music-summaries/year-${year}?extend=inLibrary&views=top-artists%2Ctop-albums%2Ctop-songs&include[music-summaries]=playlist&include[playlists]=tracks&includeOnly=playlist%2Ctracks%2Csong%2Cartist%2Calbum`)
|
||||||
let response = await app.mk.api.v3.music(`${year.href}?extend=inLibrary&views=top-artists%2Ctop-albums%2Ctop-songs&include[music-summaries]=playlist&include[playlists]=tracks&includeOnly=playlist%2Ctracks%2Csong%2Cartist%2Calbum`)
|
|
||||||
console.warn(response.data.data[0])
|
console.warn(response.data.data[0])
|
||||||
this.loaded = response.data.data[0]
|
this.loaded = response.data.data[0]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue