mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-16 12:42:06 +00:00
Merge pull request #10 from Araxeus/Download-Plugin-Directory-Chooser
Download plugin directory chooser
This commit is contained in:
@ -62,7 +62,7 @@
|
|||||||
"npm": "Please use yarn and not npm"
|
"npm": "Please use yarn and not npm"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cliqz/adblocker-electron": "^1.20.0",
|
"@cliqz/adblocker-electron": "^1.20.1",
|
||||||
"@ffmpeg/core": "^0.8.5",
|
"@ffmpeg/core": "^0.8.5",
|
||||||
"@ffmpeg/ffmpeg": "^0.9.7",
|
"@ffmpeg/ffmpeg": "^0.9.7",
|
||||||
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.8.1",
|
"YoutubeNonStop": "git://github.com/lawfx/YoutubeNonStop.git#v0.8.1",
|
||||||
|
|||||||
@ -9,6 +9,8 @@ const ytpl = require("ytpl");
|
|||||||
const { sendError } = require("./back");
|
const { sendError } = require("./back");
|
||||||
const { defaultMenuDownloadLabel, getFolder } = require("./utils");
|
const { defaultMenuDownloadLabel, getFolder } = require("./utils");
|
||||||
|
|
||||||
|
const { setOptions } = require('../../config/plugins')
|
||||||
|
const { dialog } = require('electron');
|
||||||
let downloadLabel = defaultMenuDownloadLabel;
|
let downloadLabel = defaultMenuDownloadLabel;
|
||||||
|
|
||||||
module.exports = (win, options, refreshMenu) => [
|
module.exports = (win, options, refreshMenu) => [
|
||||||
@ -60,4 +62,17 @@ module.exports = (win, options, refreshMenu) => [
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'Choose download folder:',
|
||||||
|
click: () => {
|
||||||
|
let result = dialog.showOpenDialogSync({
|
||||||
|
properties: ['openDirectory', 'createDirectory'],
|
||||||
|
defaultPath: Array.isArray(options.downloadFolder) ? options.downloadFolder[0] : undefined,
|
||||||
|
})
|
||||||
|
if(result) {
|
||||||
|
options.downloadFolder = result
|
||||||
|
setOptions("downloader", options)
|
||||||
|
} //else = user pressed cancel
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
BIN
plugins/taskbar-mediacontrol/assets/backward.png
Normal file
BIN
plugins/taskbar-mediacontrol/assets/backward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 269 B |
BIN
plugins/taskbar-mediacontrol/assets/forward.png
Normal file
BIN
plugins/taskbar-mediacontrol/assets/forward.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 B |
BIN
plugins/taskbar-mediacontrol/assets/pause.png
Normal file
BIN
plugins/taskbar-mediacontrol/assets/pause.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 192 B |
BIN
plugins/taskbar-mediacontrol/assets/play.png
Normal file
BIN
plugins/taskbar-mediacontrol/assets/play.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 265 B |
58
plugins/taskbar-mediacontrol/back.js
Normal file
58
plugins/taskbar-mediacontrol/back.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
const getSongControls = require('../../providers/song-controls');
|
||||||
|
const getSongInfo = require('../../providers/song-info');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
// 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);}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// Util
|
||||||
|
function get(file) {
|
||||||
|
return path.join(__dirname,"assets", file);
|
||||||
|
}
|
||||||
62
yarn.lock
62
yarn.lock
@ -282,45 +282,45 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
|
||||||
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
|
||||||
|
|
||||||
"@cliqz/adblocker-content@^1.20.0":
|
"@cliqz/adblocker-content@^1.20.3":
|
||||||
version "1.20.0"
|
version "1.20.3"
|
||||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.20.0.tgz#fcfa2845a577ba8d9af282afbae2fc437b3f1c70"
|
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.20.3.tgz#198c8719cd62ef3c67a5c98e7a54336b7812ed86"
|
||||||
integrity sha512-KcokmK2B+tAnVMi7nGHgzXUVf78wAODG1Uk+K3tBPf9VAo3mwldYZ472uTj6LUfZv5oeTwe4PwfmPWXWZy3Eew==
|
integrity sha512-aCBTiIiNgVbmDIQyUcsn0j3n+umvs0DuVlL6dccPE3qfeFxT4whUvMwjxUS2/dIBfJK9A1LywmvVke2eSPw9wg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@cliqz/adblocker-extended-selectors" "^1.20.0"
|
"@cliqz/adblocker-extended-selectors" "^1.20.3"
|
||||||
|
|
||||||
"@cliqz/adblocker-electron-preload@^1.20.0":
|
"@cliqz/adblocker-electron-preload@^1.20.3":
|
||||||
version "1.20.0"
|
version "1.20.3"
|
||||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.20.0.tgz#997b694fbb1b1206e04b1fd570690234cc7ef630"
|
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.20.3.tgz#17dff446ad742cb6e68a4572e7a75cff1fa33f95"
|
||||||
integrity sha512-brNQFjIoGTMClmFphtoK0EnjOlbqfxr6sA3CrOZiHfG0e07Id5GoU95re8+s8xA+/nd1GrJl/k5/b4aks+S9Gw==
|
integrity sha512-fWAFEGj+F0VOUKZd2FqWLuguXmGzkRQz5wTCqasvndX4HSe0P8Pd2666pWK9RJW1dLJE7U61mQfTbYqlUFVTMA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@cliqz/adblocker-content" "^1.20.0"
|
"@cliqz/adblocker-content" "^1.20.3"
|
||||||
|
|
||||||
"@cliqz/adblocker-electron@^1.20.0":
|
"@cliqz/adblocker-electron@^1.20.1":
|
||||||
version "1.20.0"
|
version "1.20.3"
|
||||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.20.0.tgz#bacfb9feaf1d3dab339b992e3defa111a4b5ed3c"
|
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.20.3.tgz#f2b4bf5dddf90f64251c46f89238526dc0037384"
|
||||||
integrity sha512-zD881g+YxxO4BM6NB5qZtSevg9Cj7QtlCJ4tkcKZnD9MDQsNXQVIFFEWwqhd00kLkTUS0+jT0px9b81cigAPNg==
|
integrity sha512-ZcEl3W7R/aoUA0IPIMtvdn7gVE6O9+rDQ9OllIH/s/gVeElXZsgPEtpPMSuoJWbi9d2mlr8yo3UFvkV3u7c4gw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@cliqz/adblocker" "^1.20.0"
|
"@cliqz/adblocker" "^1.20.3"
|
||||||
"@cliqz/adblocker-electron-preload" "^1.20.0"
|
"@cliqz/adblocker-electron-preload" "^1.20.3"
|
||||||
tldts-experimental "^5.6.21"
|
tldts-experimental "^5.6.21"
|
||||||
|
|
||||||
"@cliqz/adblocker-extended-selectors@^1.20.0":
|
"@cliqz/adblocker-extended-selectors@^1.20.3":
|
||||||
version "1.20.0"
|
version "1.20.3"
|
||||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.20.0.tgz#95ede657b670f627b39f92d85a97093cecee6ffe"
|
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.20.3.tgz#a817915948ec4e64c8b878a80a71d911ea0412c8"
|
||||||
integrity sha512-dnBPIngGe1eDWvYX49eP2yyCE2AY1QD5E+8SaXW6lslnjS0GQnkcXCAkkGR2am4Qdk78HAiWTXL65Zt9hdkupA==
|
integrity sha512-Xsrqg4qgpNVx80UJrAz/nS8jcbgCTIGvir0MrjoXrw0GheqRxsgE540XXP9JA7QlifLNVEOO44DpHvhUmISkQw==
|
||||||
|
|
||||||
"@cliqz/adblocker@^1.20.0":
|
"@cliqz/adblocker@^1.20.3":
|
||||||
version "1.20.0"
|
version "1.20.3"
|
||||||
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.20.0.tgz#514746e9ee72fcd886f1e2e1aaf13b28fc63f232"
|
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.20.3.tgz#4e8d03ed03c476f7b4388d25f910b1b9e0b15cc9"
|
||||||
integrity sha512-lkEj0Pj1ikwMURrvoFv0YnLfaXFuJI+jexI7zdh4fDmlwRppzDDgOhPXgCczoAlYacJk5x2mf7pan6JybRD9Kw==
|
integrity sha512-Dqj8fJ399kFsFQ53uW0ajA5jH5VJ5ppawOjtoV2s+7NILj1ydvw40jTrr3l/ObMvxaAGaDUj2Euo4beg3/EtRQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@cliqz/adblocker-content" "^1.20.0"
|
"@cliqz/adblocker-content" "^1.20.3"
|
||||||
"@cliqz/adblocker-extended-selectors" "^1.20.0"
|
"@cliqz/adblocker-extended-selectors" "^1.20.3"
|
||||||
"@remusao/guess-url-type" "^1.1.2"
|
"@remusao/guess-url-type" "^1.1.2"
|
||||||
"@remusao/small" "^1.1.2"
|
"@remusao/small" "^1.1.2"
|
||||||
"@remusao/smaz" "^1.7.1"
|
"@remusao/smaz" "^1.7.1"
|
||||||
"@types/chrome" "^0.0.128"
|
"@types/chrome" "^0.0.133"
|
||||||
"@types/firefox-webext-browser" "^82.0.0"
|
"@types/firefox-webext-browser" "^82.0.0"
|
||||||
tldts-experimental "^5.6.21"
|
tldts-experimental "^5.6.21"
|
||||||
|
|
||||||
@ -1014,10 +1014,10 @@
|
|||||||
"@types/node" "*"
|
"@types/node" "*"
|
||||||
"@types/responselike" "*"
|
"@types/responselike" "*"
|
||||||
|
|
||||||
"@types/chrome@^0.0.128":
|
"@types/chrome@^0.0.133":
|
||||||
version "0.0.128"
|
version "0.0.133"
|
||||||
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.128.tgz#5dbd8b2539a367353fbe4386f119b510105f8b6a"
|
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.133.tgz#9e1d55441584ba2d5274ca84db36427da9c5dc6e"
|
||||||
integrity sha512-eGc599TDtersMBW1cSnExHm0IHrXrO5xdk6Sa2Dq30ED+hR1rpT1ez0NNcCgvGO52nmktGfyvd3Uyquzv3LL4g==
|
integrity sha512-G8uIUdaCTBILprQvQXBWGXZxjAWbkCkFQit17cdH3zYQEwU8f/etNl8+M7e8MRz9Xj8daHaVpysneMZMx8/ldQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/filesystem" "*"
|
"@types/filesystem" "*"
|
||||||
"@types/har-format" "*"
|
"@types/har-format" "*"
|
||||||
|
|||||||
Reference in New Issue
Block a user