forked from platypush/platypush
[Media UI] Support for playlists in search results.
This commit is contained in:
parent
ded64e8dc2
commit
a4979f1513
4 changed files with 52 additions and 12 deletions
|
@ -148,6 +148,7 @@ export default {
|
||||||
selectedPlayer: null,
|
selectedPlayer: null,
|
||||||
selectedView: 'search',
|
selectedView: 'search',
|
||||||
selectedSubtitles: null,
|
selectedSubtitles: null,
|
||||||
|
prevSelectedView: null,
|
||||||
showSubtitlesModal: false,
|
showSubtitlesModal: false,
|
||||||
forceShowNav: false,
|
forceShowNav: false,
|
||||||
awaitingPlayTorrent: null,
|
awaitingPlayTorrent: null,
|
||||||
|
@ -394,6 +395,16 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.selectedResult = null
|
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() {
|
showPlayUrlModal() {
|
||||||
|
|
|
@ -3,39 +3,43 @@
|
||||||
class="item media-item"
|
class="item media-item"
|
||||||
:class="{selected: selected}"
|
:class="{selected: selected}"
|
||||||
@click.right.prevent="$refs.dropdown.toggle()"
|
@click.right.prevent="$refs.dropdown.toggle()"
|
||||||
v-if="!hidden">
|
v-if="!hidden"
|
||||||
|
>
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<MediaImage :item="item" @play="$emit('play')" />
|
<MediaImage :item="item" @play="play" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="body">
|
<div class="body">
|
||||||
<div class="row title">
|
<div class="row title">
|
||||||
<div class="col-11 left side" v-text="item.title" @click="$emit('select')" />
|
<div class="col-11 left side" v-text="item.title || item.name" @click="select" />
|
||||||
<div class="col-1 right side">
|
<div class="col-1 right side">
|
||||||
<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" @click="$emit('play')"
|
<DropdownItem icon-class="fa fa-play" text="Play" @click="play"
|
||||||
v-if="item.type !== 'torrent'" />
|
v-if="item.type !== 'torrent' && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
|
||||||
<DropdownItem icon-class="fa fa-download" text="Download" @click="$emit('download')"
|
<DropdownItem icon-class="fa fa-download" text="Download" @click="$emit('download')"
|
||||||
v-if="item.type === 'torrent'" />
|
v-if="item.type === 'torrent' && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
|
||||||
<DropdownItem icon-class="fa fa-window-maximize" text="View in browser" @click="$emit('view')"
|
<DropdownItem icon-class="fa fa-window-maximize" text="View in browser" @click="$emit('view')"
|
||||||
v-if="item.type === 'file'" />
|
v-if="item.type === 'file' && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
|
||||||
<DropdownItem icon-class="fa fa-list" text="Add to playlist" @click="$emit('add-to-playlist')"
|
<DropdownItem icon-class="fa fa-list" text="Add to playlist" @click="$emit('add-to-playlist')"
|
||||||
v-if="item.type === 'youtube'" />
|
v-if="item.type === 'youtube' && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
|
||||||
<DropdownItem icon-class="fa fa-trash" text="Remove from playlist" @click="$refs.confirmPlaylistRemove.open()"
|
<DropdownItem icon-class="fa fa-trash" text="Remove from playlist" @click="$refs.confirmPlaylistRemove.open()"
|
||||||
v-if="playlist" />
|
v-if="playlist && item.item_type !== 'channel' && item.item_type !== 'playlist'" />
|
||||||
<DropdownItem icon-class="fa fa-info-circle" text="Info" @click="$emit('select')" />
|
<DropdownItem icon-class="fa fa-info-circle" text="Info" @click="select" />
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row subtitle" v-if="item.channel">
|
<div class="row subtitle" v-if="item.channel_url">
|
||||||
<a class="channel" :href="item.channel_url" target="_blank">
|
<a class="channel" :href="item.channel_url" target="_blank">
|
||||||
<img :src="item.channel_image" class="channel-image" v-if="item.channel_image" />
|
<img :src="item.channel_image" class="channel-image" v-if="item.channel_image" />
|
||||||
<span class="channel-name" v-text="item.channel" />
|
<span class="channel-name" v-text="item.channel" />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row subtitle" v-if="item.item_type && item.item_type !== 'video'">
|
||||||
|
<span class="type" v-text="item.item_type[0].toUpperCase() + item.item_type.slice(1)" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row creation-date" v-if="item.created_at">
|
<div class="row creation-date" v-if="item.created_at">
|
||||||
{{ formatDateTime(item.created_at, true) }}
|
{{ formatDateTime(item.created_at, true) }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -99,6 +103,21 @@ export default {
|
||||||
typeIcons: Icons,
|
typeIcons: Icons,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
play() {
|
||||||
|
if (this.item.item_type === 'playlist') {
|
||||||
|
this.select()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$emit('play');
|
||||||
|
},
|
||||||
|
|
||||||
|
select() {
|
||||||
|
this.$emit('select');
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,11 @@ export default {
|
||||||
type: String,
|
type: String,
|
||||||
default: null,
|
default: null,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
playlist: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -118,6 +118,11 @@ export default {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$watch('selectedResult', (value) => {
|
this.$watch('selectedResult', (value) => {
|
||||||
|
if (value?.item_type === 'playlist') {
|
||||||
|
this.$emit('select', null)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (value == null)
|
if (value == null)
|
||||||
this.$refs.infoModal?.close()
|
this.$refs.infoModal?.close()
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue