HydrogenAudio

Hosted Forums => foobar2000 => 3rd Party Plugins - (fb2k) => Topic started by: marc2k3 on 2022-01-05 05:46:45

Title: Run Main (foo_run_main)
Post by: marc2k3 on 2022-01-05 05:46:45
Some of you may have seen this mentioned in random comments across the forums but I thought I'd start a new thread for it.

The blurb from the readme...
Quote
Unlike the built in command line handler/foo_runcmd, this component has full support for dynamically generated menu commands meaning you can use `Edit` commands and switch playlists, change output devices etc.

To avoid ambiguity with common names that might appear more than once under different sub menus, you must supply the full path to the command. Examples:

Code: [Select]
foobar2000.exe /run_main:Edit/Sort/Randomize
foobar2000.exe /run_main:Library/Search

// use double quotes when command contains spaces
foobar2000.exe /run_main:"Playback/Device/Primary Sound Driver"

As of v0.0.2, there is a new /select_item option so you can select a track from the active playlist.

It means you can do something like this:

Code: [Select]
foobar2000.exe /run_main:"View/Switch to playlist/stranger in the alps"
foobar2000.exe /select_item:5
foobar2000.exe /play

https://github.com/marc2k3/fb2k-component#foo_run_main
https://github.com/marc2k3/fb2k-component/releases
Title: Re: Run Main (foo_run_main)
Post by: Forfit on 2022-01-05 07:07:37
Do it is possible to execute commands from context menu?
Title: Re: Run Main (foo_run_main)
Post by: kode54 on 2022-01-05 07:10:57
Um, why? That already exists in the player.
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2022-01-05 07:17:04
Are you saying these limitations no longer exist??

Quote
Unlike the built in command line handler/foo_runcmd, this component has full support for dynamically generated menu commands meaning you can use `Edit` commands and switch playlists, change output devices etc.
Title: Re: Run Main (foo_run_main)
Post by: kode54 on 2022-01-06 00:06:23
I don't know, actually.
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2022-01-06 03:57:52
Yesterday, I added /select_item and gave this example...

Code: [Select]
foobar2000.exe /select_item:5
foobar2000.exe /play

Soon after, I realised this only works if people have Playback follows cursor enabled which was a lack of foresight on my part.

v0.0.3 released just now has /select_item_and_play which works regardless of settings.

Also, valid numbers are now clamped so anything in excess of the playlist item count will result in the last track being selected.

https://github.com/marc2k3/fb2k-component/releases

Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2022-01-10 07:41:19
v0.0.4 released just now takes an optional delay when using /select_item_and_play.

https://github.com/marc2k3/fb2k-component#foo_run_main

It means commands like this can now work.

Code: [Select]
foobar2000.exe /add "d:\path\to\blah.mp3" /select_item_and_play:1:1500

The delay is in milliseconds and I found 1000 too low which I is why i used 1500 as an example. YMMV.

Title: Re: Run Main (foo_run_main)
Post by: MojoBass on 2022-04-30 06:33:38
Not sure how to understand above discussion on context menu commands execution:
Is foo_run_main able to start context menu commands like ReplayGain/Scan per track gain? I tried but it didn't work (just to be sure I didn't make any stupid error...)
Background: I would like to execute two (or more) context menu commands with one shortcut or button.
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2022-04-30 08:04:47
This component is for main menu commands only.

You can look at the built in support for running context commands...

https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Commandline_Guide
Title: Re: Run Main (foo_run_main)
Post by: MojoBass on 2022-04-30 08:58:55
@Marc: great, that works  :)
Code: [Select]
".\foobar2000.exe" /playlist_command:"ReplayGain/Scan per-file track gain"
Title: Re: Run Main (foo_run_main)
Post by: gob on 2022-05-06 07:04:36
😮
Title: Re: Run Main (foo_run_main)
Post by: Forfit on 2023-02-25 08:30:49
1.0.4 is not available for foobar2000 2.0?
It is stopped at 1.0.2.
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2023-02-25 09:44:07
0.0.4 is the last version for fb2k 1.5+ https://github.com/marc2k3/fb2k-archive/releases/tag/archive

1.0.2 is for fb2k 2.0

https://github.com/marc2k3/foo_run_main/releases
Title: Re: Run Main (foo_run_main)
Post by: Forfit on 2023-02-25 09:46:43
/select_item_and_play is not available for 1.0.2?
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2023-02-25 10:03:15
Correct. You can use the old version with 32bit fb2k 2.0 but not 64bit.
Title: Re: Run Main (foo_run_main)
Post by: Forfit on 2023-02-25 10:17:42
Why /select_item_and_play is only available for x32 and not for x64?
Do it have a technical limit?
Title: Re: Run Main (foo_run_main)
Post by: marc2k3 on 2023-02-25 12:16:46
With the new release for fb2k 2.0, I decided those commands were outside the scope of a component named "Run Main".

I may consider a new component for playing items by index from the main menu. Then it could be bound to keyboard shortcuts, buttons or ran from the command line.
Title: Re: Run Main (foo_run_main)
Post by: Forfit on 2023-02-26 09:01:29
Do it is possible to add a query command to get tags from command line?
F.e. to get current title in dos console from a batch file.
Title: Re: Run Main (foo_run_main)
Post by: TOPMuk on 2023-05-10 09:39:54
With the new release for fb2k 2.0, I decided those commands were outside the scope of a component named "Run Main".

I may consider a new component for playing items by index from the main menu. Then it could be bound to keyboard shortcuts, buttons or ran from the command line.
Hello, marc2k3. This is a great idea! Thank you for foobar2000 components! It will be very useful to be able to play the first (and also random) track from defined in the settings playlist using hotkeys. This is important both when awarding at official events, at gigs, and listening to a large amount of unfamiliar audio material, etc.
Title: Re: Run Main (foo_run_main)
Post by: majkinetor on 2023-05-14 14:52:37
Too bad that it can't rename the playlist.  I tried this:

Code: [Select]
.\foobar2000.exe "/command:New playlist" /run_main:"File/Rename playlist/Sofa Surfers" /add "C:\Audio\Sofa Surfers"

It just triggers rename dialog and I have to manually set up the name.