jef/streetmerchant

Sound player issue

jdkennedy45 opened this issue ยท 31 comments

$ npm start

nvidia-snatcher@1.4.0 start C:\Users\Jake\Documents\nvidia-snatcher
npm run build && node build/index.js

nvidia-snatcher@1.4.0 build C:\Users\Jake\Documents\nvidia-snatcher
rimraf ./build && tsc

INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
INFO: Could not find files for the given pattern(s).
[2:06:40 PM] info :: โœ– [amazon] still out of stock: pny xlr8
[2:06:41 PM] info :: โœ– [newegg] still out of stock: asus tuf
....

Hi I'm just confused on what this means. It prints it out every time I start the program. But the program seems to operate normally after..?

jef commented

Not sure what's going on here. Can you post your .env?

m1se commented

Maybe its related to the naming of the .env file?

DISCORD_NOTIFY_GROUP="@here"
DISCORD_WEB_HOOK="XXXXXXXXXXXXX"
EMAIL_USERNAME="XXXXXXXXXXXXXXXXXX"
EMAIL_PASSWORD="XXXXXXXXXXXXXXX"
HEADLESS="true"
LOG_LEVEL="info"
OPEN_BROWSER="true"
PAGE_TIMEOUT="30000"
PHONE_NUMBER="XXXXXXXXXXXXXXX"
PHONE_CARRIER="sprint"
PLAY_SOUND="C:\Users\Jake\Downloads\swiftly.mp3"
PUSHOVER_TOKEN="XXXXXXXXXXXXXX"
PUSHOVER_USER="XXXXXXXXXXXXXXX"
RATE_LIMIT_TIMEOUT="5000"
SHOW_ONLY_BRANDS="evga,zotac,aorus,asus,msi,gigabyte,pny"
SLACK_CHANNEL="SlackChannelName"
SLACK_TOKEN="slack-token"
STORES="bestbuy,bandh,nvidia,amazon,asus,evga,newegg"
SCREENSHOT="true"
TELEGRAM_ACCESS_TOKEN=""
TELEGRAM_CHAT_ID="1234"

Here is a pic of my folder structure with the .env
https://puu.sh/GuEME/66b0d5787f.png

jef commented

I don't think so. I removed my .env and also changed the name, no problems there.

jef commented

C:\Users\Jake\Downloads\swiftly.mp3 is more than likely you're problem. I would put that swiftly.mp3 file into the root of the nvidia-snatcher and change that variable to PLAY_SOUND=switfly.mp3.

Changed that but didn't help anything.
I noticed on npm install I get a warning. Is this impacting it?

npm WARN eslint-import-resolver-webpack@0.12.2 requires a peer of webpack@>=1.11.0 but none is installed. You must install peer dependencies yourself.

I just tried to set it up today, getting the same issue. It does start to check stores after the INFO lines, but it only checks for evga cards?

m1se commented

I just tried to set it up today, getting the same issue. It does start to check stores after the INFO lines, but it only checks for evga cards?

You need to edit the .env variable SHOW_ONLY_BRANDS, to include other brands, i.e msi, asus,evga or can leave it blank for it to report any card.

My program seems to operate normally after the PATTERN INFO pop-ups. But I was just worried I configured something wrong.

I'm getting the same. But it is still checking for stock after the fact.

jef commented

https://imgur.com/a/iMxezEh

@chuakc92 based off your screenshot, I would remove the SLACK and TELEGRAM related variables as setting those to junk values could throw errors.

Responding to @kylekelso's question:
the mplayer still in a zip file. Do you have it elsewhere?

I didn't unzip it because I was unsure if it helps.

@chuakc92 - It's what is used to play the file. The sound file is played through the command line interface so needs something like mplayer to play the sound.

Just leave the exe in the same path where the zip file is.

I removed Slack and Telegram variables and now I'm getting
playing sound
error playing sound: Error: Couldn't find a suitable audio player

@kylekelso Okay, let me go ahead and install it

Per the play-sound documentation:

https://github.com/shime/play-sound

