Added some settings

This commit is contained in:
booploops 2021-12-24 23:46:39 -08:00
parent cbb6824ff4
commit 489340f237
8 changed files with 114 additions and 103 deletions

View file

@ -6,7 +6,6 @@ const ElectronSentry = require("@sentry/electron");
ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" }); ElectronSentry.init({ dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214" });
// Enable WebGPU and list adapters (EXPERIMENTAL.) // Enable WebGPU and list adapters (EXPERIMENTAL.)
app.commandLine.appendSwitch('enable-unsafe-webgpu');
const configSchema = { const configSchema = {
"general": { "general": {
@ -15,9 +14,6 @@ const configSchema = {
"discord_rpc": 1, // 0 = disabled, 1 = enabled as Cider, 2 = enabled as Apple Music "discord_rpc": 1, // 0 = disabled, 1 = enabled as Cider, 2 = enabled as Apple Music
"volume": 1 "volume": 1
}, },
"behavior": {
"hw_acceleration": 0 // 0 = default, 1 = webgpu, 2 = gpu disabled
},
"audio": { "audio": {
"quality": "extreme", "quality": "extreme",
"seamless_audio": true "seamless_audio": true
@ -26,7 +22,9 @@ const configSchema = {
"theme": "", "theme": "",
"scrollbars": 0, // 0 = show on hover, 2 = always hide, 3 = always show "scrollbars": 0, // 0 = show on hover, 2 = always hide, 3 = always show
"refresh_rate": 0, "refresh_rate": 0,
"animated_artwork": 0 // 0 = always, 1 = limited, 2 = never "animated_artwork": "always", // 0 = always, 1 = limited, 2 = never
"hw_acceleration": "default", // default, webgpu, disabled
"window_transparency": "default"
}, },
"lyrics": { "lyrics": {
"enable_mxm": false, "enable_mxm": false,
@ -50,6 +48,22 @@ function CreateWindow() {
defaults: configSchema, defaults: configSchema,
}); });
switch (app.cfg.get("visual.hw_acceleration")) {
default:
case "default":
break;
case "webgpu":
console.info("WebGPU is enabled.");
app.commandLine.appendSwitch('enable-unsafe-webgpu');
break;
case "disabled":
console.info("Hardware acceleration is disabled.");
app.commandLine.appendSwitch('disable-gpu')
break;
}
/** CIDER **/ /** CIDER **/
const ciderwin = require("./src/main/cider-base") const ciderwin = require("./src/main/cider-base")
app.win = ciderwin app.win = ciderwin

View file

@ -9,81 +9,6 @@ const Store = require("electron-store");
const store = new Store(); const store = new Store();
const yt = require('youtube-search-without-api-key'); const yt = require('youtube-search-without-api-key');
const schema = {
"general": {
"close_behavior": {
type: "number",
default: 0
},
"startup_behavior": {
type: "number",
default: 0
},
"discord_rpc": {
type: "number",
default: 1
},
},
"behavior": {
"hw_acceleration": {
type: "number",
default: 0 // 0 = default, 1 = webgpu, 2 = gpu disabled
}
},
"audio": {
"quality": {
type: "string",
default: "extreme",
},
"seamless_audio": {
type: "boolean",
default: true,
}
},
"visual": {
"theme": {
type: "string",
default: ""
},
"scrollbars": {
type: "number",
default: 0
},
"refresh_rate": {
type: "number",
default: 0
},
"animated_artwork": {
type: "number",
default: 0 // 0 = always, 1 = limited, 2 = never
}
},
"lyrics": {
"enable_mxm": {
type: "boolean",
default: false
},
"mxm_language": {
type: "string",
default: "en"
}
},
"lastfm": {
"enabled": {
type: "boolean",
default: false
},
"scrobble_after": {
type: "number",
default: 30
},
"auth_token": {
type: "string",
default: ""
}
}
}
// Analytics for debugging. // Analytics for debugging.
const ElectronSentry = require("@sentry/electron"); const ElectronSentry = require("@sentry/electron");
ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"}); ElectronSentry.init({dsn: "https://68c422bfaaf44dea880b86aad5a820d2@o954055.ingest.sentry.io/6112214"});
@ -127,7 +52,6 @@ const CiderBase = {
contextIsolation: false, contextIsolation: false,
preload: join(__dirname, '../preload/cider-preload.js') preload: join(__dirname, '../preload/cider-preload.js')
} }
} }
CiderBase.InitWebServer() CiderBase.InitWebServer()

View file

