This commit is contained in:
vapormusic 2022-06-26 08:02:19 +07:00
parent 0014999586
commit ae0fbbc1d3
7 changed files with 98 additions and 23 deletions

View file

@ -216,6 +216,7 @@ const app = new Vue({
audioPlaybackRate: false,
showPlaylist: false,
castMenu: false,
pathMenu: false,
moreInfo: false,
airplayPW: false,
settings: false
@ -858,7 +859,7 @@ const app = new Vue({
})
ipcRenderer.on('getUpdatedLocalList', (event, data) => {
console.log("cider-local", data);
// console.log("cider-local", data);
this.library.localsongs = data;
})
@ -1072,6 +1073,8 @@ const app = new Vue({
if (this.cfg.general.themeUpdateNotification && !this.isDev) {
this.checkForThemeUpdates()
}
ipcRenderer.send("scanLibrary",app.cfg.libraryPrefs.localPaths)
},
showFoo(querySelector, time) {
clearTimeout(this.idleTimer);

View file

@ -25,6 +25,9 @@
<transition name="modal">
<castmenu v-if="modals.castMenu"></castmenu>
</transition>
<transition name="modal">
<pathmenu v-if="modals.pathMenu"></pathmenu>
</transition>
<transition name="modal">
<airplay-modal v-if="modals.airplayPW"></airplay-modal>
</transition>

View file

@ -0,0 +1,65 @@
<script type="text/x-template" id="pathmenu">
<div class="spatialproperties-panel castmenu pathmenu modal-fullscreen" @click.self="close()" @contextmenu.self="close()">
<div class="modal-window">
<div class="modal-header">
<div class="modal-title">{{'Edit Paths'}}</div>
<button class="close-btn" @click="close()" :aria-label="$root.getLz('action.close')"></button>
</div>
<div class="modal-content">
<template v-for="folder of folders">
<div class="md-option-line">
<div class="md-option-segment">
{{folder}}
</div>
<div class="md-option-segment md-option-segment_auto">
<button class="md-btn" @click="remove(folder)">
{{'Remove'}}
</button>
</div>
</div>
</template>
<div class="md-option-line">
<div class="md-option-segment md-option-segment_auto">
<button class="md-btn" @click="add()">
{{'Add Path'}}
</button>
</div>
</div>
</div>
</div>
</div>
</script>
<script>
Vue.component('pathmenu', {
template: '#pathmenu',
data: function () {
return {
folders: [],
}
},
mounted() {
this.folders = this.$root.cfg.libraryPrefs.localPaths;
},
watch:{},
methods: {
close() {
this.$root.modals.pathMenu = false
},
async add(){
const result = await ipcRenderer.invoke('folderSelector')
for (i of result){
if (this.folders.findIndex(x => x.startsWith(i)) == -1){
this.folders.push(i)
}
}
this.$root.cfg.libraryPrefs.localPaths = this.folders;
ipcRenderer.send("scanLibrary",app.cfg.libraryPrefs.localPaths)
},
remove(dir){
this.folders = this.folders.filter(item => item !== dir)
this.$root.cfg.libraryPrefs.localPaths = this.folders;
ipcRenderer.send("scanLibrary",app.cfg.libraryPrefs.localPaths)
}
}
});
</script>

View file

@ -1147,7 +1147,16 @@
</button>
</div>
</div>
<div class="md-option-line">
<div class="md-option-segment">
{{'Local Songs'}}
</div>
<div class="md-option-segment md-option-segment_auto">
<button class="md-btn" @click="openLocalSongsPathMenu">
{{'Edit Paths'}}
</button>
</div>
</div>
<div class="md-option-line">
<div class="md-option-segment">
{{$root.getLz('settings.option.experimental.reinstallwidevine')}}
@ -1523,6 +1532,9 @@
},
filterChange(e) {
this.$root.cfg.connectivity.lastfm.filter_types[e.target.value] = e.target.checked;
},
openLocalSongsPathMenu() {
app.modals.pathMenu = true
}
}
})