Compare commits
2 Commits
7d9800806a
...
d834eed748
Author | SHA1 | Date |
---|---|---|
Wizzard | d834eed748 | |
Wizzard | 96634a7e9e |
8
main.js
8
main.js
|
@ -18,8 +18,8 @@ async function processAlbumCover(url) {
|
|||
const imageSharp = sharp(imageBuffer);
|
||||
const metadata = await imageSharp.metadata();
|
||||
|
||||
if (metadata.format !== 'jpeg' && metadata.format !== 'jpg') {
|
||||
throw new Error('Not a JPEG image');
|
||||
if (metadata.format !== 'jpeg' && metadata.format !== 'jpg' && metadata.format !== 'png') {
|
||||
throw new Error('Not a supported image format');
|
||||
}
|
||||
|
||||
const dominantColor = await getDominantColor(imageBuffer);
|
||||
|
@ -67,8 +67,8 @@ async function getDominantColor(imageBuffer) {
|
|||
|
||||
async function setAsWallpaper(buffer) {
|
||||
try {
|
||||
await fs.promises.writeFile('current_album_cover.png', buffer);
|
||||
exec('feh --bg-center current_album_cover.png');
|
||||
await fs.promises.writeFile('/tmp/current_album_cover.png', buffer);
|
||||
exec('feh --bg-center /tmp/current_album_cover.png');
|
||||
console.log("Wallpaper set using feh.");
|
||||
} catch (error) {
|
||||
console.error("Error setting wallpaper:", error);
|
||||
|
|
Loading…
Reference in New Issue