forked from platypush/platypush
[Media UI] More URI-persisted navigation items.
- `player` - `provider`
This commit is contained in:
parent
e8723eae98
commit
910304b817
2 changed files with 60 additions and 9 deletions
|
@ -37,7 +37,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { defineAsyncComponent, shallowRef } from "vue";
|
import { defineAsyncComponent, ref } from "vue";
|
||||||
import Browser from "@/components/File/Browser";
|
import Browser from "@/components/File/Browser";
|
||||||
import Loading from "@/components/Loading";
|
import Loading from "@/components/Loading";
|
||||||
import Utils from "@/Utils";
|
import Utils from "@/Utils";
|
||||||
|
@ -103,7 +103,7 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
registerMediaProvider(type) {
|
registerMediaProvider(type) {
|
||||||
const component = shallowRef(
|
const component = ref(
|
||||||
defineAsyncComponent(
|
defineAsyncComponent(
|
||||||
() => import(`@/components/panels/Media/Providers/${type}`)
|
() => import(`@/components/panels/Media/Providers/${type}`)
|
||||||
)
|
)
|
||||||
|
@ -146,9 +146,41 @@ export default {
|
||||||
this.mediaProvider = this.mediaProviders[channelMediaProvider]
|
this.mediaProvider = this.mediaProviders[channelMediaProvider]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateView() {
|
||||||
|
if (this.getUrlArgs().provider?.length) {
|
||||||
|
const provider = this.getUrlArgs().provider
|
||||||
|
const providerName = this.mediaProvidersLookup[provider.toLowerCase()]
|
||||||
|
|
||||||
|
if (!providerName?.length)
|
||||||
|
return
|
||||||
|
|
||||||
|
this.mediaProvider = this.mediaProviders[providerName]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.selectedPlaylist)
|
||||||
|
this.onPlaylistChange()
|
||||||
|
else if (this.selectedChannel)
|
||||||
|
this.onChannelChange()
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
|
mediaProvider(provider) {
|
||||||
|
if (!provider) {
|
||||||
|
this.setUrlArgs({provider: null})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const providerName = Object.entries(this.mediaProviders)
|
||||||
|
.filter((pair) => pair[1] === provider)?.[0]?.[0]?.toLowerCase()
|
||||||
|
|
||||||
|
if (!providerName?.length)
|
||||||
|
return
|
||||||
|
|
||||||
|
this.setUrlArgs({provider: providerName})
|
||||||
|
},
|
||||||
|
|
||||||
selectedPlaylist() {
|
selectedPlaylist() {
|
||||||
this.onPlaylistChange()
|
this.onPlaylistChange()
|
||||||
},
|
},
|
||||||
|
@ -160,8 +192,11 @@ export default {
|
||||||
|
|
||||||
async mounted() {
|
async mounted() {
|
||||||
await this.refreshMediaProviders()
|
await this.refreshMediaProviders()
|
||||||
this.onPlaylistChange()
|
this.updateView()
|
||||||
this.onChannelChange()
|
},
|
||||||
|
|
||||||
|
unmounted() {
|
||||||
|
this.setUrlArgs({provider: null})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -556,6 +556,14 @@ export default {
|
||||||
if (args.view) {
|
if (args.view) {
|
||||||
this.selectedView = args.view
|
this.selectedView = args.view
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.player && this.players?.length) {
|
||||||
|
this.selectedPlayer = this.players.find((player) => player.name === args.player)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.subtitles) {
|
||||||
|
this.selectedSubtitles = args.subtitles
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadStarted(event) {
|
onDownloadStarted(event) {
|
||||||
|
@ -637,21 +645,29 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
async mounted() {
|
watch: {
|
||||||
this.$watch(() => this.selectedPlayer, (player) => {
|
selectedPlayer(player) {
|
||||||
|
this.setUrlArgs({player: player?.name})
|
||||||
if (player)
|
if (player)
|
||||||
this.refresh()
|
this.refresh()
|
||||||
})
|
},
|
||||||
|
|
||||||
this.$watch(() => this.selectedSubtitles, (subs) => {
|
selectedSubtitles(subs) {
|
||||||
|
this.setUrlArgs({subtitles: this.selectedSubtitles})
|
||||||
if (new Set(['play', 'pause']).has(this.selectedPlayer?.status?.state)) {
|
if (new Set(['play', 'pause']).has(this.selectedPlayer?.status?.state)) {
|
||||||
if (subs)
|
if (subs)
|
||||||
this.selectedPlayer.component.addSubtitles(subs)
|
this.selectedPlayer.component.addSubtitles(subs)
|
||||||
else
|
else
|
||||||
this.selectedPlayer.component.removeSubtitles()
|
this.selectedPlayer.component.removeSubtitles()
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
|
||||||
|
selectedView() {
|
||||||
|
this.setUrlArgs({view: this.selectedView})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
async mounted() {
|
||||||
this.torrentPlugin = this.getTorrentPlugin()
|
this.torrentPlugin = this.getTorrentPlugin()
|
||||||
this.subscribe(this.onTorrentQueued,'on-torrent-queued',
|
this.subscribe(this.onTorrentQueued,'on-torrent-queued',
|
||||||
'platypush.message.event.torrent.TorrentQueuedEvent')
|
'platypush.message.event.torrent.TorrentQueuedEvent')
|
||||||
|
|
Loading…
Reference in a new issue