Compare commits
No commits in common. "d834eed74801fa4f063c37c933a1d3674a956c81" and "7d9800806a75de77e185d8e75a765f9a6378dc02" have entirely different histories.
d834eed748
...
7d9800806a
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' && metadata.format !== 'png') {
|
||||
throw new Error('Not a supported image format');
|
||||
if (metadata.format !== 'jpeg' && metadata.format !== 'jpg') {
|
||||
throw new Error('Not a JPEG image');
|
||||
}
|
||||
|
||||
const dominantColor = await getDominantColor(imageBuffer);
|
||||
|
@ -67,8 +67,8 @@ async function getDominantColor(imageBuffer) {
|
|||
|
||||
async function setAsWallpaper(buffer) {
|
||||
try {
|
||||
await fs.promises.writeFile('/tmp/current_album_cover.png', buffer);
|
||||
exec('feh --bg-center /tmp/current_album_cover.png');
|
||||
await fs.promises.writeFile('current_album_cover.png', buffer);
|
||||
exec('feh --bg-center current_album_cover.png');
|
||||
console.log("Wallpaper set using feh.");
|
||||
} catch (error) {
|
||||
console.error("Error setting wallpaper:", error);
|
||||
|
|
Loading…
Reference in New Issue