mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
* Added Discord timeout
* Add getOptions in plugin util
* Mutex in ffmpeg conversion (only supports one command at a time)
* Add menu customization in plugin system
* Add ytpl package (playlist info)
* Handle ffmpeg metadata flags when metadata is not present
* Only use artist in file name if present
* Export sendError method
* Handle image not present in metadata util
* Add downloader utils (getFolder and default menu label)
* Pass (optional) existing metadata and subfolder in mp3 converter
* Add listener to download playlist
* Add custom menu in downloader plugin ("download playlist" item)
* nit: fix main CSS style
* Only set the "enable" item in menu if plugin not enabled
* Navigation plugin: inject HTML once CSS is loaded
Co-authored-by: Sem Visscher <semvisscher10@gmail.com>
Co-authored-by: TC <th-ch@users.noreply.github.com>
47 lines
855 B
JavaScript
47 lines
855 B
JavaScript
const store = require("./store");
|
|
|
|
function getEnabled() {
|
|
const plugins = store.get("plugins");
|
|
const enabledPlugins = Object.entries(plugins).filter(([plugin, options]) =>
|
|
isEnabled(plugin)
|
|
);
|
|
return enabledPlugins;
|
|
}
|
|
|
|
function isEnabled(plugin) {
|
|
const pluginConfig = store.get("plugins")[plugin];
|
|
return pluginConfig !== undefined && pluginConfig.enabled;
|
|
}
|
|
|
|
function setOptions(plugin, options) {
|
|
const plugins = store.get("plugins");
|
|
store.set("plugins", {
|
|
...plugins,
|
|
[plugin]: {
|
|
...plugins[plugin],
|
|
...options,
|
|
},
|
|
});
|
|
}
|
|
|
|
function getOptions(plugin) {
|
|
return store.get("plugins")[plugin];
|
|
}
|
|
|
|
function enable(plugin) {
|
|
setOptions(plugin, { enabled: true });
|
|
}
|
|
|
|
function disable(plugin) {
|
|
setOptions(plugin, { enabled: false });
|
|
}
|
|
|
|
module.exports = {
|
|
isEnabled,
|
|
getEnabled,
|
|
enable,
|
|
disable,
|
|
setOptions,
|
|
getOptions,
|
|
};
|