mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
Use refactored provider in notification plugin
This commit is contained in:
@ -1,7 +1,9 @@
|
|||||||
const { Notification } = require("electron");
|
const { Notification } = require("electron");
|
||||||
|
|
||||||
const notify = info => {
|
const getSongInfo = require("../../providers/song-info");
|
||||||
let notificationImage = 'assets/youtube-music.png';
|
|
||||||
|
const notify = (info) => {
|
||||||
|
let notificationImage = "assets/youtube-music.png";
|
||||||
|
|
||||||
if (info.image) {
|
if (info.image) {
|
||||||
notificationImage = info.image.resize({ height: 256, width: 256 });
|
notificationImage = info.image.resize({ height: 256, width: 256 });
|
||||||
@ -18,10 +20,12 @@ const notify = info => {
|
|||||||
new Notification(notification).show();
|
new Notification(notification).show();
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = win => {
|
module.exports = (win) => {
|
||||||
win.on('ready-to-show', () => {
|
const registerCallback = getSongInfo(win);
|
||||||
|
|
||||||
|
win.on("ready-to-show", () => {
|
||||||
// Register the callback for new song information
|
// Register the callback for new song information
|
||||||
global.songInfo.onNewData(songInfo => {
|
registerCallback((songInfo) => {
|
||||||
// If song is playing send notification
|
// If song is playing send notification
|
||||||
if (!songInfo.isPaused) {
|
if (!songInfo.isPaused) {
|
||||||
notify(songInfo);
|
notify(songInfo);
|
||||||
|
|||||||
Reference in New Issue
Block a user