From a4979f1513241687683626897799eccfea907501 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Thu, 11 Jul 2024 23:42:18 +0200 Subject: [PATCH] [Media UI] Support for playlists in search results. --- .../src/components/panels/Media/Index.vue | 11 +++++ .../src/components/panels/Media/Item.vue | 43 +++++++++++++------ .../Media/Providers/YouTube/Playlist.vue | 5 +++ .../src/components/panels/Media/Results.vue | 5 +++ 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Index.vue b/platypush/backend/http/webapp/src/components/panels/Media/Index.vue index 364a330aff..216f129da6 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Index.vue @@ -148,6 +148,7 @@ export default { selectedPlayer: null, selectedView: 'search', selectedSubtitles: null, + prevSelectedView: null, showSubtitlesModal: false, forceShowNav: false, awaitingPlayTorrent: null, @@ -394,6 +395,16 @@ export default { } else { this.selectedResult = null } + + if (this.selectedResult != null && this.results[this.selectedResult]?.item_type === 'playlist') { + if (this.prevSelectedView != this.selectedView) { + this.prevSelectedView = this.selectedView + } + + this.selectedView = 'browser' + } else { + this.selectedView = this.prevSelectedView || 'search' + } }, showPlayUrlModal() { diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Item.vue b/platypush/backend/http/webapp/src/components/panels/Media/Item.vue index 0ffceb3e60..371fcc18b8 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Item.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Item.vue @@ -3,39 +3,43 @@ class="item media-item" :class="{selected: selected}" @click.right.prevent="$refs.dropdown.toggle()" - v-if="!hidden"> - + v-if="!hidden" + >
- +
-
+
- + + v-if="item.type === 'torrent' && item.item_type !== 'channel' && item.item_type !== 'playlist'" /> + v-if="item.type === 'file' && item.item_type !== 'channel' && item.item_type !== 'playlist'" /> + v-if="item.type === 'youtube' && item.item_type !== 'channel' && item.item_type !== 'playlist'" /> - + v-if="playlist && item.item_type !== 'channel' && item.item_type !== 'playlist'" /> +
-
+ +
+ +
+
{{ formatDateTime(item.created_at, true) }}
@@ -99,6 +103,21 @@ export default { typeIcons: Icons, } }, + + methods: { + play() { + if (this.item.item_type === 'playlist') { + this.select() + return + } + + this.$emit('play'); + }, + + select() { + this.$emit('select'); + }, + }, } diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue index 4a70e42e0d..a4c8a8aa68 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlist.vue @@ -48,6 +48,11 @@ export default { type: String, default: null, }, + + playlist: { + type: Object, + default: null, + }, }, data() { diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Results.vue b/platypush/backend/http/webapp/src/components/panels/Media/Results.vue index 5d4292f46c..6c7e3eab32 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Results.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Results.vue @@ -118,6 +118,11 @@ export default { mounted() { this.$watch('selectedResult', (value) => { + if (value?.item_type === 'playlist') { + this.$emit('select', null) + return + } + if (value == null) this.$refs.infoModal?.close() else