|
|
@ -35,14 +35,14 @@ function setTitle(track) {
|
|
|
|
? `${track.name} · ${track.ar[0].name} - YesPlayMusic`
|
|
|
|
? `${track.name} · ${track.ar[0].name} - YesPlayMusic`
|
|
|
|
: 'YesPlayMusic';
|
|
|
|
: 'YesPlayMusic';
|
|
|
|
if (isCreateTray) {
|
|
|
|
if (isCreateTray) {
|
|
|
|
ipcRenderer.send('updateTrayTooltip', document.title);
|
|
|
|
ipcRenderer?.send('updateTrayTooltip', document.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
store.commit('updateTitle', document.title);
|
|
|
|
store.commit('updateTitle', document.title);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setTrayLikeState(isLiked) {
|
|
|
|
function setTrayLikeState(isLiked) {
|
|
|
|
if (isCreateTray) {
|
|
|
|
if (isCreateTray) {
|
|
|
|
ipcRenderer.send('updateTrayLikeState', isLiked);
|
|
|
|
ipcRenderer?.send('updateTrayLikeState', isLiked);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -223,7 +223,7 @@ export default class {
|
|
|
|
_setPlaying(isPlaying) {
|
|
|
|
_setPlaying(isPlaying) {
|
|
|
|
this._playing = isPlaying;
|
|
|
|
this._playing = isPlaying;
|
|
|
|
if (isCreateTray) {
|
|
|
|
if (isCreateTray) {
|
|
|
|
ipcRenderer.send('updateTrayPlayState', this._playing);
|
|
|
|
ipcRenderer?.send('updateTrayPlayState', this._playing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_setIntervals() {
|
|
|
|
_setIntervals() {
|
|
|
@ -235,7 +235,7 @@ export default class {
|
|
|
|
this._progress = this._howler.seek();
|
|
|
|
this._progress = this._howler.seek();
|
|
|
|
localStorage.setItem('playerCurrentTrackTime', this._progress);
|
|
|
|
localStorage.setItem('playerCurrentTrackTime', this._progress);
|
|
|
|
if (isCreateMpris) {
|
|
|
|
if (isCreateMpris) {
|
|
|
|
ipcRenderer.send('playerCurrentTrackTime', this._progress);
|
|
|
|
ipcRenderer?.send('playerCurrentTrackTime', this._progress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, 1000);
|
|
|
|
}, 1000);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -561,7 +561,7 @@ export default class {
|
|
|
|
|
|
|
|
|
|
|
|
navigator.mediaSession.metadata = new window.MediaMetadata(metadata);
|
|
|
|
navigator.mediaSession.metadata = new window.MediaMetadata(metadata);
|
|
|
|
if (isCreateMpris) {
|
|
|
|
if (isCreateMpris) {
|
|
|
|
ipcRenderer.send('metadata', metadata);
|
|
|
|
ipcRenderer?.send('metadata', metadata);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_updateMediaSessionPositionState() {
|
|
|
|
_updateMediaSessionPositionState() {
|
|
|
@ -617,7 +617,7 @@ export default class {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let copyTrack = { ...track };
|
|
|
|
let copyTrack = { ...track };
|
|
|
|
copyTrack.dt -= seekTime * 1000;
|
|
|
|
copyTrack.dt -= seekTime * 1000;
|
|
|
|
ipcRenderer.send('playDiscordPresence', copyTrack);
|
|
|
|
ipcRenderer?.send('playDiscordPresence', copyTrack);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
_pauseDiscordPresence(track) {
|
|
|
|
_pauseDiscordPresence(track) {
|
|
|
|
if (
|
|
|
|
if (
|
|
|
@ -626,7 +626,7 @@ export default class {
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ipcRenderer.send('pauseDiscordPresence', track);
|
|
|
|
ipcRenderer?.send('pauseDiscordPresence', track);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
currentTrackID() {
|
|
|
|
currentTrackID() {
|
|
|
@ -867,7 +867,7 @@ export default class {
|
|
|
|
sendSelfToIpcMain() {
|
|
|
|
sendSelfToIpcMain() {
|
|
|
|
if (process.env.IS_ELECTRON !== true) return false;
|
|
|
|
if (process.env.IS_ELECTRON !== true) return false;
|
|
|
|
let liked = store.state.liked.songs.includes(this.currentTrack.id);
|
|
|
|
let liked = store.state.liked.songs.includes(this.currentTrack.id);
|
|
|
|
ipcRenderer.send('player', {
|
|
|
|
ipcRenderer?.send('player', {
|
|
|
|
playing: this.playing,
|
|
|
|
playing: this.playing,
|
|
|
|
likedCurrentTrack: liked,
|
|
|
|
likedCurrentTrack: liked,
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -883,13 +883,13 @@ export default class {
|
|
|
|
this.repeatMode = 'on';
|
|
|
|
this.repeatMode = 'on';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (isCreateMpris) {
|
|
|
|
if (isCreateMpris) {
|
|
|
|
ipcRenderer.send('switchRepeatMode', this.repeatMode);
|
|
|
|
ipcRenderer?.send('switchRepeatMode', this.repeatMode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switchShuffle() {
|
|
|
|
switchShuffle() {
|
|
|
|
this.shuffle = !this.shuffle;
|
|
|
|
this.shuffle = !this.shuffle;
|
|
|
|
if (isCreateMpris) {
|
|
|
|
if (isCreateMpris) {
|
|
|
|
ipcRenderer.send('switchShuffle', this.shuffle);
|
|
|
|
ipcRenderer?.send('switchShuffle', this.shuffle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
switchReversed() {
|
|
|
|
switchReversed() {
|
|
|
|