mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 10:31:47 +00:00
lint
This commit is contained in:
@ -133,7 +133,7 @@ const iconLocation = app.isPackaged ?
|
|||||||
path.resolve(__dirname, '..', '..', 'assets/media-icons-black');
|
path.resolve(__dirname, '..', '..', 'assets/media-icons-black');
|
||||||
|
|
||||||
const display = (kind) => {
|
const display = (kind) => {
|
||||||
if (config.get("toastStyle") === ToastStyles.legacy ) {
|
if (config.get("toastStyle") === ToastStyles.legacy) {
|
||||||
return `content="${icons[kind]}"`;
|
return `content="${icons[kind]}"`;
|
||||||
} else {
|
} else {
|
||||||
return `\
|
return `\
|
||||||
@ -166,23 +166,18 @@ const toast = (content, isPaused) => `\
|
|||||||
${getButtons(isPaused)}
|
${getButtons(isPaused)}
|
||||||
</toast>`;
|
</toast>`;
|
||||||
|
|
||||||
const xml_logo = ({title, artist, isPaused}, imgSrc) => toast(`\
|
const xml_image = ({ title, artist, isPaused }, imgSrc, placement) => toast(`\
|
||||||
<image id="1" src="${imgSrc}" name="Image" placement="appLogoOverride"/>
|
<image id="1" src="${imgSrc}" name="Image" ${placement}/>
|
||||||
<text id="1">${title}</text>
|
<text id="1">${title}</text>
|
||||||
<text id="2">${artist}</text>\
|
<text id="2">${artist}</text>\
|
||||||
`, isPaused);
|
`, isPaused);
|
||||||
|
|
||||||
const xml_hero = ({title, artist, isPaused}, imgSrc) => toast(`\
|
|
||||||
<image id="1" src="${imgSrc}" name="Image" placement="hero"/>
|
|
||||||
<text id="1">${title}</text>
|
|
||||||
<text id="2">${artist}</text>\
|
|
||||||
`, isPaused);
|
|
||||||
|
|
||||||
const xml_banner_bottom = ({title, artist, isPaused}, imgSrc) => toast(`\
|
const xml_logo = (songInfo, imgSrc) => xml_image(songInfo, imgSrc, 'placement="appLogoOverride"');
|
||||||
<image id="1" src="${imgSrc}" name="Image" />
|
|
||||||
<text id="1">${title}</text>
|
const xml_hero = (songInfo, imgSrc) => xml_image(songInfo, imgSrc, 'placement="hero"');
|
||||||
<text id="2">${artist}</text>\
|
|
||||||
`, isPaused);
|
const xml_banner_bottom = (songInfo, imgSrc) => xml_image(songInfo, imgSrc, '');
|
||||||
|
|
||||||
const xml_banner_top_custom = (songInfo, imgSrc) => toast(`\
|
const xml_banner_top_custom = (songInfo, imgSrc) => toast(`\
|
||||||
<image id="1" src="${imgSrc}" name="Image" />
|
<image id="1" src="${imgSrc}" name="Image" />
|
||||||
@ -196,7 +191,7 @@ const xml_banner_top_custom = (songInfo, imgSrc) => toast(`\
|
|||||||
</group>\
|
</group>\
|
||||||
`, songInfo.isPaused);
|
`, songInfo.isPaused);
|
||||||
|
|
||||||
const xml_more_data = ({ album, elapsedSeconds, songDuration })=> `\
|
const xml_more_data = ({ album, elapsedSeconds, songDuration }) => `\
|
||||||
<subgroup hint-textStacking="bottom">
|
<subgroup hint-textStacking="bottom">
|
||||||
${album ?
|
${album ?
|
||||||
`<text hint-style="captionSubtle" hint-wrap="true" hint-align="right">${album}</text>` : ''}
|
`<text hint-style="captionSubtle" hint-wrap="true" hint-align="right">${album}</text>` : ''}
|
||||||
@ -204,7 +199,7 @@ const xml_more_data = ({ album, elapsedSeconds, songDuration })=> `\
|
|||||||
</subgroup>\
|
</subgroup>\
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const xml_banner_centered_bottom = ({title, artist, isPaused}, imgSrc) => toast(`\
|
const xml_banner_centered_bottom = ({ title, artist, isPaused }, imgSrc) => toast(`\
|
||||||
<text>ㅤ</text>
|
<text>ㅤ</text>
|
||||||
<group>
|
<group>
|
||||||
<subgroup hint-weight="1" hint-textStacking="center">
|
<subgroup hint-weight="1" hint-textStacking="center">
|
||||||
@ -215,7 +210,7 @@ const xml_banner_centered_bottom = ({title, artist, isPaused}, imgSrc) => toast(
|
|||||||
<image id="1" src="${imgSrc}" name="Image" hint-removeMargin="true" />\
|
<image id="1" src="${imgSrc}" name="Image" hint-removeMargin="true" />\
|
||||||
`, isPaused);
|
`, isPaused);
|
||||||
|
|
||||||
const xml_banner_centered_top = ({title, artist, isPaused}, imgSrc) => toast(`\
|
const xml_banner_centered_top = ({ title, artist, isPaused }, imgSrc) => toast(`\
|
||||||
<image id="1" src="${imgSrc}" name="Image" />
|
<image id="1" src="${imgSrc}" name="Image" />
|
||||||
<text>ㅤ</text>
|
<text>ㅤ</text>
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
@ -35,7 +35,7 @@ module.exports.notificationImage = (songInfo) => {
|
|||||||
if (!songInfo.image) return icon;
|
if (!songInfo.image) return icon;
|
||||||
if (!config.get("interactive")) return nativeImageToLogo(songInfo.image);
|
if (!config.get("interactive")) return nativeImageToLogo(songInfo.image);
|
||||||
|
|
||||||
switch(config.get("toastStyle")) {
|
switch (config.get("toastStyle")) {
|
||||||
case module.exports.ToastStyles.logo:
|
case module.exports.ToastStyles.logo:
|
||||||
case module.exports.ToastStyles.legacy:
|
case module.exports.ToastStyles.legacy:
|
||||||
return this.saveImage(nativeImageToLogo(songInfo.image), tempIcon);
|
return this.saveImage(nativeImageToLogo(songInfo.image), tempIcon);
|
||||||
@ -72,7 +72,7 @@ module.exports.save_temp_icons = () => {
|
|||||||
if (fs.existsSync(destinationPath)) continue;
|
if (fs.existsSync(destinationPath)) continue;
|
||||||
const iconPath = path.resolve(__dirname, "../../assets/media-icons-black", `${kind}.png`);
|
const iconPath = path.resolve(__dirname, "../../assets/media-icons-black", `${kind}.png`);
|
||||||
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
fs.mkdirSync(path.dirname(destinationPath), { recursive: true });
|
||||||
fs.copyFile(iconPath, destinationPath, ()=>{});
|
fs.copyFile(iconPath, destinationPath, () => { });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
const mpris = require("mpris-service");
|
const mpris = require("mpris-service");
|
||||||
const {ipcMain} = require("electron");
|
const { ipcMain } = require("electron");
|
||||||
const registerCallback = require("../../providers/song-info");
|
const registerCallback = require("../../providers/song-info");
|
||||||
const getSongControls = require("../../providers/song-controls");
|
const getSongControls = require("../../providers/song-controls");
|
||||||
const config = require("../../config");
|
const config = require("../../config");
|
||||||
@ -21,7 +21,7 @@ function setupMPRIS() {
|
|||||||
/** @param {Electron.BrowserWindow} win */
|
/** @param {Electron.BrowserWindow} win */
|
||||||
function registerMPRIS(win) {
|
function registerMPRIS(win) {
|
||||||
const songControls = getSongControls(win);
|
const songControls = getSongControls(win);
|
||||||
const {playPause, next, previous, volumeMinus10, volumePlus10, shuffle} = songControls;
|
const { playPause, next, previous, volumeMinus10, volumePlus10, shuffle } = songControls;
|
||||||
try {
|
try {
|
||||||
const secToMicro = n => Math.round(Number(n) * 1e6);
|
const secToMicro = n => Math.round(Number(n) * 1e6);
|
||||||
const microToSec = n => Math.round(Number(n) / 1e6);
|
const microToSec = n => Math.round(Number(n) / 1e6);
|
||||||
@ -117,7 +117,7 @@ function registerMPRIS(win) {
|
|||||||
// With precise volume we can set the volume to the exact value.
|
// With precise volume we can set the volume to the exact value.
|
||||||
let newVol = parseInt(newVolume * 100);
|
let newVol = parseInt(newVolume * 100);
|
||||||
if (parseInt(player.volume * 100) !== newVol) {
|
if (parseInt(player.volume * 100) !== newVol) {
|
||||||
if (!autoUpdate){
|
if (!autoUpdate) {
|
||||||
mprisVolNewer = true;
|
mprisVolNewer = true;
|
||||||
autoUpdate = false;
|
autoUpdate = false;
|
||||||
win.webContents.send('setVolume', newVol);
|
win.webContents.send('setVolume', newVol);
|
||||||
|
|||||||
Reference in New Issue
Block a user