[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.
This commit is contained in:
Fabio Manganiello 2024-08-25 00:27:49 +02:00
parent 0657c80a5c
commit 9493445af6
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
11 changed files with 41 additions and 25 deletions

View file

@ -22,6 +22,7 @@
:is="mediaProvider" :is="mediaProvider"
:filter="filter" :filter="filter"
:loading="loading" :loading="loading"
:media-plugin="mediaPlugin"
:selected-playlist="selectedPlaylist" :selected-playlist="selectedPlaylist"
:selected-channel="selectedChannel" :selected-channel="selectedChannel"
@add-to-playlist="$emit('add-to-playlist', $event)" @add-to-playlist="$emit('add-to-playlist', $event)"
@ -30,7 +31,7 @@
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@path-change="$emit('path-change', $event)" @path-change="$emit('path-change', $event)"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
/> />
</div> </div>
</div> </div>
@ -53,7 +54,7 @@ export default {
'download-audio', 'download-audio',
'path-change', 'path-change',
'play', 'play',
'play-cache', 'play-with-opts',
'remove-from-playlist', 'remove-from-playlist',
'remove-playlist', 'remove-playlist',
'rename-playlist', 'rename-playlist',
@ -69,6 +70,10 @@ export default {
default: '', default: '',
}, },
mediaPlugin: {
type: String,
},
selectedPlaylist: { selectedPlaylist: {
type: Object, type: Object,
}, },

View file

@ -59,7 +59,7 @@
@open-channel="selectChannelFromItem" @open-channel="selectChannelFromItem"
@select="onResultSelect($event)" @select="onResultSelect($event)"
@play="play" @play="play"
@play-cache="play($event, {cache: true})" @play-with-opts="play($event.item, $event.opts)"
@view="view" @view="view"
@download="download" @download="download"
@download-audio="downloadAudio" @download-audio="downloadAudio"
@ -81,6 +81,7 @@
<Browser :filter="browserFilter" <Browser :filter="browserFilter"
:loading="loading" :loading="loading"
:media-plugin="pluginName"
:selected-playlist="selectedPlaylist" :selected-playlist="selectedPlaylist"
:selected-channel="selectedChannel" :selected-channel="selectedChannel"
@add-to-playlist="addToPlaylistItem = $event" @add-to-playlist="addToPlaylistItem = $event"
@ -89,7 +90,7 @@
@download-audio="downloadAudio" @download-audio="downloadAudio"
@path-change="browserFilter = ''" @path-change="browserFilter = ''"
@play="play($event)" @play="play($event)"
@play-cache="play($event, {cache: true})" @play-with-opts="play($event.item, $event.opts)"
v-else-if="selectedView === 'browser'" v-else-if="selectedView === 'browser'"
/> />
</div> </div>
@ -133,7 +134,7 @@
@download-audio="downloadAudio" @download-audio="downloadAudio"
@open-channel="selectChannelFromItem" @open-channel="selectChannelFromItem"
@play="play" @play="play"
@play-cache="play($event, {cache: true})" @play-with-opts="play($event.item, $event.opts)"
/> />
</Modal> </Modal>
</div> </div>

View file

@ -6,7 +6,7 @@
@add-to-playlist="$emit('add-to-playlist', item)" @add-to-playlist="$emit('add-to-playlist', item)"
@open-channel="$emit('open-channel', item)" @open-channel="$emit('open-channel', item)"
@play="$emit('play', item)" @play="$emit('play', item)"
@play-cache="$emit('play-cache', item)" @play-with-opts="$emit('play-with-opts', $event)"
@download="$emit('download', item)" @download="$emit('download', item)"
@download-audio="$emit('download-audio', item)" @download-audio="$emit('download-audio', item)"
/> />
@ -191,7 +191,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
], ],
props: { props: {
item: { item: {

View file

@ -15,7 +15,8 @@
<Dropdown title="Actions" icon-class="fa fa-ellipsis-h" ref="dropdown"> <Dropdown title="Actions" icon-class="fa fa-ellipsis-h" ref="dropdown">
<DropdownItem icon-class="fa fa-play" text="Play" @input="$emit('play')" <DropdownItem icon-class="fa fa-play" text="Play" @input="$emit('play')"
v-if="item.type !== 'torrent'" /> v-if="item.type !== 'torrent'" />
<DropdownItem icon-class="fa fa-play" text="Play (With Cache)" @input="$emit('play-cache')" <DropdownItem icon-class="fa fa-play" text="Play (With Cache)"
@input="$emit('play-with-opts', {item: item, opts: {cache: true}})"
v-if="item.type === 'youtube'" /> v-if="item.type === 'youtube'" />
<DropdownItem icon-class="fa fa-download" text="Download" @input="$emit('download')" <DropdownItem icon-class="fa fa-download" text="Download" @input="$emit('download')"
v-if="(item.type === 'torrent' || item.type === 'youtube') && item.item_type !== 'channel' && item.item_type !== 'playlist'" /> v-if="(item.type === 'torrent' || item.type === 'youtube') && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
@ -62,7 +63,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
'remove-from-playlist', 'remove-from-playlist',
'select', 'select',
'view', 'view',

View file

@ -14,7 +14,7 @@
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@open-channel="selectChannelFromItem" @open-channel="selectChannelFromItem"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
v-if="selectedView === 'feed'" v-if="selectedView === 'feed'"
/> />
@ -26,7 +26,7 @@
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@open-channel="selectChannelFromItem" @open-channel="selectChannelFromItem"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
@remove-from-playlist="removeFromPlaylist" @remove-from-playlist="removeFromPlaylist"
@select="onPlaylistSelected" @select="onPlaylistSelected"
v-else-if="selectedView === 'playlists'" v-else-if="selectedView === 'playlists'"
@ -39,7 +39,7 @@
@download="$emit('download', $event)" @download="$emit('download', $event)"
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
@select="onChannelSelected" @select="onChannelSelected"
v-else-if="selectedView === 'subscriptions'" v-else-if="selectedView === 'subscriptions'"
/> />
@ -73,6 +73,15 @@ export default {
Subscriptions, Subscriptions,
}, },
emits: [
'add-to-playlist',
'back',
'download',
'download-audio',
'play',
'play-with-opts',
],
data() { data() {
return { return {
youtubeConfig: null, youtubeConfig: null,

View file

@ -51,7 +51,7 @@
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@open-channel="$emit('open-channel', $event)" @open-channel="$emit('open-channel', $event)"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
@scroll-end="loadNextPage" @scroll-end="loadNextPage"
@select="selectedResult = $event" @select="selectedResult = $event"
/> />
@ -72,7 +72,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
], ],
components: { components: {

View file

@ -15,7 +15,7 @@
@open-channel="$emit('open-channel', $event)" @open-channel="$emit('open-channel', $event)"
@select="selectedResult = $event" @select="selectedResult = $event"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
v-else /> v-else />
</div> </div>
</template> </template>
@ -34,7 +34,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
], ],
components: { components: {

View file

@ -54,7 +54,7 @@
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@open-channel="$emit('open-channel', $event)" @open-channel="$emit('open-channel', $event)"
@play="$emit('play', $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)" @remove-from-playlist="$emit('remove-from-playlist', $event)"
@select="selectedResult = $event" @select="selectedResult = $event"
v-else /> v-else />
@ -76,7 +76,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
'remove-from-playlist', 'remove-from-playlist',
], ],

View file

@ -36,7 +36,7 @@
@open-channel="$emit('open-channel', $event)" @open-channel="$emit('open-channel', $event)"
@remove-from-playlist="$emit('remove-from-playlist', {item: $event, playlist_id: selectedPlaylist.id})" @remove-from-playlist="$emit('remove-from-playlist', {item: $event, playlist_id: selectedPlaylist.id})"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
/> />
</div> </div>
@ -118,7 +118,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
'remove-from-playlist', 'remove-from-playlist',
'remove-playlist', 'remove-playlist',
'rename-playlist', 'rename-playlist',

View file

@ -27,7 +27,7 @@
@download="$emit('download', $event)" @download="$emit('download', $event)"
@download-audio="$emit('download-audio', $event)" @download-audio="$emit('download-audio', $event)"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@play-cache="$emit('play-cache', $event)" @play-with-opts="$emit('play-with-opts', $event)"
/> />
</div> </div>
</div> </div>
@ -46,7 +46,7 @@ export default {
'download', 'download',
'download-audio', 'download-audio',
'play', 'play',
'play-cache', 'play-with-opts',
'select', 'select',
], ],

View file

@ -13,7 +13,7 @@
@remove-from-playlist="$emit('remove-from-playlist', item)" @remove-from-playlist="$emit('remove-from-playlist', item)"
@select="$emit('select', i)" @select="$emit('select', i)"
@play="$emit('play', item)" @play="$emit('play', item)"
@play-cache="$emit('play-cache', item)" @play-with-opts="$emit('play-with-opts', $event)"
@view="$emit('view', item)" @view="$emit('view', item)"
@download="$emit('download', item)" @download="$emit('download', item)"
@download-audio="$emit('download-audio', item)" @download-audio="$emit('download-audio', item)"
@ -28,7 +28,7 @@
@download-audio="$emit('download-audio', results[selectedResult])" @download-audio="$emit('download-audio', results[selectedResult])"
@open-channel="$emit('open-channel', results[selectedResult])" @open-channel="$emit('open-channel', results[selectedResult])"
@play="$emit('play', 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" /> v-if="selectedResult != null" />
</Modal> </Modal>
</div> </div>
@ -48,7 +48,7 @@ export default {
'download-audio', 'download-audio',
'open-channel', 'open-channel',
'play', 'play',
'play-cache', 'play-with-opts',
'remove-from-playlist', 'remove-from-playlist',
'scroll-end', 'scroll-end',
'select', 'select',