Skip to main content

Topic: Bing cover search, hta application (Read 4186 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
https://gist.github.com/c53dab9e9763057e0a9a

This script can be used as foo_run action, in search for album cover. Example usage:

Code: [Select]
cover_search.hta "%album artist%" "%album%" "$directory_path(%path%)"


If script isn't in foobar's root folder, whole path needs to be set.

Third argument is optional, in case it's not present image will be saved in script folder or if user manually defines `default_folder` variable which is set to empty. Similarly `default_filename` variable can be set to overwrite current default filename which is "cover".



Interface should be obvious - in table grid images are shown with size information and link to source url which will open in IE if user clicks on it. Single click on image launches confirmation dialog, where the image should be saved.

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #1
This script is extended and now uses 3 services, all accessed on fast highway - XML interface for Bing and Amazon and JSON for Google (Google image search API is currently deprecated, but it still works). It also uses lightbox nano for image preview, and allows 3 different layouts

Example usage for foo_run:

Code: [Select]
cover_search.hta "%album% %artist%" "[$directory_path(%path%)]"


So it requires at least one argument enclosed in double-quotes, which is used as search keyword. Optional path, instructs where to save selected image (if this argument isn't supplied, then on clicking save button, image is saved in script's location)

Anything else should be self describable, and here is a new screen-shot:





  • Hamallainen
  • [*][*][*]
Bing cover search, hta application
Reply #2
Hi.

Sounds interesting but i get an error. I'm using Win 8 with foobar2000 1.2.8. Do you have an idea about what i am doing wrong ? Thanks



I'll try to translate :
[blockquote]SCRIPT ERROR
An error appeared in the script of this page
Line : 84
character : 1
Error : This object does not handle this property or this method 'CoverSearch.commandLine'
Code : 0
URL : blabla
Do you want to keep executing scripts on this page ?
[/blockquote]

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #3
It looks like mshta isn't running the script. What happens if you double-click the script?
If you are using it as foo_run action and you have set command like it's suggested above, then maybe mshta isn't associated with hta files.

In that case you can try this command:

mshta cover_search.hta ...
  • Last Edit: 12 July, 2013, 08:20:44 AM by romor

  • Hamallainen
  • [*][*][*]
Bing cover search, hta application
Reply #4
It looks like mshta isn't running the script. What happens if you double-click the script?

I get the same message as in the previous screenshot. It says it can not handle this command :  'CoverSearch.commandLine'

If you are using it as foo_run action and you have set command like it's suggested above, then maybe mshta isn't associated with hta files.

here is how it is set. Do you see something wrong ?


In that case you can try this command:

mshta cover_search.hta ...

Where do i have to try this ? in foo_run config ?

  • PeteG
  • [*][*][*]
Bing cover search, hta application
Reply #5
I get the same message as in the previous screenshot. It says it can not handle this command :  'CoverSearch.commandLine'

Hm, I'm getting the same error message (in Danish, though  ). No difference when trying to run the script from inside fb2k or as external app.

.hta is associated as follows:

HTML Application (C:\Windows\SysWOW64\mshta.exe "%1" %*)

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #6
commandLine: http://msdn.microsoft.com/en-us/library/ms...9(v=vs.85).aspx is internal property of any HTA application.

Sorry, but I have no idea what might be wrong here.

It looks like you both use 64bit systems. There should be mshta in system32 folder too I guess, but I doubt it would change anything.


[edit] I just find out this article: http://social.technet.microsoft.com/Forums...mmand-line-args

It seems there is a problem with command line arguments on 64 bit systems, but it's not clear what is causing it.

Anyway using mshta from system32 should indeed solve this problem:

Code: [Select]
C:\Windows\System32\mshta.exe cover_search.hta "%album% %artist%" "[$directory_path(%path%)]"


I just hope that's the only problem
  • Last Edit: 12 July, 2013, 08:50:07 PM by romor

  • PeteG
  • [*][*][*]
Bing cover search, hta application
Reply #7
Anyway using mshta from system32 should indeed solve this problem:

Code: [Select]
C:\Windows\System32\mshta.exe cover_search.hta "%album% %artist%" "[$directory_path(%path%)]"

Sadly, it doesn't; the same error msg. pops up.
Later today or tomorrow I'll give it a try on a 32-bit machine.

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #8
This turned out more complicated, and caused by IE bug... http://social.msdn.microsoft.com/Forums/wp...ge10emulateie10

So if I remove meta edge attribute to address the problem, I won't be able to parse JSON, and CSS will ruin
I will include json parser, and CSS ASAP, but not right now

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #9
...style wasn't badly damaged as I expected. I updated script and tested on 32bit XP and 64bit Windows 7

Hope you enjoy it
  • Last Edit: 13 July, 2013, 12:57:44 AM by romor

  • Hamallainen
  • [*][*][*]
Bing cover search, hta application
Reply #10
Hey, it's working now. Nice.
Thanks for fixing it.

  • widerock
  • [*][*][*]
Bing cover search, hta application
Reply #11
...style wasn't badly damaged as I expected. I updated script and tested on 32bit XP and 64bit Windows 7

Hope you enjoy it


I got the error message which is saying that

Line : 95
Character : 1
Error : Access is denied
Code : 0
URL : file:///D:/Program Files/blahblah~~/cover_search.hta

Could you help me solve this problem?
I'm using the Windows 7 64bit machine.

Thank you in advance.


Bing cover search, hta application
Reply #12
First thank you for this script and your time 

Was wondering what lines i could change to make the window smaller, the window that shows all of the album art. This "save" window is larger than my screen size so it appears off the screen. Thanks.

h
  • Last Edit: 13 July, 2013, 11:28:30 PM by herefornow
cast out...

  • phool
  • [*][*]
Bing cover search, hta application
Reply #13
Ah, this is a very nice script indeed. Thank you! Would you consider adding additional services for searching cover art? Because Fanart.tv is a great service which provide high resolution album art and they do have an api. Check it out and let me know your thoughts: http://fanart.tv/music-fanart/

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #14
I updated to fanart. Dependency on MBID, required change in script arguments, so now script should be initialized like this:

Code: [Select]
cover_search.hta "%album%" "%artist%" ["$directory_path(%path%)"]


Path (third argument) is again optional. If fanart returns result, it will replace second (half) part of amazon results. To be able to see it, try the script on some popular artist. They have very nice cdart images.

@herefornow: Are you saying that you have problem with window width after you click "show more" button, or are you having problems with default view (i.e. you screen is 1024x768 or less)? If later I'll try to make changes in separate script, and reduce all elements to fit on 1024x768 screen, and if former that will wait until I think of some better way to design.
  • Last Edit: 14 July, 2013, 12:03:59 PM by romor

  • phool
  • [*][*]
Bing cover search, hta application
Reply #15
Thanks so much romor! What fantastic speed  The fanart.tv searches are working perfectly on my side for album art and CD art. Are you able to add a custom naming scheme for saving album art which makes use of title formatting? Instead of 'cover.jpg' I use '[Front] %album artist% - %album%', while it's not too much trouble renaming it myself, it would make saving album art even easier than you have already made it

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #16
That's already possible - on line 96 there is empty "default_filename" variable which is meant to be placeholder for custom filename.
But as your file naming scheme isn't fixed, you can add new line after line 102, with this content:

default_filename = "[Front] " & artist & " - " & album

Bing cover search, hta application
Reply #17
romor,
The trouble is with default view. It is useable, just wanted to tweak it if i could. Thanks again 

h
cast out...

  • romor
  • [*][*][*][*][*]
Bing cover search, hta application
Reply #18
Here is version with content reduced from 1050x840 to 900x700: https://gist.github.com/5498e3a1fce1cce02b59

I could reduce further more to fit on 800x600 screen if there is interest
  • Last Edit: 15 July, 2013, 05:18:39 AM by romor

Bing cover search, hta application
Reply #19
Thanks for the window screen size change. Works very well for me now.

h
cast out...

  • kaloian79
  • [*]
Bing cover search, hta application
Reply #20
That's already possible - on line 96 there is empty "default_filename" variable which is meant to be placeholder for custom filename.
But as your file naming scheme isn't fixed, you can add new line after line 102, with this content:

default_filename = "[Front] " & artist & " - " & album



sorry but i need a litle help. i wont default filename - nema of the artist. i try  .... but somthing is rong  ... sorry for my english