Author Topic: Tools: External Applications parameter settings ?  (Read 753 times)

hiccup

  • Sr. Member
  • ****
  • Posts: 7880
A 'something I always wondered about but was afraid to ask'  question:

Preferences > Tools > External applications has a 'parameters' field that you can edit.
By default it will say 'URL'
I know you can change it to something like e.g. 'URLs', and I use that, but only because I have learned that for some purposes URL does not work well, and URLs does.

I have two questions about this 'parameter' thingy:

1.
Could somebody with better insights in this provide some explanations on its exact workings?

2.
Could users that use this feature and use something other than 'URL' or 'URLs' share what they use, and explain why and for what applications?
 
Last Edit: May 08, 2022, 04:12:26 PM by hiccup

sveakul

  • Sr. Member
  • ****
  • Posts: 2469
The "<URL>" value seems to correspond to the "%1" value in a batch file, meaning "the file selected;"  following that, other switches supported by the tool can be added.  For applications able to open multiple files at once into their interface, the ""<URLs>" choice allows multiple files to be selected in MusicBee.

That's my "two sentences" anyway.


hiccup

  • Sr. Member
  • ****
  • Posts: 7880
…following that, other switches supported by the tool can be added.  For applications able to open multiple files at once into their interface, the ""<URLs>" choice allows multiple files to be selected in MusicBee.
So that would mean that 'URL' and 'URLs' are the ones native to musicbee, and anything else that can be entered there will depend on the external application?

sveakul

  • Sr. Member
  • ****
  • Posts: 2469

Zak

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 2459
-edit-
I should have prefaced this with "This is my understanding of the difference between <URL> and <URLs>. But I might be wrong."

...I have learned that for some purposes URL does not work well, and URLs does.
1. Could somebody with better insights in this provide some explanations on its exact workings?

It might be confusing because URL is singular and URLs is plural.
MusicBee will always send the file path of all selected files, regardless of which one you use.
The difference is how MusicBee sends the file paths when you have multiple tracks selected.
What happens next depends on how the external program interprets those file paths.

Say you have a program to edit audio files called "AwesomeEdit.exe".
Also say you have selected three tracks, "C:\Music\One.flac", "C:\Music\Two.flac" and "C:\Music\Three.flac" because in our hypothetical scenario we're just that imaginative.

If you set up an external command to AwesomeEdit using "<URL>" (singular) as the parameter MusicBee will actually ask Windows to start three separate instances of AwesomeEdit like so:
AwesomeEdit.exe "C:\Music\One.flac"
AwesomeEdit.exe "C:\Music\Two.flac"
AwesomeEdit.exe "C:\Music\Three.flac"

If instead you use "<URLs>" (plural) as the parameter MusicBee will only ask Windows to start one process for all three files like so:
AwesomeEdit.exe "C:\Music\One.flac" "C:\Music\Two.flac" "C:\Music\Three.flac"

But hang on, I hear you hypothetically interrupt, if I use <URL> (singular) I still only get one instance of AwesomeEdit.

Many programs are written such that when they are asked to run they will first check if an instance is already running and reuse that one instead, usually by opening each file in a separate window or tab. So whether you use <URL> or <URLs> for those programs is irrelevant, unless it has a setting of its own to allow multiple instances.

But hang on, I hear you hypothetically interrupt again (rude!), if I use <URLs> (plural) I still only get one instance of AwesomeEdit.

Some programs aren't written to accept more than one file at a time and will only open the first file and ignore the rest (or possibly even interpret them as some other parameter).
So you should use <URL> for those programs.


Incidentally, you may have wondered what the Wait checkbox next to the parameters field is for.
If you only have one file selected or use <URLs> this won't have any effect, as MusicBee is only asking Windows to start one process anyway.
If you use <URLs> and you have multiple files selected and the external program opens each file in a new instance, MusicBee will not send the second and subsequent requests until the previous program window has closed.

As a simple experiment, you can set up an external command to the Windows Notepad app (which only opens one file per instance).
 # Files  |  Parameter  |   Wait?  |  Result
 ============================================================================================================================
  Single  |    <URL>    |   No     | Single Notepad window
          |             |   Yes    | Single Notepad window
          |    <URLs>   |   No     | Single Notepad window
          |             |   Yes    | Single Notepad window
 Multiple |    <URL>    |   No     | Separate Notepad window per file, all at once
          |             |   Yes    | Separate Notepad window per file (Second file doesn't open until first window is closed)
          |    <URLs>   |   No     | Single Notepad window for first file only (Notepad doesn't support multiple files)
          |             |   Yes    | Single Notepad window for first file only (Notepad doesn't support multiple files)


If your external program hasn't properly documented how it handles supplied file paths, you just to have use to trial and error to find out what works best.

tldr;
The difference between <URL> and <URLs> (and Wait) is how MusicBee requests Windows to open your files.
How the external program interprets the request is up to them, and why you will get different results from different programs.


2. Could users that use this feature and use something other than 'URL' or 'URLs' share what they use, and explain why and for what applications?
You can include any MusicBee tags and functions, so any information about a selected track could potentially be passed to an external application.
I can't think of any specific examples, but a program that downloads album artwork might accept Artist and Album values as command line parameters.
Last Edit: May 12, 2022, 04:15:51 AM by Zak
Bee excellent to each other...

hiccup

  • Sr. Member
  • ****
  • Posts: 7880
…"This is my understanding of the difference between <URL> and [<URLs>. But I might be wrong."…
Thanks Zak, great explanation.

edit:
I just stumbled upon another thread that has good information and examples on this topic:
https://getmusicbee.com/forum/index.php?topic=31429.0

So anyone intending to reply on this matter (perhaps by sharing some other examples), it would be best to do that in that thread, and consider this one 'Answered & Locked'.
Last Edit: May 11, 2022, 06:11:18 PM by hiccup