mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-28 08:05:56 -05:00
[web-src] Use generic albums api function for all media kinds
This commit is contained in:
parent
93a170690e
commit
1d274a79bb
@ -47,7 +47,7 @@ import * as types from '@/store/mutation_types'
|
|||||||
|
|
||||||
const albumsData = {
|
const albumsData = {
|
||||||
load: function (to) {
|
load: function (to) {
|
||||||
return webapi.library_albums()
|
return webapi.library_albums('music')
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function (vm, response) {
|
set: function (vm, response) {
|
||||||
|
@ -40,7 +40,7 @@ const artistData = {
|
|||||||
load: function (to) {
|
load: function (to) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
webapi.library_artist(to.params.artist_id),
|
webapi.library_artist(to.params.artist_id),
|
||||||
webapi.library_albums(to.params.artist_id)
|
webapi.library_artist_albums(to.params.artist_id)
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ import webapi from '@/webapi'
|
|||||||
|
|
||||||
const albumsData = {
|
const albumsData = {
|
||||||
load: function (to) {
|
load: function (to) {
|
||||||
return webapi.library_audiobooks()
|
return webapi.library_albums('audiobook')
|
||||||
},
|
},
|
||||||
|
|
||||||
set: function (vm, response) {
|
set: function (vm, response) {
|
||||||
|
106
web-src/src/pages/PageAudiobooksArtists.vue
Normal file
106
web-src/src/pages/PageAudiobooksArtists.vue
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<tabs-music></tabs-music>
|
||||||
|
|
||||||
|
<content-with-heading>
|
||||||
|
<template slot="options">
|
||||||
|
<index-button-list :index="index_list"></index-button-list>
|
||||||
|
</template>
|
||||||
|
<template slot="heading-left">
|
||||||
|
<p class="title is-4">Artists</p>
|
||||||
|
<p class="heading">{{ artists.total }} artists</p>
|
||||||
|
</template>
|
||||||
|
<template slot="heading-right">
|
||||||
|
<a class="button is-small" :class="{ 'is-info': hide_singles }" @click="update_hide_singles">
|
||||||
|
<span class="icon">
|
||||||
|
<i class="mdi mdi-numeric-1-box-multiple-outline"></i>
|
||||||
|
</span>
|
||||||
|
<span>Hide singles</span>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template slot="content">
|
||||||
|
<list-item-artist v-for="artist in artists_filtered"
|
||||||
|
:key="artist.id"
|
||||||
|
:artist="artist"
|
||||||
|
@click="open_artist(artist)">
|
||||||
|
<template slot="actions">
|
||||||
|
<a @click="open_dialog(artist)">
|
||||||
|
<span class="icon has-text-dark"><i class="mdi mdi-dots-vertical mdi-18px"></i></span>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
</list-item-artist>
|
||||||
|
<modal-dialog-artist :show="show_details_modal" :artist="selected_artist" @close="show_details_modal = false" />
|
||||||
|
</template>
|
||||||
|
</content-with-heading>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
||||||
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
||||||
|
import TabsMusic from '@/components/TabsMusic'
|
||||||
|
import IndexButtonList from '@/components/IndexButtonList'
|
||||||
|
import ListItemArtist from '@/components/ListItemArtist'
|
||||||
|
import ModalDialogArtist from '@/components/ModalDialogArtist'
|
||||||
|
import webapi from '@/webapi'
|
||||||
|
import * as types from '@/store/mutation_types'
|
||||||
|
|
||||||
|
const artistsData = {
|
||||||
|
load: function (to) {
|
||||||
|
return webapi.library_artists()
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (vm, response) {
|
||||||
|
vm.artists = response.data
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PageArtists',
|
||||||
|
mixins: [LoadDataBeforeEnterMixin(artistsData)],
|
||||||
|
components: { ContentWithHeading, TabsMusic, IndexButtonList, ListItemArtist, ModalDialogArtist },
|
||||||
|
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
artists: { items: [] },
|
||||||
|
|
||||||
|
show_details_modal: false,
|
||||||
|
selected_artist: {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
hide_singles () {
|
||||||
|
return this.$store.state.hide_singles
|
||||||
|
},
|
||||||
|
|
||||||
|
index_list () {
|
||||||
|
return [...new Set(this.artists.items
|
||||||
|
.filter(artist => !this.$store.state.hide_singles || artist.track_count > (artist.album_count * 2))
|
||||||
|
.map(artist => artist.name_sort.charAt(0).toUpperCase()))]
|
||||||
|
},
|
||||||
|
|
||||||
|
artists_filtered () {
|
||||||
|
return this.artists.items.filter(artist => !this.hide_singles || artist.track_count > (artist.album_count * 2))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
update_hide_singles: function (e) {
|
||||||
|
this.$store.commit(types.HIDE_SINGLES, !this.hide_singles)
|
||||||
|
},
|
||||||
|
|
||||||
|
open_artist: function (artist) {
|
||||||
|
this.$router.push({ path: '/music/artists/' + artist.id })
|
||||||
|
},
|
||||||
|
|
||||||
|
open_dialog: function (artist) {
|
||||||
|
this.selected_artist = artist
|
||||||
|
this.show_details_modal = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
@ -101,7 +101,7 @@ import webapi from '@/webapi'
|
|||||||
const albumsData = {
|
const albumsData = {
|
||||||
load: function (to) {
|
load: function (to) {
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
webapi.library_podcasts(),
|
webapi.library_albums('podcast'),
|
||||||
webapi.library_podcasts_new_episodes()
|
webapi.library_podcasts_new_episodes()
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
@ -195,7 +195,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
reload_podcasts: function () {
|
reload_podcasts: function () {
|
||||||
webapi.library_podcasts().then(({ data }) => {
|
webapi.library_albums('podcast').then(({ data }) => {
|
||||||
this.albums = data
|
this.albums = data
|
||||||
this.reload_new_episodes()
|
this.reload_new_episodes()
|
||||||
})
|
})
|
||||||
|
@ -208,11 +208,12 @@ export default {
|
|||||||
return axios.get('/api/library/artists/' + artistId)
|
return axios.get('/api/library/artists/' + artistId)
|
||||||
},
|
},
|
||||||
|
|
||||||
library_albums (artistId) {
|
library_artist_albums (artistId) {
|
||||||
if (artistId) {
|
|
||||||
return axios.get('/api/library/artists/' + artistId + '/albums')
|
return axios.get('/api/library/artists/' + artistId + '/albums')
|
||||||
}
|
},
|
||||||
return axios.get('/api/library/albums?media_kind=music')
|
|
||||||
|
library_albums (media_kind = undefined) {
|
||||||
|
return axios.get('/api/library/albums', { params: { media_kind: media_kind } })
|
||||||
},
|
},
|
||||||
|
|
||||||
library_album (albumId) {
|
library_album (albumId) {
|
||||||
@ -278,10 +279,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
library_podcasts () {
|
|
||||||
return axios.get('/api/library/albums?media_kind=podcast')
|
|
||||||
},
|
|
||||||
|
|
||||||
library_podcasts_new_episodes () {
|
library_podcasts_new_episodes () {
|
||||||
var episodesParams = {
|
var episodesParams = {
|
||||||
type: 'tracks',
|
type: 'tracks',
|
||||||
@ -310,10 +307,6 @@ export default {
|
|||||||
return axios.delete('/api/library/playlists/' + playlistId, undefined)
|
return axios.delete('/api/library/playlists/' + playlistId, undefined)
|
||||||
},
|
},
|
||||||
|
|
||||||
library_audiobooks () {
|
|
||||||
return axios.get('/api/library/albums?media_kind=audiobook')
|
|
||||||
},
|
|
||||||
|
|
||||||
library_playlists () {
|
library_playlists () {
|
||||||
return axios.get('/api/library/playlists')
|
return axios.get('/api/library/playlists')
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user