mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-10 10:11:46 +00:00
download progress bar on taskbar
+ Get the best possible artwork
This commit is contained in:
@ -25,6 +25,7 @@ const observer = new MutationObserver((mutations, observer) => {
|
||||
});
|
||||
|
||||
const reinit = () => {
|
||||
triggerAction(CHANNEL, ACTIONS.PROGRESS, -1); // closes progress bar
|
||||
if (!progress) {
|
||||
console.warn("Cannot update progress");
|
||||
} else {
|
||||
@ -38,6 +39,7 @@ const baseUrl = defaultConfig.url;
|
||||
// contextBridge.exposeInMainWorld("downloader", {
|
||||
// download: () => {
|
||||
global.download = () => {
|
||||
triggerAction(CHANNEL, ACTIONS.PROGRESS, 2); // starts with indefinite progress bar
|
||||
let metadata;
|
||||
let videoUrl = getSongMenu()
|
||||
?.querySelector('ytmusic-menu-navigation-item-renderer.iron-selected[tabindex="0"]')
|
||||
@ -53,12 +55,15 @@ global.download = () => {
|
||||
|
||||
downloadVideoToMP3(
|
||||
videoUrl,
|
||||
(feedback) => {
|
||||
(feedback, ratio = undefined) => {
|
||||
if (!progress) {
|
||||
console.warn("Cannot update progress");
|
||||
} else {
|
||||
progress.innerHTML = feedback;
|
||||
}
|
||||
if (ratio) {
|
||||
triggerAction(CHANNEL, ACTIONS.PROGRESS, ratio);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
triggerAction(CHANNEL, ACTIONS.ERROR, error);
|
||||
|
||||
Reference in New Issue
Block a user