@ -269,6 +269,19 @@ const app = new Vue({
}, },
}, },
methods: { methods: {
getHTMLStyle() {
switch(this.cfg.visual.window_transparency) {
case "acrylic":
default:
document.querySelector("html").style.background = "";
document.querySelector("body").style.background = "";
break;
case "disabled":
document.querySelector("html").style.background = "#222";
document.querySelector("body").style.background = "#222";
break;
}
},
resetState() { resetState() {
app.selectedMediaItems = []; app.selectedMediaItems = [];
for (let key in app.modals) { for (let key in app.modals) {
@ -2306,6 +2319,8 @@ function refreshFocus() {
setTimeout(refreshFocus, 200); setTimeout(refreshFocus, 200);
} }
app.getHTMLStyle()
refreshFocus(); refreshFocus();
function xmlToJson(xml) { function xmlToJson(xml) {

View file

@ -9,10 +9,27 @@
<script> <script>
Vue.component('animatedartwork-view', { Vue.component('animatedartwork-view', {
template: '#animatedartwork-view', template: '#animatedartwork-view',
props: ['video', 'hls'], props: {
video: {
type: String,
required: true
},
hls: {
type: Object,
default: ''
},
priority: {
type: Boolean,
default: false
}
},
async mounted() { async mounted() {
if(!this.priority && app.cfg.visual.animated_artwork == "limited") {
return
}else if(app.cfg.visual.animated_artwork == "disabled") {
return
}
if (this.video) { if (this.video) {
this.$nextTick(function () { this.$nextTick(function () {
var config = { var config = {
backBufferLength: 0, backBufferLength: 0,
@ -21,7 +38,6 @@
emeEnabled: false, emeEnabled: false,
abrEwmaDefaultEstimate: 10000, abrEwmaDefaultEstimate: 10000,
testBandwidth: false, testBandwidth: false,
capLevelToPlayerSize: true
}; };
if (this.hls) { if (this.hls) {
this.hls.detachMedia(); this.hls.detachMedia();

View file

@ -12,8 +12,8 @@
<img :src="app.getMediaItemArtwork(url, size, width)" <img :src="app.getMediaItemArtwork(url, size, width)"
decoding="async" decoding="async"
class="mediaitem-artwork--img"> class="mediaitem-artwork--img">
<div v-if="video && isVisible" class="animatedartwork-view-box"> <div v-if="video && isVisible && getVideoPriority()" class="animatedartwork-view-box">
<animatedartwork-view :video="video"></animatedartwork-view> <animatedartwork-view :priority="getVideoPriority()" :video="video"></animatedartwork-view>
</div> </div>
</div> </div>
</template> </template>
@ -43,6 +43,10 @@
type: String, type: String,
required: false required: false
}, },
videoPriority: {
type: Boolean,
required: false
},
shadow: { shadow: {
type: String, type: String,
default: 'none' default: 'none'
@ -57,6 +61,16 @@
} }
}, },
methods: { methods: {
getVideoPriority() {
if(app.cfg.visual.animated_artwork == "always") {
return true;
}else if (this.videoPriority && app.cfg.visual.animated_artwork == "limited") {
return true
} else if (app.cfg.visual.animated_artwork == "disabled") {
return false
}
return this.videoPriority
},
getStyle() { getStyle() {
switch (this.shadow) { switch (this.shadow) {
case "large": case "large":

View file

@ -2,6 +2,7 @@
<div class="content-inner artist-page"> <div class="content-inner artist-page">
<div class="artist-header" :style="getArtistPalette(data)" :key="data.id"> <div class="artist-header" :style="getArtistPalette(data)" :key="data.id">
<animatedartwork-view <animatedartwork-view
:priority="true"
v-if="data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9)" v-if="data.attributes.editorialVideo && (data.attributes.editorialVideo.motionArtistWide16x9 || data.attributes.editorialVideo.motionArtistFullscreen16x9)"
:video="data.attributes.editorialVideo.motionArtistWide16x9.video ?? (data.attributes.editorialVideo.motionArtistFullscreen16x9.video ?? '')"> :video="data.attributes.editorialVideo.motionArtistWide16x9.video ?? (data.attributes.editorialVideo.motionArtistFullscreen16x9.video ?? '')">
</animatedartwork-view> </animatedartwork-view>

View file

@ -13,6 +13,7 @@
<div class="col-auto flex-center"> <div class="col-auto flex-center">
<div style="width: 260px;height:260px;"> <div style="width: 260px;height:260px;">
<mediaitem-artwork <mediaitem-artwork
:video-priority="true"
:url="(data.attributes != null && data.attributes.artwork && data.attributes.artwork != null) ? data.attributes.artwork.url : ((data.relationships != null && data.relationships.tracks.data.length > 0) ? data.relationships.tracks.data[0].attributes.artwork.url ?? '':'')" :url="(data.attributes != null && data.attributes.artwork && data.attributes.artwork != null) ? data.attributes.artwork.url : ((data.relationships != null && data.relationships.tracks.data.length > 0) ? data.relationships.tracks.data[0].attributes.artwork.url ?? '':'')"
:video="(data.attributes != null && data.attributes.editorialVideo != null) ? (data.attributes.editorialVideo.motionDetailSquare ? data.attributes.editorialVideo.motionDetailSquare.video : (data.attributes.editorialVideo.motionSquareVideo1x1 ? data.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' " :video="(data.attributes != null && data.attributes.editorialVideo != null) ? (data.attributes.editorialVideo.motionDetailSquare ? data.attributes.editorialVideo.motionDetailSquare.video : (data.attributes.editorialVideo.motionSquareVideo1x1 ? data.attributes.editorialVideo.motionSquareVideo1x1.video : '')) : '' "
size="260" size="260"

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="cider-settings"> <script type="text/x-template" id="cider-settings">
<div class="content-inner settings-page"> <div class="content-inner settings-page">
<h1 class="header-text">Settings <small>(non functional, stay tuned)</small></h1> <h1 class="header-text">Settings <small>(WIP)</small></h1>
<div class="md-option-container"> <div class="md-option-container">
<div class="md-option-line"> <div class="md-option-line">
<div class="md-option-segment"> <div class="md-option-segment">
@ -8,9 +8,10 @@
</div> </div>
<div class="md-option-segment md-option-segment_auto"> <div class="md-option-segment md-option-segment_auto">
<select class="md-select" style="width:180px;"> <select class="md-select" style="width:180px;">
<option value="990">Extreme</option> <option value="extreme">Extreme</option>
<option value="256">High</option> <option value="high">High</option>
<option value="64">Low</option> <option value="low">Low</option>
<option value="auto">Auto</option>
</select> </select>
</div> </div>
</div> </div>
@ -19,7 +20,7 @@
Seamless Audio Transitions Seamless Audio Transitions
</div> </div>
<div class="md-option-segment md-option-segment_auto"> <div class="md-option-segment md-option-segment_auto">
<input type="checkbox" switch/> <input type="checkbox" v-model="app.cfg.audio.seamless_audio" switch/>
</div> </div>
</div> </div>
<div class="md-option-line"> <div class="md-option-line">
@ -27,10 +28,10 @@
Animated Artwork Animated Artwork
</div> </div>
<div class="md-option-segment md-option-segment_auto"> <div class="md-option-segment md-option-segment_auto">
<select class="md-select"> <select class="md-select" v-model="app.cfg.visual.animated_artwork">
<option value="0">Always</option> <option value="always">Always</option>
<option value="1">Limit to pages and special entries</option> <option value="limited">Limit to pages and special entries</option>
<option value="2">Disable Everywhere</option> <option value="disabled">Disable Everywhere</option>
</select> </select>
</div> </div>
</div> </div>
@ -39,7 +40,7 @@
Discord Rich Presence Discord Rich Presence
</div> </div>
<div class="md-option-segment md-option-segment_auto"> <div class="md-option-segment md-option-segment_auto">
<select class="md-select"> <select class="md-select" v-model="app.cfg.general.discord_rpc">
<option value="0">Disabled</option> <option value="0">Disabled</option>
<option value="1">Display as 'Cider'</option> <option value="1">Display as 'Cider'</option>
<option value="2">Display as 'Apple Music'</option> <option value="2">Display as 'Apple Music'</option>
@ -72,6 +73,31 @@
<input type="checkbox" switch/> <input type="checkbox" switch/>
</div> </div>
</div> </div>
<div class="md-option-line">
<div class="md-option-segment">
Hardware Acceleration<br>
<small>(Requires relaunch)</small>
</div>
<div class="md-option-segment md-option-segment_auto">
<select class="md-select" style="width:180px;" v-model="app.cfg.behavior.hw_acceleration">
<option value="default">Default</option>
<option value="webgpu">WebGPU</option>
<option value="disabled">Disabled</option>
</select>
</div>
</div>
<div class="md-option-line">
<div class="md-option-segment">
Window Transparency
</div>
<div class="md-option-segment md-option-segment_auto">
<select class="md-select" style="width:180px;" v-model="app.cfg.visual.window_transparency" @change="app.getHTMLStyle()">
<option value="default">Default</option>
<option value="acrylic" v-if="app.platform == 'win32'">Acrylic</option>
<option value="disabled">Disabled</option>
</select>
</div>
</div>
<div class="md-option-line"> <div class="md-option-line">
<div class="md-option-segment"> <div class="md-option-segment">
Theme Theme