From a264efe2bbf82aac38a02e617f89ca63047793df Mon Sep 17 00:00:00 2001
From: Alain Nussbaumer
Date: Mon, 24 Jul 2023 19:51:00 +0200
Subject: [PATCH] [web] Fix genre not being displayed correctly depending on
the media kind
The genre is not displayed depending on the media kind and not only for the "music" kind.
---
web-src/src/components/ListArtists.vue | 22 ++----
web-src/src/components/ListGenres.vue | 16 ++---
web-src/src/components/ModalDialogGenre.vue | 25 ++++---
.../src/components/ModalDialogQueueItem.vue | 9 +--
web-src/src/components/ModalDialogTrack.vue | 5 +-
web-src/src/components/TabsAudiobooks.vue | 12 ++++
web-src/src/locales/de.json | 3 +-
web-src/src/locales/en.json | 3 +-
web-src/src/locales/fr.json | 3 +-
web-src/src/locales/zh.json | 3 +-
web-src/src/pages/PageAudiobooksGenres.vue | 72 +++++++++++++++++++
...PageGenreAlbum.vue => PageGenreAlbums.vue} | 27 +++----
web-src/src/pages/PageGenreTracks.vue | 17 +++--
web-src/src/pages/PageGenres.vue | 8 +--
web-src/src/router/index.js | 23 +++---
web-src/src/webapi/index.js | 18 ++---
16 files changed, 179 insertions(+), 87 deletions(-)
create mode 100644 web-src/src/pages/PageAudiobooksGenres.vue
rename web-src/src/pages/{PageGenreAlbum.vue => PageGenreAlbums.vue} (85%)
diff --git a/web-src/src/components/ListArtists.vue b/web-src/src/components/ListArtists.vue
index 94e39479..e4c76080 100644
--- a/web-src/src/components/ListArtists.vue
+++ b/web-src/src/components/ListArtists.vue
@@ -26,9 +26,8 @@
@@ -41,7 +40,7 @@ export default {
name: 'ListArtists',
components: { ModalDialogArtist },
- props: ['artists', 'media_kind', 'hide_group_title'],
+ props: ['artists', 'hide_group_title'],
data() {
return {
@@ -50,23 +49,12 @@ export default {
}
},
- computed: {
- media_kind_resolved() {
- return this.media_kind ? this.media_kind : this.selected_artist.media_kind
- }
- },
-
methods: {
open_artist(artist) {
this.selected_artist = artist
- if (this.media_kind_resolved === 'audiobook') {
- this.$router.push({
- name: 'audiobooks-artist',
- params: { id: artist.id }
- })
- } else {
- this.$router.push({ name: 'music-artist', params: { id: artist.id } })
- }
+ const route =
+ artist.media_kind === 'audiobook' ? 'audiobooks-artist' : 'music-artist'
+ this.$router.push({ name: route, params: { id: artist.id } })
},
open_dialog(artist) {
diff --git a/web-src/src/components/ListGenres.vue b/web-src/src/components/ListGenres.vue
index d247f4ea..7f121710 100644
--- a/web-src/src/components/ListGenres.vue
+++ b/web-src/src/components/ListGenres.vue
@@ -28,6 +28,7 @@
@@ -40,7 +41,7 @@ export default {
name: 'ListGenres',
components: { ModalDialogGenre },
- props: ['genres', 'media_kind', 'hide_group_title'],
+ props: ['genres', 'hide_group_title', 'media_kind'],
data() {
return {
@@ -49,17 +50,14 @@ export default {
}
},
- computed: {
- media_kind_resolved() {
- return this.media_kind ? this.media_kind : this.selected_genre.media_kind
- }
- },
-
methods: {
open_genre(genre) {
- this.$router.push({ name: 'music-genre', params: { name: genre.name } })
+ this.$router.push({
+ name: 'genre-albums',
+ params: { name: genre.name },
+ query: { media_kind: this.media_kind }
+ })
},
-
open_dialog(genre) {
this.selected_genre = genre
this.show_details_modal = true
diff --git a/web-src/src/components/ModalDialogGenre.vue b/web-src/src/components/ModalDialogGenre.vue
index c7b5c82b..619343ce 100644
--- a/web-src/src/components/ModalDialogGenre.vue
+++ b/web-src/src/components/ModalDialogGenre.vue
@@ -62,37 +62,36 @@ import webapi from '@/webapi'
export default {
name: 'ModalDialogGenre',
- props: ['show', 'genre'],
+ props: ['genre', 'media_kind', 'show'],
emits: ['close'],
+ computed: {
+ expression() {
+ return `genre is "${this.genre.name}" and media_kind is ${this.media_kind}`
+ }
+ },
methods: {
play() {
this.$emit('close')
- webapi.player_play_expression(
- 'genre is "' + this.genre.name + '" and media_kind is music',
- false
- )
+ webapi.player_play_expression(this.expression, false)
},
queue_add() {
this.$emit('close')
- webapi.queue_expression_add(
- 'genre is "' + this.genre.name + '" and media_kind is music'
- )
+ webapi.queue_expression_add(this.expression)
},
queue_add_next() {
this.$emit('close')
- webapi.queue_expression_add_next(
- 'genre is "' + this.genre.name + '" and media_kind is music'
- )
+ webapi.queue_expression_add_next(this.expression)
},
open_genre() {
this.$emit('close')
this.$router.push({
- name: 'music-genre',
- params: { name: this.genre.name }
+ name: 'genre-albums',
+ params: { name: this.genre.name },
+ query: { media_kind: this.media_kind }
})
}
}
diff --git a/web-src/src/components/ModalDialogQueueItem.vue b/web-src/src/components/ModalDialogQueueItem.vue
index aac021f2..02a7590d 100644
--- a/web-src/src/components/ModalDialogQueueItem.vue
+++ b/web-src/src/components/ModalDialogQueueItem.vue
@@ -208,12 +208,12 @@ export default {
},
open_album() {
- if (this.media_kind === 'podcast') {
+ if (this.item.media_kind === 'podcast') {
this.$router.push({
name: 'podcast',
params: { id: this.item.album_id }
})
- } else if (this.media_kind === 'audiobook') {
+ } else if (this.item.media_kind === 'audiobook') {
this.$router.push({
name: 'audiobooks-album',
params: { id: this.item.album_id }
@@ -235,8 +235,9 @@ export default {
open_genre() {
this.$router.push({
- name: 'music-genre',
- params: { name: this.item.genre }
+ name: 'genre-albums',
+ params: { name: this.item.genre },
+ query: { media_kind: this.item.media_kind }
})
},
diff --git a/web-src/src/components/ModalDialogTrack.vue b/web-src/src/components/ModalDialogTrack.vue
index 20ce0714..a8bab9d8 100644
--- a/web-src/src/components/ModalDialogTrack.vue
+++ b/web-src/src/components/ModalDialogTrack.vue
@@ -270,8 +270,9 @@ export default {
open_genre() {
this.$router.push({
- name: 'music-genre',
- params: { name: this.track.genre }
+ name: 'genre-albums',
+ params: { name: this.track.genre },
+ query: { media_kind: this.track.media_kind }
})
},
diff --git a/web-src/src/components/TabsAudiobooks.vue b/web-src/src/components/TabsAudiobooks.vue
index ccad1d9a..90921b64 100644
--- a/web-src/src/components/TabsAudiobooks.vue
+++ b/web-src/src/components/TabsAudiobooks.vue
@@ -33,6 +33,18 @@
+
+
+
+
+
+
+
+
diff --git a/web-src/src/locales/de.json b/web-src/src/locales/de.json
index 35cca4cc..50a300fe 100644
--- a/web-src/src/locales/de.json
+++ b/web-src/src/locales/de.json
@@ -313,7 +313,8 @@
},
"tabs": {
"authors": "Autoren",
- "audiobooks": "Hörbücher"
+ "audiobooks": "Hörbücher",
+ "genres": "Genres"
}
},
"browse": {
diff --git a/web-src/src/locales/en.json b/web-src/src/locales/en.json
index 7b3edc09..90c655c0 100644
--- a/web-src/src/locales/en.json
+++ b/web-src/src/locales/en.json
@@ -313,7 +313,8 @@
},
"tabs": {
"authors": "Authors",
- "audiobooks": "Audiobooks"
+ "audiobooks": "Audiobooks",
+ "genres": "Genres"
}
},
"browse": {
diff --git a/web-src/src/locales/fr.json b/web-src/src/locales/fr.json
index ddfcefe7..7b06e3e5 100644
--- a/web-src/src/locales/fr.json
+++ b/web-src/src/locales/fr.json
@@ -313,7 +313,8 @@
},
"tabs": {
"authors": "Auteurs",
- "audiobooks": "Livres audio"
+ "audiobooks": "Livres audio",
+ "genres": "Genres"
}
},
"browse": {
diff --git a/web-src/src/locales/zh.json b/web-src/src/locales/zh.json
index e6792f4e..5b4df730 100644
--- a/web-src/src/locales/zh.json
+++ b/web-src/src/locales/zh.json
@@ -313,7 +313,8 @@
},
"tabs": {
"authors": "作者",
- "audiobooks": "有声读物"
+ "audiobooks": "有声读物",
+ "genres": "流派"
}
},
"browse": {
diff --git a/web-src/src/pages/PageAudiobooksGenres.vue b/web-src/src/pages/PageAudiobooksGenres.vue
new file mode 100644
index 00000000..1c9c8c18
--- /dev/null
+++ b/web-src/src/pages/PageAudiobooksGenres.vue
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web-src/src/pages/PageGenreAlbum.vue b/web-src/src/pages/PageGenreAlbums.vue
similarity index 85%
rename from web-src/src/pages/PageGenreAlbum.vue
rename to web-src/src/pages/PageGenreAlbums.vue
index 9048bfa2..0c512439 100644
--- a/web-src/src/pages/PageGenreAlbum.vue
+++ b/web-src/src/pages/PageGenreAlbums.vue
@@ -35,8 +35,9 @@
@@ -45,8 +46,8 @@