From 9493445af6e76d55acd97ebb1649ea4d94809b00 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sun, 25 Aug 2024 00:27:49 +0200 Subject: [PATCH] [Media UI] Renamed `play-cache` event to `play-with-opts`. As we're likely to add more play options in the future, this approach is much more scalable. --- .../src/components/panels/Media/Browser.vue | 9 +++++++-- .../webapp/src/components/panels/Media/Index.vue | 7 ++++--- .../webapp/src/components/panels/Media/Info.vue | 4 ++-- .../webapp/src/components/panels/Media/Item.vue | 5 +++-- .../components/panels/Media/Providers/YouTube.vue | 15 ++++++++++++--- .../panels/Media/Providers/YouTube/Channel.vue | 4 ++-- .../panels/Media/Providers/YouTube/Feed.vue | 4 ++-- .../panels/Media/Providers/YouTube/Playlist.vue | 4 ++-- .../panels/Media/Providers/YouTube/Playlists.vue | 4 ++-- .../Media/Providers/YouTube/Subscriptions.vue | 4 ++-- .../src/components/panels/Media/Results.vue | 6 +++--- 11 files changed, 41 insertions(+), 25 deletions(-) diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue b/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue index 9ae28c776f..57df3bd44b 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Browser.vue @@ -22,6 +22,7 @@ :is="mediaProvider" :filter="filter" :loading="loading" + :media-plugin="mediaPlugin" :selected-playlist="selectedPlaylist" :selected-channel="selectedChannel" @add-to-playlist="$emit('add-to-playlist', $event)" @@ -30,7 +31,7 @@ @download-audio="$emit('download-audio', $event)" @path-change="$emit('path-change', $event)" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" /> @@ -53,7 +54,7 @@ export default { 'download-audio', 'path-change', 'play', - 'play-cache', + 'play-with-opts', 'remove-from-playlist', 'remove-playlist', 'rename-playlist', @@ -69,6 +70,10 @@ export default { default: '', }, + mediaPlugin: { + type: String, + }, + selectedPlaylist: { type: Object, }, 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 0e9c0b6e05..f74729dc73 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Index.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Index.vue @@ -59,7 +59,7 @@ @open-channel="selectChannelFromItem" @select="onResultSelect($event)" @play="play" - @play-cache="play($event, {cache: true})" + @play-with-opts="play($event.item, $event.opts)" @view="view" @download="download" @download-audio="downloadAudio" @@ -81,6 +81,7 @@ @@ -133,7 +134,7 @@ @download-audio="downloadAudio" @open-channel="selectChannelFromItem" @play="play" - @play-cache="play($event, {cache: true})" + @play-with-opts="play($event.item, $event.opts)" /> diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Info.vue b/platypush/backend/http/webapp/src/components/panels/Media/Info.vue index 720e1ab780..575ef3226a 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Info.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Info.vue @@ -6,7 +6,7 @@ @add-to-playlist="$emit('add-to-playlist', item)" @open-channel="$emit('open-channel', item)" @play="$emit('play', item)" - @play-cache="$emit('play-cache', item)" + @play-with-opts="$emit('play-with-opts', $event)" @download="$emit('download', item)" @download-audio="$emit('download-audio', item)" /> @@ -191,7 +191,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', ], props: { item: { 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 e3f5f7b042..0bd0574b08 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Item.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Item.vue @@ -15,7 +15,8 @@ - @@ -62,7 +63,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', 'remove-from-playlist', 'select', 'view', diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube.vue index 4f1c52ba1b..7700379233 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube.vue @@ -14,7 +14,7 @@ @download-audio="$emit('download-audio', $event)" @open-channel="selectChannelFromItem" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" v-if="selectedView === 'feed'" /> @@ -26,7 +26,7 @@ @download-audio="$emit('download-audio', $event)" @open-channel="selectChannelFromItem" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" @remove-from-playlist="removeFromPlaylist" @select="onPlaylistSelected" v-else-if="selectedView === 'playlists'" @@ -39,7 +39,7 @@ @download="$emit('download', $event)" @download-audio="$emit('download-audio', $event)" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" @select="onChannelSelected" v-else-if="selectedView === 'subscriptions'" /> @@ -73,6 +73,15 @@ export default { Subscriptions, }, + emits: [ + 'add-to-playlist', + 'back', + 'download', + 'download-audio', + 'play', + 'play-with-opts', + ], + data() { return { youtubeConfig: null, diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Channel.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Channel.vue index 51f05fcf56..90a7665a42 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Channel.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Channel.vue @@ -51,7 +51,7 @@ @download-audio="$emit('download-audio', $event)" @open-channel="$emit('open-channel', $event)" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" @scroll-end="loadNextPage" @select="selectedResult = $event" /> @@ -72,7 +72,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', ], components: { diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue index 7cba694be4..fee2435238 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Feed.vue @@ -15,7 +15,7 @@ @open-channel="$emit('open-channel', $event)" @select="selectedResult = $event" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" v-else /> @@ -34,7 +34,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', ], components: { 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 1062f486d8..6deb447a7e 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 @@ -54,7 +54,7 @@ @download-audio="$emit('download-audio', $event)" @open-channel="$emit('open-channel', $event)" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" @remove-from-playlist="$emit('remove-from-playlist', $event)" @select="selectedResult = $event" v-else /> @@ -76,7 +76,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', 'remove-from-playlist', ], diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlists.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlists.vue index 2150869c84..2698158269 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlists.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Playlists.vue @@ -36,7 +36,7 @@ @open-channel="$emit('open-channel', $event)" @remove-from-playlist="$emit('remove-from-playlist', {item: $event, playlist_id: selectedPlaylist.id})" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" /> @@ -118,7 +118,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', 'remove-from-playlist', 'remove-playlist', 'rename-playlist', diff --git a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Subscriptions.vue b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Subscriptions.vue index 8bb0f5504d..361673d335 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Subscriptions.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Providers/YouTube/Subscriptions.vue @@ -27,7 +27,7 @@ @download="$emit('download', $event)" @download-audio="$emit('download-audio', $event)" @play="$emit('play', $event)" - @play-cache="$emit('play-cache', $event)" + @play-with-opts="$emit('play-with-opts', $event)" /> @@ -46,7 +46,7 @@ export default { 'download', 'download-audio', 'play', - 'play-cache', + 'play-with-opts', 'select', ], 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 fd81d35d84..32036754a9 100644 --- a/platypush/backend/http/webapp/src/components/panels/Media/Results.vue +++ b/platypush/backend/http/webapp/src/components/panels/Media/Results.vue @@ -13,7 +13,7 @@ @remove-from-playlist="$emit('remove-from-playlist', item)" @select="$emit('select', i)" @play="$emit('play', item)" - @play-cache="$emit('play-cache', item)" + @play-with-opts="$emit('play-with-opts', $event)" @view="$emit('view', item)" @download="$emit('download', item)" @download-audio="$emit('download-audio', item)" @@ -28,7 +28,7 @@ @download-audio="$emit('download-audio', results[selectedResult])" @open-channel="$emit('open-channel', results[selectedResult])" @play="$emit('play', results[selectedResult])" - @play-cache="$emit('play-cache', results[selectedResult])" + @play-with-opts="$emit('play-with-opts', {...$event, item: results[selectedResult]})" v-if="selectedResult != null" /> @@ -48,7 +48,7 @@ export default { 'download-audio', 'open-channel', 'play', - 'play-cache', + 'play-with-opts', 'remove-from-playlist', 'scroll-end', 'select',