chore: add banner, only show sound if enabled

Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
Jef LeCompte
2020-09-23 19:38:17 -04:00
parent bcbd2b6007
commit 6aed674ee1
3 changed files with 13 additions and 9 deletions
+2
View File
@@ -2,6 +2,8 @@
[FAQ](#FAQ) | [Issues](https://github.com/jef/nvidia-snatcher/issues) | [Wiki](https://github.com/jef/nvidia-snatcher/wiki)
![nvidia-snatcher](media/screenshot.png)
The purpose of this bot is to get an Nvidia card. It tries multiple things to do that.
- Currently, `nvidia-snatcher` is not capable of purchasing a card for you
Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

+11 -9
View File
@@ -3,26 +3,28 @@ import {Logger} from '../logger';
import fs from 'fs';
import playerLib from 'play-sound';
const notificationSound = Config.notifications.playSound;
let player: any;
const player = playerLib();
if (Config.notifications.playSound) {
player = playerLib();
if (player.player === null) {
Logger.warn('✖ couldn\'t find sound player');
} else {
const playerName: string = player.player;
Logger.info(`✔ sound player found: ${playerName}`);
if (player.player === null) {
Logger.warn('✖ couldn\'t find sound player');
} else {
const playerName: string = player.player;
Logger.info(`✔ sound player found: ${playerName}`);
}
}
export function playSound() {
if (player.player !== null) {
fs.access(notificationSound, fs.constants.F_OK, error => {
fs.access(Config.notifications.playSound, fs.constants.F_OK, error => {
if (error) {
Logger.error(`✖ error opening sound file: ${error.message}`);
return;
}
player.play(notificationSound, (error: Error) => {
player.play(Config.notifications.playSound, (error: Error) => {
if (error) {
Logger.error('✖ couldn\'t play sound', error);
}