players โ€“ List of available audio players to check. Default:
mplayer
afplay
mpg123
mpg321
play
omxplayer
aplay
cmdmp3

Windows (at least 10) doesn't ship with any of these by default. If installing mplayer solves @chuakc92's issue, then looks like we'll need to find some sort of simpler solution for this.

I decided to give mpg123 a go instead of mplayer and placed all the files inside the root folder and it finally worked.

As an added note, after adding mpg123 to my root folder, my INFO: Could not find files for the given pattern(s). has decreased from 8 iterations to 2

@chuakc92 it's because mpg123 is 3rd on the list that @vp-cshow showed. The 2 that show errors are because mplayer and afplay don't exist for you and stops checking when mpg123 is found.

@kylekelso

Correct. The player has a setting to explicitly define what player to use, so if we distribute this with a player included, we can get rid of the log lines entirely.

It probably wasn't showing for jef because macOS ships with mplayer, @jef can you confirm once you get a chance?


Edit: Confirmed with a friend that mplayer doesn't come w/ macOS by default; I wonder...

jef commented

I can try some testing when I get back on my macOS and see what we need to do.

jef commented

Nope, not problems on macOS... I just pulled latest.

I also don't have mplayer

โฏ where mplayer
mplayer not found

I do have afplay, though. Probably thats it. And Alpine Linux (other rig I use), probably had some dependency down the line.

Using afplay notification.mp3 worked.

Any ideas then? First two ideas that I can think of are either redistribute a copy of one of the sound playing programs play-sound supports (probably not the cleanest idea...) or just open a youtube video instead (seems redundant since we're opening a page anyway).

jef commented

Well... Let me try on the windows computer and go from there.

If you add additional player options to the play-sound library you can customize it to open any program you want as long as it can open via the command line. VLC does work through the command line but will require to you add it to your PATH to make it work anywhere. Here is a guide on how to add it to your path on Windows.

Once it's in your PATH, it should work find when you pass in that player to your play-sound library when you initialize is like so:

const player = playerLib({ player: 'vlc' });

This has worked for me so far, however it's not a very elegant solution considering you have to manually add the program of your choice to your PATH. This should work with windows media player as well but I have not tried it.

scyto commented

Ok, here is what i see - there is one INFO: Could not find files for the given pattern(s). for each player I think.

If one copies cmdmp3win.exe to the root of the folder AND renames to cmdmp3.exe then you will go from having 8 errors to 7 errors - i don't know if this means the sound will play!

Maybe feature request is to say what player is being looked for and if no player is installed say no player installed. I have no idea how to code so cant contribute to doing that, sorry.

Link to player i got FWIW https://lawlessguy.wordpress.com/2015/06/27/update-to-a-command-line-mp3-player-for-windows/

scyto commented

more info:

  • lack of any player executable generates 8 of these messages
  • if just an exe called mplayer.exe is present no errors are generated
  • if just an exe called omxplayer.exe is present only 5 of these errors are generated
  • if just an exe called cmdmp3.exe is present only 7 of these errors are generated

note the only one of these that is a real player was cmdmp3.exe - the rest were fake files.
i have no idea what this means, just more info as requested

scyto commented

ok possible fix

download mplayer from here and either add to your path variables or extract contents into the root of you project http://mplayerwin.sourceforge.net/downloads.html

this was from shime/play-sound#39

no idea if it works, no idea how to force a test; i have both mplayer and cmdmp3 in root of my project now and all INFO messages have disappeared.

I decided to give mpg123 a go instead of mplayer and placed all the files inside the root folder and it finally worked.

i did this and i'm still getting error playing sound: Error: Couldn't find a suitable audio player

unzipped and extracted the mpg123 folder to the root nvidia-snatcher folder.

ok possible fix

download mplayer from here and either add to your path variables or extract contents into the root of you project http://mplayerwin.sourceforge.net/downloads.html

For me just pasting the single mplayer.exe file into the root folder of nvidia-snatcher was enough, no need to copy all contents of the mplayer zip file.

For all those who have issues with audio notification on Windows, follow the instructions found here: https://github.com/jef/streetmerchant/wiki/Installation:-Windows#audio-notifications