use audic for sound playing

main
Ibraheem Saleh 10 months ago
parent 7bb2f4c062
commit b128d382e4

@ -1,7 +1,6 @@
import fetch from 'node-fetch'; import fetch from 'node-fetch';
import Aplay from 'node-aplay'; import { playAudioFile } from 'audic';
const url = 'https://www.bestbuy.com/gateway/graphql'; const url = 'https://www.bestbuy.com/gateway/graphql';
@ -60,10 +59,6 @@ let lines = 0;
let found = false; let found = false;
let winningResult = null; let winningResult = null;
function playAlarm() {
new Aplay('alarm.wav').play();
}
async function fetchGraphQL(zip, store, query) { async function fetchGraphQL(zip, store, query) {
const body = { const body = {
query, query,
@ -105,7 +100,7 @@ async function pollStore(zip, store) {
if (buttonState !== "SOLD_OUT") { if (buttonState !== "SOLD_OUT") {
found = true; found = true;
winningResult = { skuId, zip, store, buttonState, data }; winningResult = { skuId, zip, store, buttonState, data };
playAlarm() await playAudioFile('./alarm.wav');
return winningResult; return winningResult;
} }
} else { } else {

2544
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -11,7 +11,7 @@
"license": "ISC", "license": "ISC",
"description": "", "description": "",
"dependencies": { "dependencies": {
"node-aplay": "^1.0.3", "audic": "^3.0.2",
"node-fetch": "^3.3.2" "node-fetch": "^3.3.2"
} }
} }

Loading…
Cancel
Save