#1 2020-07-31 11:41

rol
Member
Registered: 2020-07-31
Posts: 6

Suggestions for new events (Foobar2000 and program exit code)

Hi !  I love Shutter, and IMO it has almost everything that we may need... except one or two things.

I would like something like the Winamp Stops event, but for Foobar2000.  I understand that it is impossible to support every player available for Windows, but Foobar2000 is probably the best audio player (just above Winamp IMO) and one of the most used by music lovers.  It is probably possible to check if it is playing with its web interface, so IMO it should be easy to support it.

I would also like a new event to check unusual external events not (yet) supported directly by Shutter.  The idea is to launch at fixed intervals a program, batch file or anything executable, wait until it finishes, and check the return code.  If the RC is 0, then Shutter should assume that the event is triggered, elsewhere not.  With that event, someone with some programming knowledge should be able to check almost anything we could imagine (like for example foobar2000 still playing) and inform Shutter of the result.

Thanks in advance for considering my suggestions.

Last edited by rol (2020-07-31 11:41)

Offline

#2 2020-08-03 08:16

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,427

Re: Suggestions for new events (Foobar2000 and program exit code)

Hi.

Thanks for the suggestions - they all sound reasonable.

Adding a Foobar2000 specific event was considered previously (many years ago), but it was dropped because there was no well defined/documented API for controlling and querying this program programmatically. However, this might have changed since.

Can you investigate what API is available (preferably command line or DLL) for Foobar2000?

Regarding an event for checking the exit code of a program. That is pretty straight forward and should get implemented later this year.

Offline

#3 2020-08-03 08:46

rol
Member
Registered: 2020-07-31
Posts: 6

Re: Suggestions for new events (Foobar2000 and program exit code)

Thanks !

I don't know if a foobar2000 API is directly available to do what I have suggested, but there is a SDK to build your own extension, possibly to verify if f2k is playing: https://www.foobar2000.org/SDK

Also, there are already several extensions available that should be sufficient.  For example, the foo_comserver2 extension is already used by several remote controllers for f2k, and might suit your needs: https://wiki.hydrogenaud.io/index.php?t … omserver2)
(Well, being obliged to install an extension is probably not a good point, but if someone really wants to check if f2k is playing, I'm sure he will accept to install it.  The problem for you will be to inform the user that an extension is required, and for the user to install it correctly.)

I can't help you much more, as I'm not a skilled programmer, but if you need some help, I suggest to post your questions at the HydrogenAudio forums, where foobar2000 is extensively discussed.  This thread is a good starting point: https://hydrogenaud.io/index.php?topic=42886.0

Anyway, thanks in advance for the exit code event !

Last edited by rol (2020-08-03 08:47)

Offline

#4 2020-08-23 12:05

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,427

Re: Suggestions for new events (Foobar2000 and program exit code)

Shutter 4.4.0.1 Beta:
Implemented "Program Output" event for monitoring the exit code of a program.

Try the latest development version.

Offline

#5 2020-08-23 13:50

rol
Member
Registered: 2020-07-31
Posts: 6

Re: Suggestions for new events (Foobar2000 and program exit code)

Thanks !  It works flawlessly.  :-)

Just a little remark.  In the open file dialog for the command, the supported "Executable" file types are .exe, .bat and .com.  I suggest to add .cmd (the new extension for command prompt scripts, currently much more used than the old .bat extension) and perhaps also .ps1 (the extension for the PowerShell, but in most cases an unsigned powershell script will not run due to the M$ PowerShell execution policies).

Perhaps you should also add a new "All Files (*.*)" filter for the other scripting languages.  However, I'm not sure it's a good idea.  I have tried with an Autohotkey script (extension .ahk) but the program cannot execute it.  I have had to specify the whole command line, like this:
"D:\AutoHotkey\AutoHotkeyU32.exe" "C:\Program Files (x86)\foobar2000\CheckFoobar2000IsPlaying.ahk"
And that command works perfectly.

I did a similar test with a .js file and the Windows Scripting Host.  It works the same way: cscript.exe must be specified, and when it's the case, it works correctly.

Anyway, the exit code is always correctly retrieved and interpreted.  Good job !

And as you can see in my Autohotkey example above, I have been able to write a little AHK script to check if foobar is playing, so I don't need any more the foobar2000 event I have initially suggested.  However, if it's not too difficult, it might be a good thing to implement it anyway.  Furthermore, currently, I am unable to detect if foobar is seeding audio to a network player through uPnP.  A good foobar event should also check that.

Thanks again !

Last edited by rol (2020-08-23 15:53)

Offline

Board footer

Powered by FluxBB