mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
Merge pull request #231 from Araxeus/dependencies-update
Dependencies update
This commit is contained in:
19
package.json
19
package.json
@ -62,38 +62,37 @@
|
||||
"npm": "Please use yarn and not npm"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cliqz/adblocker-electron": "^1.20.1",
|
||||
"@cliqz/adblocker-electron": "^1.20.4",
|
||||
"@ffmpeg/core": "^0.8.5",
|
||||
"@ffmpeg/ffmpeg": "^0.9.7",
|
||||
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.8.1",
|
||||
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.9.0",
|
||||
"async-mutex": "^0.3.1",
|
||||
"browser-id3-writer": "^4.4.0",
|
||||
"custom-electron-titlebar": "^3.2.6",
|
||||
"discord-rpc": "^3.2.0",
|
||||
"downloads-folder": "^3.0.1",
|
||||
"electron-debug": "^3.2.0",
|
||||
"electron-is": "^3.0.0",
|
||||
"electron-localshortcut": "^3.2.1",
|
||||
"electron-store": "^7.0.2",
|
||||
"electron-store": "^7.0.3",
|
||||
"electron-unhandled": "^3.0.2",
|
||||
"electron-updater": "^4.3.6",
|
||||
"electron-updater": "^4.3.8",
|
||||
"filenamify": "^4.2.0",
|
||||
"md5": "^2.3.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"open": "^8.0.3",
|
||||
"ytdl-core": "^4.4.5",
|
||||
"ytpl": "^2.0.5"
|
||||
"ytdl-core": "^4.5.0",
|
||||
"ytpl": "^2.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^11.2.3",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron": "^11.4.2",
|
||||
"electron-builder": "^22.10.5",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"electron-icon-maker": "0.0.5",
|
||||
"get-port": "^5.1.1",
|
||||
"jest": "^26.6.3",
|
||||
"rimraf": "^3.0.2",
|
||||
"spectron": "^13.0.0",
|
||||
"xo": "^0.37.1"
|
||||
"xo": "^0.38.2"
|
||||
},
|
||||
"resolutions": {
|
||||
"yargs-parser": "18.1.3"
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const downloadsFolder = require("downloads-folder");
|
||||
const { app } = require("electron");
|
||||
|
||||
module.exports.getFolder = (customFolder) => customFolder || downloadsFolder();
|
||||
module.exports.getFolder = (customFolder) => customFolder || app.getPath("downloads");
|
||||
module.exports.defaultMenuDownloadLabel = "Download playlist";
|
||||
|
||||
@ -2,57 +2,53 @@ const getSongControls = require('../../providers/song-controls');
|
||||
const getSongInfo = require('../../providers/song-info');
|
||||
const path = require('path');
|
||||
|
||||
let controls;
|
||||
let currentSongInfo;
|
||||
|
||||
module.exports = win => {
|
||||
win.hide = function () {
|
||||
win.minimize();
|
||||
win.setSkipTaskbar(true);
|
||||
};
|
||||
|
||||
const show = win.show;
|
||||
win.show = function () {
|
||||
win.restore();
|
||||
win.focus();
|
||||
win.setSkipTaskbar(false);
|
||||
show.apply(win);
|
||||
};
|
||||
|
||||
win.isVisible = function () {
|
||||
return !win.isMinimized();
|
||||
};
|
||||
|
||||
const registerCallback = getSongInfo(win);
|
||||
const {playPause, next, previous} = getSongControls(win);
|
||||
const { playPause, next, previous } = getSongControls(win);
|
||||
controls = { playPause, next, previous };
|
||||
|
||||
// If the page is ready, register the callback
|
||||
win.on('ready-to-show', () => {
|
||||
registerCallback(songInfo => {
|
||||
// Wait for song to start before setting thumbar
|
||||
if (songInfo.title === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Win32 require full rewrite of components
|
||||
win.setThumbarButtons([
|
||||
{
|
||||
tooltip: 'Previous',
|
||||
icon: get('backward.png'),
|
||||
click() {previous(win.webContents);}
|
||||
}, {
|
||||
tooltip: 'Play/Pause',
|
||||
// Update icon based on play state
|
||||
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
||||
click() {playPause(win.webContents);}
|
||||
}, {
|
||||
tooltip: 'Next',
|
||||
icon: get('forward.png'),
|
||||
click() {next(win.webContents);}
|
||||
}
|
||||
]);
|
||||
});
|
||||
registerCallback(songInfo => {
|
||||
//update currentsonginfo for win.on('show')
|
||||
currentSongInfo = songInfo;
|
||||
// update thumbar
|
||||
setThumbar(win, songInfo);
|
||||
});
|
||||
|
||||
// need to set thumbar again after win.show
|
||||
win.on("show", () => {
|
||||
setThumbar(win, currentSongInfo)
|
||||
})
|
||||
};
|
||||
|
||||
function setThumbar(win, songInfo) {
|
||||
// Wait for song to start before setting thumbar
|
||||
if (!songInfo?.title) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Win32 require full rewrite of components
|
||||
win.setThumbarButtons([
|
||||
{
|
||||
tooltip: 'Previous',
|
||||
icon: get('backward.png'),
|
||||
click() { controls.previous(win.webContents); }
|
||||
}, {
|
||||
tooltip: 'Play/Pause',
|
||||
// Update icon based on play state
|
||||
icon: songInfo.isPaused ? get('play.png') : get('pause.png'),
|
||||
click() { controls.playPause(win.webContents); }
|
||||
}, {
|
||||
tooltip: 'Next',
|
||||
icon: get('forward.png'),
|
||||
click() { controls.next(win.webContents); }
|
||||
}
|
||||
]);
|
||||
}
|
||||
|
||||
// Util
|
||||
function get(file) {
|
||||
return path.join(__dirname,"assets", file);
|
||||
return path.join(__dirname, "assets", file);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user