mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
use config.plugins.isEnabled
This commit is contained in:
@ -22,14 +22,12 @@ function registerMPRIS(win) {
|
||||
const microToSec = n => Math.round(Number(n) / 1e6);
|
||||
|
||||
const seekTo = e => win.webContents.send("seekTo", microToSec(e.position));
|
||||
const seek = o => win.webContents.send("seek", microToSec(o));
|
||||
const seekBy = o => win.webContents.send("seekBy", microToSec(o));
|
||||
|
||||
const player = setupMPRIS();
|
||||
|
||||
const mprisSeek = player.seeked;
|
||||
|
||||
win.webContents.send("registerOnSeek");
|
||||
|
||||
ipcMain.on('seeked', (_, t) => mprisSeek(secToMicro(t)));
|
||||
|
||||
let currentSeconds = 0;
|
||||
@ -59,7 +57,7 @@ function registerMPRIS(win) {
|
||||
player.on("next", next);
|
||||
player.on("previous", previous);
|
||||
|
||||
player.on('seek', seek);
|
||||
player.on('seek', seekBy);
|
||||
player.on('position', seekTo);
|
||||
|
||||
registerCallback(songInfo => {
|
||||
|
||||
@ -27,7 +27,7 @@ const post = async (data) => {
|
||||
fetch(url, { method: 'POST', headers, body: JSON.stringify({ data }) }).catch(e => console.log(`Error: '${e.code || e.errno}' - when trying to access obs-tuna webserver at port ${port}`));
|
||||
}
|
||||
|
||||
module.exports = async () => {
|
||||
module.exports = async (win) => {
|
||||
ipcMain.on('timeChanged', async (_, t) => {
|
||||
if (!data.title) return;
|
||||
data.progress = secToMilisec(t);
|
||||
|
||||
Reference in New Issue
Block a user