[Media UI] Adapted media browser to the new file browser plugin.

This commit is contained in:
Fabio Manganiello 2024-08-25 00:29:26 +02:00
parent 9493445af6
commit 496dfdb50b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 40 additions and 1 deletions

View file

@ -1,9 +1,10 @@
<template> <template>
<div class="media-file-browser"> <div class="media-file-browser">
<Loading v-if="loading" /> <Loading v-if="isLoading" />
<Browser :is-media="true" <Browser :is-media="true"
:filter="filter" :filter="filter"
:has-back="true" :has-back="true"
:homepage="mediaDirs"
@back="$emit('back')" @back="$emit('back')"
@path-change="$emit('path-change', $event)" @path-change="$emit('path-change', $event)"
@play="$emit('play', $event)" @play="$emit('play', $event)"
@ -22,6 +23,40 @@ export default {
Browser, Browser,
Loading, Loading,
}, },
data() {
return {
loading_: false,
mediaDirs: {},
};
},
computed: {
isLoading() {
return this.loading_ || this.loading
},
},
methods: {
async refresh() {
this.loading_ = true
try {
this.mediaDirs = await this.request(`${this.mediaPlugin}.get_media_dirs`)
} finally {
this.loading_ = false
}
},
},
async mounted() {
const urlPath = this.getUrlArgs().path
if (urlPath) {
await this.$emit('path-change', urlPath)
}
await this.refresh()
},
} }
</script> </script>

View file

@ -27,6 +27,10 @@ export default {
default: false, default: false,
}, },
mediaPlugin: {
type: String,
},
selectedPlaylist: { selectedPlaylist: {
default: null, default: null,
}, },