worki v1
This commit is contained in:
parent
0014999586
commit
ae0fbbc1d3
7 changed files with 98 additions and 23 deletions
|
@ -1,5 +1,5 @@
|
|||
import { join } from "path";
|
||||
import { app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen } from "electron";
|
||||
import {join} from "path";
|
||||
import {app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen, dialog} from "electron";
|
||||
import * as windowStateKeeper from "electron-window-state";
|
||||
import * as express from "express";
|
||||
import * as getPort from "get-port";
|
||||
|
@ -122,6 +122,7 @@ export class BrowserWindow {
|
|||
"components/fullscreen",
|
||||
"components/miniplayer",
|
||||
"components/castmenu",
|
||||
"components/pathmenu",
|
||||
"components/airplay-modal",
|
||||
"components/artist-chip",
|
||||
"components/hello-world",
|
||||
|
@ -1256,7 +1257,7 @@ export class BrowserWindow {
|
|||
"copyright": metadata.common.copyright ?? "",
|
||||
"assetUrl": "file:///" +audio,
|
||||
"contentAdvisory": "",
|
||||
"releaseDateTime": "2022-05-13T00:23:00Z",
|
||||
"releaseDateTime": `${metadata?.common?.year ?? '2022'}-05-13T00:23:00Z`,
|
||||
"durationInMillis": Math.floor((metadata.format.duration?? 0) * 1000),
|
||||
|
||||
"offers": [
|
||||
|
@ -1268,24 +1269,6 @@ export class BrowserWindow {
|
|||
"contentRating": "clean"
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// let form = {"id": "/ciderlocal?" + audio,
|
||||
// "type": "library-songs",
|
||||
// "href": "/ciderlocal?" + audio,
|
||||
// "artwork": {
|
||||
// "url": metadata.common.picture != undefined ? "data:image/png;base64,"+metadata.common.picture[0].data.toString('base64')+"" : "",
|
||||
// },
|
||||
// "attributes":
|
||||
// { "durationInMillis": Math.floor((metadata.format.duration?? 0) * 1000),
|
||||
// "hasLyrics": false,
|
||||
// "playParams": { "id": "/ciderlocal?" + audio, "kind": "song", "isLibrary": true, "reporting": false },
|
||||
// "trackNumber": 0,
|
||||
// "discNumber": 0,
|
||||
// "genreNames": [""],
|
||||
// "name": metadata.common.title,
|
||||
// "albumName": metadata.common.album,
|
||||
// "artistName": metadata.common.artist}}
|
||||
metadatalistart.push({
|
||||
id : "ciderlocal" + numid,
|
||||
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
||||
|
@ -1497,10 +1480,17 @@ export class BrowserWindow {
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
ipcMain.on('open-appdata', (_event) => {
|
||||
shell.openPath(app.getPath('userData'));
|
||||
});
|
||||
|
||||
ipcMain.handle('folderSelector', async (_event) => {
|
||||
let u = await dialog.showOpenDialog({
|
||||
properties: ['openDirectory','multiSelections']
|
||||
});
|
||||
return u.filePaths
|
||||
});
|
||||
|
||||
//#region Cider Connect
|
||||
ipcMain.on('cc-auth', (_event) => {
|
||||
|
|
|
@ -155,6 +155,7 @@ export class Store {
|
|||
"sortOrder": "asc",
|
||||
"viewAs": "covers"
|
||||
},
|
||||
"localPaths": []
|
||||
},
|
||||
"audio": {
|
||||
"volume": 1,
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
"components/fullscreen",
|
||||
"components/miniplayer",
|
||||
"components/castmenu",
|
||||
"components/pathmenu",
|
||||
"components/airplay-modal",
|
||||
"components/artist-chip",
|
||||
"components/hello-world",
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
65
src/renderer/views/components/pathmenu.ejs
Normal file
65
src/renderer/views/components/pathmenu.ejs
Normal 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>
|
|
@ -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
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue