[web-src] Add buttons to mark podcast track as new/played

This commit is contained in:
chme 2019-01-29 17:50:47 +01:00
parent 78ca795814
commit 52d685d6be
4 changed files with 30 additions and 6 deletions

View File

@ -132,13 +132,17 @@ export default {
},
mark_new: function () {
this.$emit('close')
// TODO
webapi.library_track_update(this.track.id, { 'play_count': 'reset' }).then(() => {
this.$emit('play_count_changed')
this.$emit('close')
})
},
mark_played: function () {
this.$emit('close')
// TODO
webapi.library_track_update(this.track.id, { 'play_count': 'increment' }).then(() => {
this.$emit('play_count_changed')
this.$emit('close')
})
}
}
}

View File

@ -20,7 +20,7 @@
</a>
</template>
</list-item-track>
<modal-dialog-track :show="show_details_modal" :track="selected_track" @close="show_details_modal = false" />
<modal-dialog-track :show="show_details_modal" :track="selected_track" @close="show_details_modal = false" @play_count_changed="reload_tracks" />
</template>
</content-with-heading>
</template>
@ -73,6 +73,12 @@ export default {
open_dialog: function (track) {
this.selected_track = track
this.show_details_modal = true
},
reload_tracks: function () {
webapi.library_podcast_episodes(this.album.id).then(({ data }) => {
this.tracks = data.tracks.items
})
}
}
}

View File

@ -12,7 +12,7 @@
</a>
</template>
</list-item-track>
<modal-dialog-track :show="show_track_details_modal" :track="selected_track" @close="show_track_details_modal = false" />
<modal-dialog-track :show="show_track_details_modal" :track="selected_track" @close="show_track_details_modal = false" @play_count_changed="reload_new_episodes" />
</template>
</content-with-heading>
@ -93,6 +93,12 @@ export default {
open_album_dialog: function (album) {
this.selected_album = album
this.show_album_details_modal = true
},
reload_new_episodes: function () {
webapi.library_podcasts_new_episodes().then(({ data }) => {
this.new_episodes = data.tracks
})
}
}
}

View File

@ -238,6 +238,14 @@ export default {
return axios.get('/api/library/playlists/' + playlistId + '/tracks')
},
library_track (trackId) {
return axios.get('/api/library/tracks/' + trackId)
},
library_track_update (trackId, attributes = {}) {
return axios.put('/api/library/tracks/' + trackId, undefined, { params: attributes })
},
library_files (directory = undefined) {
var filesParams = { 'directory': directory }
return axios.get('/api/library/files', {