mirror of
https://github.com/owntone/owntone-server.git
synced 2025-07-14 19:31:55 -04:00
[web-src] dedicated 'genre tracks' page
This commit is contained in:
parent
95b1cfc70b
commit
69c73e249d
@ -5,7 +5,7 @@
|
|||||||
<content-with-heading>
|
<content-with-heading>
|
||||||
<template slot="heading-left">
|
<template slot="heading-left">
|
||||||
<p class="title is-4">{{ name }}</p>
|
<p class="title is-4">{{ name }}</p>
|
||||||
<p class="heading">{{ genreAlbums.total }} albums</p>
|
<p class="heading">{{ genreAlbums.total }} albums | <a class="has-text-link" @click="open_tracks">{{ tracks }} tracks</a></p>
|
||||||
</template>
|
</template>
|
||||||
<template slot="heading-right">
|
<template slot="heading-right">
|
||||||
<a class="button is-small is-dark is-rounded" @click="play">
|
<a class="button is-small is-dark is-rounded" @click="play">
|
||||||
@ -65,6 +65,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
open_tracks: function () {
|
||||||
|
this.show_details_modal = false
|
||||||
|
this.$router.push({ path: '/music/genres/' + this.name + '/tracks' })
|
||||||
|
},
|
||||||
|
|
||||||
play: function () {
|
play: function () {
|
||||||
webapi.player_play_uri(this.genreAlbums.items.map(a => a.uri).join(','), true)
|
webapi.player_play_uri(this.genreAlbums.items.map(a => a.uri).join(','), true)
|
||||||
}
|
}
|
||||||
|
65
web-src/src/pages/PageGenreTracks.vue
Normal file
65
web-src/src/pages/PageGenreTracks.vue
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<content-with-heading>
|
||||||
|
<template slot="heading-left">
|
||||||
|
<p class="title is-4">{{ genre }}</p>
|
||||||
|
<p class="heading">{{ tracks.total }} tracks</p>
|
||||||
|
</template>
|
||||||
|
<template slot="heading-right">
|
||||||
|
<a class="button is-small is-dark is-rounded" @click="play">
|
||||||
|
<span class="icon"><i class="mdi mdi-shuffle"></i></span> <span>Shuffle</span>
|
||||||
|
</a>
|
||||||
|
</template>
|
||||||
|
<template slot="content">
|
||||||
|
<p class="heading has-text-centered-mobile"><a class="has-text-link" @click="open_genre">albums</a> | tracks</p>
|
||||||
|
<list-item-track v-for="(track, index) in tracks.items" :key="track.id" :track="track" :position="index" :context_uri="track.uri" :links="links"></list-item-track>
|
||||||
|
</template>
|
||||||
|
</content-with-heading>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { LoadDataBeforeEnterMixin } from './mixin'
|
||||||
|
import ContentWithHeading from '@/templates/ContentWithHeading'
|
||||||
|
import ListItemTrack from '@/components/ListItemTrack'
|
||||||
|
import webapi from '@/webapi'
|
||||||
|
|
||||||
|
const tracksData = {
|
||||||
|
load: function (to) {
|
||||||
|
return webapi.library_genre_tracks(to.params.genre)
|
||||||
|
},
|
||||||
|
|
||||||
|
set: function (vm, response) {
|
||||||
|
vm.genre = vm.$route.params.genre
|
||||||
|
vm.tracks = response.data.tracks
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'PageGenreTracks',
|
||||||
|
mixins: [ LoadDataBeforeEnterMixin(tracksData) ],
|
||||||
|
components: { ContentWithHeading, ListItemTrack },
|
||||||
|
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
tracks: {},
|
||||||
|
genre: '',
|
||||||
|
links: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
open_genre: function () {
|
||||||
|
this.show_details_modal = false
|
||||||
|
this.$router.push({ path: '/music/genres/' + this.genre })
|
||||||
|
},
|
||||||
|
|
||||||
|
play: function () {
|
||||||
|
webapi.player_play_uri(this.tracks.items.map(a => a.uri).join(','), true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
</style>
|
@ -13,6 +13,7 @@ import PageAlbums from '@/pages/PageAlbums'
|
|||||||
import PageAlbum from '@/pages/PageAlbum'
|
import PageAlbum from '@/pages/PageAlbum'
|
||||||
import PageGenres from '@/pages/PageGenres'
|
import PageGenres from '@/pages/PageGenres'
|
||||||
import PageGenre from '@/pages/PageGenre'
|
import PageGenre from '@/pages/PageGenre'
|
||||||
|
import PageGenreTracks from '@/pages/PageGenreTracks'
|
||||||
import PageTracks from '@/pages/PageTracks'
|
import PageTracks from '@/pages/PageTracks'
|
||||||
import PagePodcasts from '@/pages/PagePodcasts'
|
import PagePodcasts from '@/pages/PagePodcasts'
|
||||||
import PagePodcast from '@/pages/PagePodcast'
|
import PagePodcast from '@/pages/PagePodcast'
|
||||||
@ -113,6 +114,12 @@ export const router = new VueRouter({
|
|||||||
component: PageGenre,
|
component: PageGenre,
|
||||||
meta: { show_progress: true }
|
meta: { show_progress: true }
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/music/genres/:genre/tracks',
|
||||||
|
name: 'GenreTracks',
|
||||||
|
component: PageGenreTracks,
|
||||||
|
meta: { show_progress: true }
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/podcasts',
|
path: '/podcasts',
|
||||||
name: 'Podcasts',
|
name: 'Podcasts',
|
||||||
|
@ -163,6 +163,17 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
library_genre_tracks (genre) {
|
||||||
|
var genreParams = {
|
||||||
|
'type': 'tracks',
|
||||||
|
'media_kind': 'music',
|
||||||
|
'expression': 'genre is "' + genre + '"'
|
||||||
|
}
|
||||||
|
return axios.get('/api/search', {
|
||||||
|
params: genreParams
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
library_artist_tracks (artist) {
|
library_artist_tracks (artist) {
|
||||||
if (artist) {
|
if (artist) {
|
||||||
var artistParams = {
|
var artistParams = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user