Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Bing cover search, hta application (Read 7252 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

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.

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:





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]

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 ...

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 ?

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" %*)

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

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.


 

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

Bing cover search, hta application

Reply #10
Hey, it's working now. Nice.
Thanks for fixing it.

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
cast out...

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/

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.

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

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...


Bing cover search, hta application

Reply #19
Thanks for the window screen size change. Works very well for me now.

h
cast out...

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