Merge remote-tracking branch 'origin/upcoming' into upcoming
This commit is contained in:
commit
ff1c347aa8
27 changed files with 1150 additions and 144 deletions
|
@ -27,7 +27,7 @@ export class ConfigStore {
|
|||
"volume": 1,
|
||||
"lastVolume": 1,
|
||||
"muted": false,
|
||||
"quality": "990",
|
||||
"quality": "256",
|
||||
"seamless_audio": true,
|
||||
"normalization": false,
|
||||
"spatial": false,
|
||||
|
@ -51,16 +51,9 @@ export class ConfigStore {
|
|||
}
|
||||
},
|
||||
"equalizer": {
|
||||
'60' : 0,
|
||||
'170': 0 ,
|
||||
'310': 0 ,
|
||||
'600': 0 ,
|
||||
'1000': 0 ,
|
||||
'3000': 0 ,
|
||||
'6000': 0 ,
|
||||
'12000': 0 ,
|
||||
'14000': 0 ,
|
||||
'16000': 0 ,
|
||||
'frequencies': [32, 63, 125, 250, 500, 1000, 2000, 4000, 8000, 16000],
|
||||
'gain': [0,0,0,0,0,0,0,0,0,0],
|
||||
'Q' : [1,1,1,1,1,1,1,1,1,1]
|
||||
}
|
||||
},
|
||||
"visual": {
|
||||
|
@ -86,6 +79,7 @@ export class ConfigStore {
|
|||
"scrobble_after": 30,
|
||||
"auth_token": "",
|
||||
"enabledRemoveFeaturingArtists": true,
|
||||
"filterLoop": true,
|
||||
"NowPlaying": "true"
|
||||
},
|
||||
"advanced": {
|
||||
|
|
|
@ -27,7 +27,7 @@ export default class sendSongToTitlebar {
|
|||
* @param attributes Music Attributes (attributes.state = current state)
|
||||
*/
|
||||
onPlaybackStateDidChange(attributes: any): void {
|
||||
this._win.win.setTitle(`${(attributes != null && attributes.name != null && attributes.name.length > 0) ? (attributes.name + " - ") : ''}Cider`)
|
||||
this._win.setTitle(`${(attributes != null && attributes.name != null && attributes.name.length > 0) ? (attributes.name + " - ") : ''}Cider`)
|
||||
}
|
||||
/**
|
||||
* Runs on song change
|
||||
|
|
|
@ -191,7 +191,7 @@ export default class LastFMPlugin {
|
|||
this._store.lastfm.enabled = true;
|
||||
this._store.lastfm.auth_token = authKey;
|
||||
console.log(authKey);
|
||||
this._win.win.webContents.send('LastfmAuthenticated', authKey);
|
||||
this._win.webContents.send('LastfmAuthenticated', authKey);
|
||||
this.authenticate();
|
||||
}
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ export default class LastFMPlugin {
|
|||
const authKey = authURI.split('lastfm?token=')[1];
|
||||
this._store.lastfm.enabled = true;
|
||||
this._store.lastfm.auth_token = authKey;
|
||||
this._win.win.webContents.send('LastfmAuthenticated', authKey);
|
||||
this._win.webContents.send('LastfmAuthenticated', authKey);
|
||||
console.log(authKey);
|
||||
this.authenticate();
|
||||
}
|
||||
|
@ -243,6 +243,9 @@ export default class LastFMPlugin {
|
|||
* @param attributes Music Attributes
|
||||
*/
|
||||
onNowPlayingItemDidChange(attributes: object): void {
|
||||
if (!this._store.lastfm.filterLoop){
|
||||
this._lastfm.cachedNowPlayingAttributes = false;
|
||||
this._lastfm.cachedAttributes = false}
|
||||
this.scrobbleSong(attributes)
|
||||
this.updateNowPlayingSong(attributes)
|
||||
}
|
||||
|
|
149
src/main/plugins/minimizeToTray.ts
Normal file
149
src/main/plugins/minimizeToTray.ts
Normal file
|
@ -0,0 +1,149 @@
|
|||
import * as electron from 'electron';
|
||||
import * as path from 'path';
|
||||
|
||||
|
||||
export default class MinimizeToTray {
|
||||
/**
|
||||
* Private variables for interaction in plugins
|
||||
*/
|
||||
private _win: any;
|
||||
private _app: any;
|
||||
private _store: any;
|
||||
private _tray: any;
|
||||
|
||||
/**
|
||||
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
||||
*/
|
||||
public name: string = 'Minimize to tray';
|
||||
public description: string = 'Allow Cider to minimize to tray';
|
||||
public version: string = '1.0.0';
|
||||
public author: string = 'vapormusic';
|
||||
|
||||
constructor(app: any, store: any) {
|
||||
this._app = app;
|
||||
this._store = store;
|
||||
}
|
||||
|
||||
private SetContextMenu(visibility : any) {
|
||||
let self = this
|
||||
if (visibility) {
|
||||
this._tray.setContextMenu(electron.Menu.buildFromTemplate([
|
||||
// {
|
||||
// label: 'Check for Updates',
|
||||
// click: function () {
|
||||
// app.ame.utils.checkForUpdates(true)
|
||||
// }
|
||||
// },
|
||||
{
|
||||
label: 'Minimize to Tray',
|
||||
click: function () {
|
||||
if (typeof self._win.hide === 'function') {
|
||||
self._win.hide();
|
||||
self.SetContextMenu(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
click: function () {
|
||||
self._app.quit();
|
||||
}
|
||||
}
|
||||
]));
|
||||
} else {
|
||||
this._tray.setContextMenu(electron.Menu.buildFromTemplate([
|
||||
// {
|
||||
// label: 'Check for Updates',
|
||||
// click: function () {
|
||||
// this._app.ame.utils.checkForUpdates(true)
|
||||
// }
|
||||
// },
|
||||
{
|
||||
label: `Show ${electron.app.getName()}`,
|
||||
click: function () {
|
||||
if (typeof self._win.show === 'function') {
|
||||
self._win.show();
|
||||
self.SetContextMenu(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Quit',
|
||||
click: function () {
|
||||
self._app.quit();
|
||||
}
|
||||
}
|
||||
]));
|
||||
}
|
||||
return true
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on app ready
|
||||
*/
|
||||
onReady(win: any): void {
|
||||
this._win = win;
|
||||
const winTray = electron.nativeImage.createFromPath(path.join(__dirname, `../../resources/icons/icon.ico`)).resize({
|
||||
width: 32,
|
||||
height: 32
|
||||
})
|
||||
const macTray = electron.nativeImage.createFromPath(path.join(__dirname, `../../resources/icons/icon.png`)).resize({
|
||||
width: 20,
|
||||
height: 20
|
||||
})
|
||||
const linuxTray = electron.nativeImage.createFromPath(path.join(__dirname, `../../resources/icons/icon.png`)).resize({
|
||||
width: 32,
|
||||
height: 32
|
||||
})
|
||||
let trayIcon : any ;
|
||||
if (process.platform === "win32") {
|
||||
trayIcon = winTray
|
||||
} else if (process.platform === "linux") {
|
||||
trayIcon = linuxTray
|
||||
} else if (process.platform === "darwin") {
|
||||
trayIcon = macTray
|
||||
}
|
||||
|
||||
this._tray = new electron.Tray(trayIcon)
|
||||
this._tray.setToolTip(this._app.getName());
|
||||
this.SetContextMenu(true);
|
||||
|
||||
this._tray.on('double-click', () => {
|
||||
if (typeof this._win.show === 'function') {
|
||||
if (this._win.isVisible()) {
|
||||
this._win.focus()
|
||||
} else {
|
||||
this._win.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
electron.ipcMain.on("minimizeTray", (event, value) => {
|
||||
// listen for close event
|
||||
this._win.hide();
|
||||
this.SetContextMenu(false);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on app stop
|
||||
*/
|
||||
onBeforeQuit(): void {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on playback State Change
|
||||
* @param attributes Music Attributes (attributes.state = current state)
|
||||
*/
|
||||
onPlaybackStateDidChange(attributes: object): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs on song change
|
||||
* @param attributes Music Attributes
|
||||
*/
|
||||
onNowPlayingItemDidChange(attributes: object): void {
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue