LastFM Scrobbling
This commit is contained in:
parent
df6ba93242
commit
130cfed2b4
7 changed files with 331 additions and 22 deletions
|
@ -2425,6 +2425,37 @@ const app = new Vue({
|
|||
}
|
||||
CiderContextMenu.Create(event, menus[useMenu])
|
||||
},
|
||||
LastFMDeauthorize() {
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.enabled', false).catch((e) => console.error(e));
|
||||
ipcRenderer.invoke('setStoreValue', 'lastfm.auth_token', '').catch((e) => console.error(e));
|
||||
app.cfg.lastfm.auth_token = "";
|
||||
app.cfg.lastfm.enabled = false;
|
||||
const element = document.getElementById('lfmConnect');
|
||||
element.innerHTML = 'Connect';
|
||||
element.onclick = app.LastFMAuthenticate;
|
||||
},
|
||||
LastFMAuthenticate() {
|
||||
console.log("wag")
|
||||
const element = document.getElementById('lfmConnect');
|
||||
window.open('https://www.last.fm/api/auth?api_key=174905d201451602407b428a86e8344d&cb=ame://auth/lastfm');
|
||||
element.innerText = 'Connecting...';
|
||||
|
||||
/* Just a timeout for the button */
|
||||
setTimeout(() => {
|
||||
if (element.innerText === 'Connecting...') {
|
||||
element.innerText = 'Connect';
|
||||
console.warn('[LastFM] Attempted connection timed out.');
|
||||
}
|
||||
}, 20000);
|
||||
|
||||
ipcRenderer.on('LastfmAuthenticated', function (_event, lfmAuthKey) {
|
||||
app.cfg.lastfm.auth_token = lfmAuthKey;
|
||||
app.cfg.lastfm.enabled = true;
|
||||
element.innerHTML = `Disconnect\n<p style="font-size: 8px"><i>(Authed: ${lfmAuthKey})</i></p>`;
|
||||
element.onclick = app.LastFMDeauthorize;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-line" v-show="app.cfg.general.discord_rpc != 0">
|
||||
<div class="md-option-segment">
|
||||
Clear Discord RPC on Pause
|
||||
</div>
|
||||
|
@ -407,6 +407,39 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
LastFM Scrobbling
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<label class="list-button list-element" id="lfmConnect" ref="lfmConnect"
|
||||
onclick="app.LastFMAuthenticate()">Connect</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show ="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
LastFM Scrobble Delay
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto" >
|
||||
<input type="number" v-model="app.cfg.lastfm.scrobble_after"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show ="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
Enable LastFM Now Playing
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto" >
|
||||
<input type="checkbox" v-model="app.cfg.lastfm.NowPlaying" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line" v-show ="app.cfg.lastfm.enabled">
|
||||
<div class="md-option-segment">
|
||||
Remove featuring artists from song title (LastFM)
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto" >
|
||||
<input type="checkbox" v-model="app.cfg.lastfm.enabledRemoveFeaturingArtists" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-header">
|
||||
<span>Unfinished / Non Functional</span>
|
||||
</div>
|
||||
|
@ -420,22 +453,6 @@
|
|||
<input type="checkbox" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
LastFM Scrobbling
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
LastFM Scrobble Delay
|
||||
</div>
|
||||
<div class="md-option-segment md-option-segment_auto">
|
||||
<input type="checkbox" switch/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="md-option-line">
|
||||
<div class="md-option-segment">
|
||||
Theme
|
||||
|
@ -520,6 +537,15 @@
|
|||
app: this.$root
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
if (app.cfg.lastfm.enabled){
|
||||
const element = document.getElementById('lfmConnect');
|
||||
if (element){
|
||||
element.innerHTML = `Disconnect\n<p style="font-size: 8px"><i>(Authed: ${app.cfg.lastfm.auth_token})</i></p>`;
|
||||
element.onclick = app.LastFMDeauthorize;
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue