INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Integration of tools with command lines  (Read 3375 times)

sle118

  • Junior Woodchuck
  • **
  • Posts: 55
Integration of tools with command lines
« on: November 21, 2008, 09:04:44 am »

I have tried to search the forums for an answer to this but could not find anything.

I am using a freeware meta search engine for cover art retrieval. This tool has a command line interface that allows to invoke it with artist name, album name and a number of other parameters.

I know that MC is one of the most flexible media software out there and I love it.

Is there a way to add a tool menu that would launch an external program with placeholders as parameters?

thank you
Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integration of tools with command lines
« Reply #1 on: November 21, 2008, 11:29:24 am »

Possibly, which program are you using ?
Logged

sle118

  • Junior Woodchuck
  • **
  • Posts: 55
Re: Integration of tools with command lines
« Reply #2 on: November 21, 2008, 11:43:19 am »

It's called Albub Art Download http://sourceforge.net/projects/album-art/. It's a meta search engine for cover art, which had a success rate of 99.9% for me, providing large and nice cover art.

It is possible to invoke the tool using a command line as follow

Code: [Select]
>"C:\Program Files\AlbumArtDownloader\AlbumArt.exe"

Album Art Downloader XUI version 0.24.0.0

Usage: AlbumArt.exe [options]

Option names may be preceded by a / or a -
Options:

 /artist      Artist to search for            (/artist "Artist Name")
              May be abbreviated to /ar       (/ar "Artist Name")
              Parameter name may be omitted
              if this is the first parameter  ("Artist Name")

 /album       Album to search for             (/album "Album Name")
              May be abbreviated to /al       (/al "Album Name")
              Parameter name may be omitted
              if this is the second parameter ("Artist Name" "Album Name")
 
 /path        Default path to save art as     (/path "\Art\Folder.jpg")
              May be abbreviated to /p        (/p "\Art\Folder.jpg")
              Parameter name may be omitted
              if this is the third parameter  ("Artist Name" "Album Name" "\Art\Folder.jpg")

              The following variables can be used in paths:
               %artist%     Artist searched for
               %album%      Album searched for
               %name%       Name of the image found
               %extension%  Default file extension for the image
               %source%     Name of the source where image was found
               %size%       Dimensions of the image
               %preset%     A custom preset string, chosen from the save button menu

 /f           Provided for backwards          (/p "\Art" /f "Folder.jpg")
              compatibility only. When
              specified, the value is
              appended to the path.

 /localImagesPath
              Path to search for local image  (/localImagesPath "\Art\Unsorted\**\*.jpg")
              files in. If not specified, the
              path to save art in is used.
             
              The following variables can be used in paths:
               %artist%     Artist searched for
               %album%      Album searched for
               *            Wildcard, matches any characters
               \**\         Subfolder search. Any folders will match
                             at this point in the path. For example
                             "\Art\Unsorted\**\*.jpg" will match:
                              \Art\Unsorted\image.jpg
                              \Art\Unsorted\misc\image.jpg
                              \Art\Unsorted\misc\old\image.jpg
                             
                             "\Art\Unsorted\*\*.jpg" will match only:
                              \Art\Unsorted\misc\image.jpg

 /autoclose   Closes the search window after  (/autoclose)
              saving. To avoid closing, use
              Save As.
              May be abbreviated to /ac
             
              Append "off" to disable closing (/autoclose off)
              the search window after saving,
              if this option is on by default.
 
 /sources     Searches only the specified     (/sources "Amazon,Coveralia")
              sources. Others are disabled.
              Separate sources with commas.
              May be abbreviated to /s

 /exclude     Does not search the specified   (/exclude "Local Files,Google")
              sources. Separate sources with
              commas.
              May be abbreviated to /es
              For backwards compatibilty, the
              parameter "/ae off" can also be
              used to exclude "Local Files".

 /sort (name|size|source)[+|-]
              Sets the sorting to use for the (/sort size-)
              results.
              May be abbreviated to /o        (/o size-)
             
              The first character may be - to
              indicate descending search, or
              + to indicate ascending. If it
              is omitted, ascending is assumed.
             
              The field to sort by must be one
              of:
               name (may be abbreviated to n) (/o n+)
               size (may be abbreviated to s)
               source (may be abbreviated to o)

 /minSize     Specifies the minimum size of   (/minSize 300)
              image, in pixels, to filter the
              results by. Both horizontal and
              vertical dimensions must be over
              this value.
              May be abbreviated to /mn       (/mn 300)
             
 /maxSize     Specifies the maximum size of   (/maxSize 1000)
              image, in pixels, to filter the
              results by. Either horizontal or
              vertical dimensions may be under
              this value.
              May be abbreviated to /mx       (/mx 1000)             

 /fileBrowser                                 (/fileBrowser "\Music")
              Opens a File Browser window. If
              a path is specified, starts
              searching that path immediately.
              If no path is specified, the
              browser window is just opened.  (/fileBrowser)
             
              If other parameters are not
              specified, then a search window
              will not be shown initially.

 /foobarBrowser [search]                      (/foobarBrowser search)
              Opens a Foobar Browser window. If
              the search parameter is present,
              starts searching the foobar media
              library immediately. If the search
              parameter is omitted, the browser
              window is just opened.          (/foobarBrowser)
             
              If other parameters are not
              specified, then a search window
              will not be shown initially.

 /separateInstance                            (/separateInstance)
              Starts a new instance as a new
              process, which will neither re-use
              nor be re-used by any other
              instance of the application.
             
              (not recommended)
Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integration of tools with command lines
« Reply #3 on: November 21, 2008, 12:25:33 pm »

OK, can you give an example of the command line you would typically use.

This would then form a template to use from MC.
Logged

sle118

  • Junior Woodchuck
  • **
  • Posts: 55
Re: Integration of tools with command lines
« Reply #4 on: November 21, 2008, 02:04:48 pm »

OK, can you give an example of the command line you would typically use.

This would then form a template to use from MC.

A typical command line to search for album art would look like this:

Code: [Select]
c:\Program Files\AlbumArtDownloader\AlbumArt.exe /artist "Neil Young" /album "Harvest Moon" /path "%public%\music\neil young\harvesy moon\folder.jpg"
Where Neil Young and Harvest Moon would be respectively replaced with the current selected song's values and %public%\music\neil young\harvesy moon\ would be replaced with the path of the currently selected item.

Thank you for your help

Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integration of tools with command lines
« Reply #5 on: November 21, 2008, 02:41:44 pm »

You need to configure MC to use your external tool

Right click on 'a' track of that Album in Playing Now->Send To->Send To (external)->Add /Edit Programs

Then click Add, in the dialog that pops up

Name             : Album Art
Program Path : C:\Program Files\AlbumArtDownloader\AlbumArt.exe
Parameters    : /artist "[Artist]" /album "[Album]" /path "[Filename (path)]"

OK

[Album], [Artist], ie anything enclosed within square brackets corresponds to a field in MC, you can pass any field you like, i've double quoted them to handle tags that might have spaces between words

then select a file->right click->Send To->Send To (external)->Album Art

Album Art should appear in the top of the drop down menu with future right clicks. You will have to take care to only select one file from the album to invoke the tool otherwise the tool will be called as many times for as many files selected.

i'm not sure how well those tool options will be passed from MC, also the path option requires there be a folder.jpg at the end of the path, which is not possible using the method described above in which case a batch file or vb script might do the trick. You would pass the tags to the script which woudl then call your tool.
Logged

sle118

  • Junior Woodchuck
  • **
  • Posts: 55
Re: Integration of tools with command lines
« Reply #6 on: November 21, 2008, 03:07:07 pm »

You need to configure MC to use your external tool

Right click on 'a' track of that Album in Playing Now->Send To->Send To (external)->Add /Edit Programs

For some reason, MC was truncating the forward slashes.  The tool accepts '-' instead, so this is what I used.

Thank you very much for your help.

MC is so.... everything, that I think I am going to cry  ;D
Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integration of tools with command lines
« Reply #7 on: November 22, 2008, 01:12:30 am »

Are you saying you got it to work ?

What did enter in the third line for MC's Parameters ?

Parameters    : /artist "[Artist]" /album "[Album]" /path -

Where does your tool save the album art in this case ?
Logged

sle118

  • Junior Woodchuck
  • **
  • Posts: 55
Re: Integration of tools with command lines
« Reply #8 on: November 22, 2008, 07:42:18 am »

Are you saying you got it to work ?


You almost got it right the first time, but something wasn't working. The external tool (AlbumArtDownloader) is well written and shows you offending command lines received.  It turns out that he forward slashes were not sent to the tool by MC. Also, I appended the \folder.jpg file name to the path.

So the correct configuration is as follow:

Code: [Select]
Name             : Album Art
Program Path : C:\Program Files\AlbumArtDownloader\AlbumArt.exe
Parameters    : -artist "[Artist]" -album "[Album]" -path "[Filename (path)]\folder.jpg"


Now I wish I could have 3 last commands on top of the pop-up menu so tha when using the same commands over and over becomes more efficient. An alternative would be a "sticky" menu.

P.S. I meant crying because I was so happy to see MC do just about anything I want it to do.
Logged

neFAST

  • Galactic Citizen
  • ****
  • Posts: 372
  • \o/
Re: Integration of tools with command lines
« Reply #9 on: November 22, 2008, 08:37:29 am »

I would like to add a question on top of that.
Anyone knows if it's possible to build a smartlist that would select albums that have a cover art smaller than a given size ie. 150px wide.
Thanks a lot
Logged

hit_ny

  • Citizen of the Universe
  • *****
  • Posts: 3310
  • nothing more to say...
Re: Integration of tools with command lines
« Reply #10 on: November 22, 2008, 02:12:01 pm »

It turns out that he forward slashes were not sent to the tool by MC.

Aha, got you now, its unusal your tool offers an alternative way to specify its options with a '-' as well as '/'

...but if it works...  ;D

wonder if  a double forward slash would take care of it ?

Now I wish I could have 3 last commands on top of the pop-up menu so tha when using the same commands over and over becomes more efficient. An alternative would be a "sticky" menu.

Options->Tree & View->Advanced->Right Click recent command count:3

MC should remember the last 3 commands even across a shutdown.
Logged
Pages: [1]   Go Up