IPB

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Bing cover search, hta application, [moved from General]
romor
post May 1 2013, 13:53
Post #1





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



https://gist.github.com/c53dab9e9763057e0a9a

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

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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
romor
post Jul 12 2013, 02:57
Post #2





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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






--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
Hamallainen
post Jul 12 2013, 12:44
Post #3





Group: Members
Posts: 229
Joined: 1-April 04
Member No.: 13171



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 :
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 ?
Go to the top of the page
+Quote Post
romor
post Jul 12 2013, 13:18
Post #4





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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

This post has been edited by romor: Jul 12 2013, 13:20


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
Hamallainen
post Jul 12 2013, 16:04
Post #5





Group: Members
Posts: 229
Joined: 1-April 04
Member No.: 13171



QUOTE (romor @ Jul 12 2013, 14:18) *
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'

QUOTE (romor @ Jul 12 2013, 14:18) *
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 ?


QUOTE (romor @ Jul 12 2013, 14:18) *
In that case you can try this command:

mshta cover_search.hta ...

Where do i have to try this ? in foo_run config ?
Go to the top of the page
+Quote Post
PeteG
post Jul 13 2013, 00:38
Post #6





Group: Members
Posts: 56
Joined: 10-June 12
From: Denmark
Member No.: 100577



QUOTE (Hamallainen @ Jul 12 2013, 16:04) *
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 happy.gif). 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" %*)
Go to the top of the page
+Quote Post
romor
post Jul 13 2013, 01:22
Post #7





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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
C:\Windows\System32\mshta.exe cover_search.hta "%album% %artist%" "[$directory_path(%path%)]"


I just hope that's the only problem wink.gif

This post has been edited by romor: Jul 13 2013, 01:50


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
PeteG
post Jul 13 2013, 02:53
Post #8





Group: Members
Posts: 56
Joined: 10-June 12
From: Denmark
Member No.: 100577



QUOTE (romor @ Jul 13 2013, 01:22) *
Anyway using mshta from system32 should indeed solve this problem:

CODE
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.
Go to the top of the page
+Quote Post
romor
post Jul 13 2013, 04:24
Post #9





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
romor
post Jul 13 2013, 05:57
Post #10





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



...style wasn't badly damaged as I expected. I updated script and tested on 32bit XP and 64bit Windows 7

Hope you enjoy it

This post has been edited by romor: Jul 13 2013, 05:57


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
Hamallainen
post Jul 13 2013, 08:59
Post #11





Group: Members
Posts: 229
Joined: 1-April 04
Member No.: 13171



Hey, it's working now. Nice.
Thanks for fixing it.
Go to the top of the page
+Quote Post
widerock
post Jul 13 2013, 09:22
Post #12





Group: Members
Posts: 45
Joined: 17-February 04
Member No.: 12082



QUOTE (romor @ Jul 12 2013, 21:57) *
...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.

Go to the top of the page
+Quote Post
herefornow
post Jul 14 2013, 04:27
Post #13





Group: Members
Posts: 96
Joined: 19-July 03
Member No.: 7866



First thank you for this script and your time smile.gif

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

This post has been edited by herefornow: Jul 14 2013, 04:28


--------------------
cast out...
Go to the top of the page
+Quote Post
phool
post Jul 14 2013, 09:58
Post #14





Group: Members
Posts: 87
Joined: 10-April 08
Member No.: 52685



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/
Go to the top of the page
+Quote Post
romor
post Jul 14 2013, 17:03
Post #15





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



I updated to fanart. Dependency on MBID, required change in script arguments, so now script should be initialized like this:

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

This post has been edited by romor: Jul 14 2013, 17:03


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
phool
post Jul 14 2013, 18:51
Post #16





Group: Members
Posts: 87
Joined: 10-April 08
Member No.: 52685



Thanks so much romor! What fantastic speed wink.gif 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 wink.gif
Go to the top of the page
+Quote Post
romor
post Jul 14 2013, 19:25
Post #17





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
herefornow
post Jul 15 2013, 00:29
Post #18





Group: Members
Posts: 96
Joined: 19-July 03
Member No.: 7866



romor,
The trouble is with default view. It is useable, just wanted to tweak it if i could. Thanks again smile.gif

h


--------------------
cast out...
Go to the top of the page
+Quote Post
romor
post Jul 15 2013, 10:18
Post #19





Group: Members
Posts: 682
Joined: 16-January 09
Member No.: 65630



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

This post has been edited by romor: Jul 15 2013, 10:18


--------------------
scripts: http://goo.gl/M1qVLQ
Go to the top of the page
+Quote Post
herefornow
post Jul 20 2013, 16:01
Post #20





Group: Members
Posts: 96
Joined: 19-July 03
Member No.: 7866



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

h


--------------------
cast out...
Go to the top of the page
+Quote Post
kaloian79
post Dec 24 2013, 00:48
Post #21





Group: Members
Posts: 13
Joined: 13-June 11
From: Bulgaria
Member No.: 91471



QUOTE (romor @ Jul 14 2013, 20:25) *
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 blink.gif blink.gif
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 21st November 2014 - 13:41