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 {join} from "path";
|
||||||
import { app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen } from "electron";
|
import {app, BrowserWindow as bw, ipcMain, ShareMenu, shell, screen, dialog} from "electron";
|
||||||
import * as windowStateKeeper from "electron-window-state";
|
import * as windowStateKeeper from "electron-window-state";
|
||||||
import * as express from "express";
|
import * as express from "express";
|
||||||
import * as getPort from "get-port";
|
import * as getPort from "get-port";
|
||||||
|
@ -122,6 +122,7 @@ export class BrowserWindow {
|
||||||
"components/fullscreen",
|
"components/fullscreen",
|
||||||
"components/miniplayer",
|
"components/miniplayer",
|
||||||
"components/castmenu",
|
"components/castmenu",
|
||||||
|
"components/pathmenu",
|
||||||
"components/airplay-modal",
|
"components/airplay-modal",
|
||||||
"components/artist-chip",
|
"components/artist-chip",
|
||||||
"components/hello-world",
|
"components/hello-world",
|
||||||
|
@ -1256,7 +1257,7 @@ export class BrowserWindow {
|
||||||
"copyright": metadata.common.copyright ?? "",
|
"copyright": metadata.common.copyright ?? "",
|
||||||
"assetUrl": "file:///" +audio,
|
"assetUrl": "file:///" +audio,
|
||||||
"contentAdvisory": "",
|
"contentAdvisory": "",
|
||||||
"releaseDateTime": "2022-05-13T00:23:00Z",
|
"releaseDateTime": `${metadata?.common?.year ?? '2022'}-05-13T00:23:00Z`,
|
||||||
"durationInMillis": Math.floor((metadata.format.duration?? 0) * 1000),
|
"durationInMillis": Math.floor((metadata.format.duration?? 0) * 1000),
|
||||||
|
|
||||||
"offers": [
|
"offers": [
|
||||||
|
@ -1268,24 +1269,6 @@ export class BrowserWindow {
|
||||||
"contentRating": "clean"
|
"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({
|
metadatalistart.push({
|
||||||
id : "ciderlocal" + numid,
|
id : "ciderlocal" + numid,
|
||||||
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
url: metadata.common.picture != undefined ? metadata.common.picture[0].data.toString('base64') : "",
|
||||||
|
@ -1497,10 +1480,17 @@ export class BrowserWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('open-appdata', (_event) => {
|
ipcMain.on('open-appdata', (_event) => {
|
||||||
shell.openPath(app.getPath('userData'));
|
shell.openPath(app.getPath('userData'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('folderSelector', async (_event) => {
|
||||||
|
let u = await dialog.showOpenDialog({
|
||||||
|
properties: ['openDirectory','multiSelections']
|
||||||
|
});
|
||||||
|
return u.filePaths
|
||||||
|
});
|
||||||
|
|
||||||
//#region Cider Connect
|
//#region Cider Connect
|
||||||
ipcMain.on('cc-auth', (_event) => {
|
ipcMain.on('cc-auth', (_event) => {
|
||||||
|
|
|
@ -155,6 +155,7 @@ export class Store {
|
||||||
"sortOrder": "asc",
|
"sortOrder": "asc",
|
||||||
"viewAs": "covers"
|
"viewAs": "covers"
|
||||||
},
|
},
|
||||||
|
"localPaths": []
|
||||||
},
|
},
|
||||||
"audio": {
|
"audio": {
|
||||||
"volume": 1,
|
"volume": 1,
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
"components/fullscreen",
|
"components/fullscreen",
|
||||||
"components/miniplayer",
|
"components/miniplayer",
|
||||||
"components/castmenu",
|
"components/castmenu",
|
||||||
|
"components/pathmenu",
|
||||||
"components/airplay-modal",
|
"components/airplay-modal",
|
||||||
"components/artist-chip",
|
"components/artist-chip",
|
||||||
"components/hello-world",
|
"components/hello-world",
|
||||||
|
|
|
@ -216,6 +216,7 @@ const app = new Vue({
|
||||||
audioPlaybackRate: false,
|
audioPlaybackRate: false,
|
||||||
showPlaylist: false,
|
showPlaylist: false,
|
||||||
castMenu: false,
|
castMenu: false,
|
||||||
|
pathMenu: false,
|
||||||
moreInfo: false,
|
moreInfo: false,
|
||||||
airplayPW: false,
|
airplayPW: false,
|
||||||
settings: false
|
settings: false
|
||||||
|
@ -858,7 +859,7 @@ const app = new Vue({
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcRenderer.on('getUpdatedLocalList', (event, data) => {
|
ipcRenderer.on('getUpdatedLocalList', (event, data) => {
|
||||||
console.log("cider-local", data);
|
// console.log("cider-local", data);
|
||||||
this.library.localsongs = data;
|
this.library.localsongs = data;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1072,6 +1073,8 @@ const app = new Vue({
|
||||||
if (this.cfg.general.themeUpdateNotification && !this.isDev) {
|
if (this.cfg.general.themeUpdateNotification && !this.isDev) {
|
||||||
this.checkForThemeUpdates()
|
this.checkForThemeUpdates()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipcRenderer.send("scanLibrary",app.cfg.libraryPrefs.localPaths)
|
||||||
},
|
},
|
||||||
showFoo(querySelector, time) {
|
showFoo(querySelector, time) {
|
||||||
clearTimeout(this.idleTimer);
|
clearTimeout(this.idleTimer);
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
<transition name="modal">
|
<transition name="modal">
|
||||||
<castmenu v-if="modals.castMenu"></castmenu>
|
<castmenu v-if="modals.castMenu"></castmenu>
|
||||||
</transition>
|
</transition>
|
||||||
|
<transition name="modal">
|
||||||
|
<pathmenu v-if="modals.pathMenu"></pathmenu>
|
||||||
|
</transition>
|
||||||
<transition name="modal">
|
<transition name="modal">
|
||||||
<airplay-modal v-if="modals.airplayPW"></airplay-modal>
|
<airplay-modal v-if="modals.airplayPW"></airplay-modal>
|
||||||
</transition>
|
</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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</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-line">
|
||||||
<div class="md-option-segment">
|
<div class="md-option-segment">
|
||||||
{{$root.getLz('settings.option.experimental.reinstallwidevine')}}
|
{{$root.getLz('settings.option.experimental.reinstallwidevine')}}
|
||||||
|
@ -1523,6 +1532,9 @@
|
||||||
},
|
},
|
||||||
filterChange(e) {
|
filterChange(e) {
|
||||||
this.$root.cfg.connectivity.lastfm.filter_types[e.target.value] = e.target.checked;
|
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