Merge pull request #550 from Araxeus/download-playlist-badge-count

show a badge remaining items when downloading a playlist
This commit is contained in:
th-ch
2022-01-16 17:26:14 +01:00
committed by GitHub
2 changed files with 9 additions and 2 deletions

View File

@ -8,7 +8,7 @@ const chokidar = require('chokidar');
const { setOptions } = require("../../config/plugins");
const { sendError } = require("./back");
const { defaultMenuDownloadLabel, getFolder, presets } = require("./utils");
const { defaultMenuDownloadLabel, getFolder, presets, setBadge } = require("./utils");
let downloadLabel = defaultMenuDownloadLabel;
let playingUrl = undefined;
@ -37,7 +37,7 @@ module.exports = (win, options) => {
return [
{
label: downloadLabel,
click: () => downloadPlaylist(undefined, win, options)
click: () => downloadPlaylist(undefined, win, options),
},
{
label: "Choose download folder",

View File

@ -1,4 +1,5 @@
const electron = require("electron");
const is = require('electron-is');
module.exports.getFolder = customFolder => customFolder || electron.app.getPath("downloads");
module.exports.defaultMenuDownloadLabel = "Download playlist";
@ -37,3 +38,9 @@ module.exports.presets = {
ffmpegArgs: ["-acodec", "libopus"],
},
};
module.exports.setBadge = n => {
if (is.linux() || is.macOS()) {
electron.app.setBadgeCount(n);
}
}