mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-14 03:41:46 +00:00
Added variations for testing
`xml_logo_ascii` `xml_logo_icons` `xml_logo_icons_notext` `xml_hero` `xml_banner_bottom` `xml_banner_top_custom` `xml_banner_centered_bottom` `xml_banner_centered_top`
This commit is contained in:
2
index.js
2
index.js
@ -32,7 +32,7 @@ autoUpdater.autoDownload = false;
|
|||||||
|
|
||||||
|
|
||||||
const gotTheLock = app.requestSingleInstanceLock();
|
const gotTheLock = app.requestSingleInstanceLock();
|
||||||
if (!gotTheLock) app.quit();
|
if (!gotTheLock) app.exit();
|
||||||
|
|
||||||
app.commandLine.appendSwitch(
|
app.commandLine.appendSwitch(
|
||||||
"js-flags",
|
"js-flags",
|
||||||
|
|||||||
@ -55,25 +55,10 @@ function sendXML(songInfo) {
|
|||||||
icon: imgSrc,
|
icon: imgSrc,
|
||||||
silent: true,
|
silent: true,
|
||||||
// https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root
|
// https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root
|
||||||
|
// https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/toast-schema
|
||||||
// https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml
|
// https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=xml
|
||||||
// https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toasttemplatetype
|
// https://learn.microsoft.com/en-us/uwp/api/windows.ui.notifications.toasttemplatetype
|
||||||
toastXml: `
|
toastXml: get_xml_custom(),
|
||||||
<toast useButtonStyles="true">
|
|
||||||
<audio silent="true" />
|
|
||||||
<visual>
|
|
||||||
<binding template="ToastImageAndText02">
|
|
||||||
<image id="1" src="${imgSrc}" name="Image" />
|
|
||||||
<text id="1">${songInfo.title}</text>
|
|
||||||
<text id="2">${songInfo.artist}</text>
|
|
||||||
</binding>
|
|
||||||
</visual>
|
|
||||||
|
|
||||||
<actions>
|
|
||||||
${getButton('previous')}
|
|
||||||
${songInfo.isPaused ? getButton('play') : getButton('pause')}
|
|
||||||
${getButton('next')}
|
|
||||||
</actions>
|
|
||||||
</toast>`,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
savedNotification.on("close", (_) => {
|
savedNotification.on("close", (_) => {
|
||||||
@ -94,24 +79,198 @@ const getButton = (kind) =>
|
|||||||
const display = (kind) =>
|
const display = (kind) =>
|
||||||
config.smallInteractive ?
|
config.smallInteractive ?
|
||||||
`content="${icons[kind]}"` :
|
`content="${icons[kind]}"` :
|
||||||
`content="" imageUri="file:///${path.resolve(__dirname, iconLocation, `${kind}.png`)}"`;
|
`content="${kind.charAt(0).toUpperCase() + kind.slice(1)}" imageUri="file:///${path.resolve(__dirname, iconLocation, `${kind}.png`)}"`;
|
||||||
|
|
||||||
|
|
||||||
// TODO MAKE DIFFERENT TEMPLATES
|
const get_xml = (songInfo, options, imgSrc) => `
|
||||||
const xml = (songInfo, options) => {
|
<toast useButtonStyles="true">
|
||||||
const xml = `
|
<audio silent="true" />
|
||||||
<toast displayTimestamp="2018-01-05T13:35:00Z">
|
<visual>
|
||||||
<visual>
|
<binding template="ToastImageAndText02">
|
||||||
<binding template="ToastGeneric">
|
<image id="1" src="${imgSrc}" name="Image" />
|
||||||
<text id="1">Header Text</text>
|
<text id="1">${songInfo.title}</text>
|
||||||
<text id="2">Body Text</text>
|
<text id="2">${songInfo.artist}</text>
|
||||||
<text id="3">Body 2 Text</text>
|
</binding>
|
||||||
<text placement="attribution">Attribution Text</text>
|
</visual>
|
||||||
<image src="file:///C:/Users/John.Doe/AppData/Local/Temp/tmpBC2C.tmp4e9214ef-f478-4cea-972a-3fdd6c3acac0.png" placement="appLogoOverride" hint-crop="circle" />
|
|
||||||
<image src="file:///C:/Users/John.Doe/AppData/Local/Temp/tmpBC2D.tmpeb4a5986-fd2a-4d7d-a69d-a78f0061d754.png" placement="hero" />
|
<actions>
|
||||||
<image src="file:///C:/Users/John.Doe/AppData/Local/Temp/tmpBC1B.tmp43598461-7e59-4600-a95c-88edbc57b2ec.png" />
|
${getButton('previous')}
|
||||||
</binding>
|
${songInfo.isPaused ? getButton('play') : getButton('pause')}
|
||||||
</visual>
|
${getButton('next')}
|
||||||
</toast>
|
</actions>
|
||||||
`;
|
</toast>`
|
||||||
}
|
|
||||||
|
// **************************************************** //
|
||||||
|
// PREMADE TEMPLATES FOR TESTING
|
||||||
|
// DELETE AFTER TESTING
|
||||||
|
// **************************************************** //
|
||||||
|
|
||||||
|
const get_xml_custom = () => xml_banner_centered_top;
|
||||||
|
|
||||||
|
const xml_logo_ascii = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_cover.jpg" name="Image" placement="appLogoOverride"/>
|
||||||
|
<text id="1">The Last Stand of Frej</text>
|
||||||
|
<text id="2">Amon Amarth</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<action content="ᐸ" activationType="protocol" arguments="youtubemusic://pause}"/>
|
||||||
|
<action content="‖" activationType="protocol" arguments="youtubemusic://pause}"/>
|
||||||
|
<action content="ᐳ" activationType="protocol" arguments="youtubemusic://pause}"/>
|
||||||
|
</actions>
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
|
||||||
|
const xml_logo_icons_notext =`
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_cover.jpg" name="Image" placement="appLogoOverride"/>
|
||||||
|
<text id="1">The Last Stand of Frej</text>
|
||||||
|
<text id="2">Amon Amarth</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<action content=""
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/previous.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
<action content=""
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/pause.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
<action content=""
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/next.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
</actions>
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const buttons_icons = `
|
||||||
|
<actions>
|
||||||
|
<action content="Previous"
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/previous.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
<action content="Pause"
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/pause.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
<action content="Next"
|
||||||
|
imageUri="file:///C:/Git/youtube-music/assets/media-icons-black/next.png"
|
||||||
|
activationType="protocol" arguments="youtubemusic://pause}" />
|
||||||
|
</actions>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_logo_icons = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_cover.jpg" name="Image" placement="appLogoOverride"/>
|
||||||
|
<text id="1">The Last Stand of Frej</text>
|
||||||
|
<text id="2">Amon Amarth</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_hero = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_banner.jpg" name="Image" placement="hero"/>
|
||||||
|
<text id="1">The Last Stand of Frej</text>
|
||||||
|
<text id="2">Amon Amarth</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_banner_bottom = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_banner.jpg" name="Image" />
|
||||||
|
<text id="1">The Last Stand of Frej</text>
|
||||||
|
<text id="2">Amon Amarth</text>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_banner_top_custom = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_banner.jpg" name="Image" />
|
||||||
|
<text>ㅤ</text>
|
||||||
|
<group>
|
||||||
|
<subgroup>
|
||||||
|
<text hint-style="body">The Last Stand of Frej</text>
|
||||||
|
<text hint-style="captionSubtle">Amon Amarth</text>
|
||||||
|
</subgroup>
|
||||||
|
<subgroup hint-textStacking="bottom">
|
||||||
|
<text hint-style="captionSubtle" hint-wrap="true" hint-align="right">Surtur Rising</text>
|
||||||
|
<text hint-style="captionSubtle" hint-wrap="true" hint-align="right">2011</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_banner_centered_bottom = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<text>ㅤ</text>
|
||||||
|
<group>
|
||||||
|
<subgroup hint-weight="1" hint-textStacking="center">
|
||||||
|
<text hint-align="center" hint-style="subHeader">The Last Stand of Frej</text>
|
||||||
|
<text hint-align="center" hint-style="SubtitleSubtle">Amon Amarth</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_banner.jpg" name="Image" hint-removeMargin="true" />
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const xml_banner_centered_top = `
|
||||||
|
<toast useButtonStyles="true">
|
||||||
|
<audio silent="true" />
|
||||||
|
<visual>
|
||||||
|
<binding template="ToastGeneric">
|
||||||
|
<image id="1" src="file:///C:/Git/test/toasters/assets/surtur_rising_banner.jpg" name="Image" />
|
||||||
|
<text>ㅤ</text>
|
||||||
|
<group>
|
||||||
|
<subgroup hint-weight="1" hint-textStacking="center">
|
||||||
|
<text hint-align="center" hint-style="subHeader">The Last Stand of Frej</text>
|
||||||
|
<text hint-align="center" hint-style="SubtitleSubtle">Amon Amarth</text>
|
||||||
|
</subgroup>
|
||||||
|
</group>
|
||||||
|
</binding>
|
||||||
|
</visual>
|
||||||
|
|
||||||
|
${buttons_icons}
|
||||||
|
</toast>
|
||||||
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user