WebSearch Panels (updated March 14, 2007) now with installer

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

WebSearch Panels (updated March 14, 2007) now with installer

Post by jn » Mon Jul 24, 2006 2:55 pm

The following script is based on the last.fm script.
It adds as many panels as defined to the MM screen, each one performs a specific web search on Artist, Title of Album. The script needs a XML file as a configuration file (I chose XML, as it seems easier to parse by VBS :-D).

  • There is now an MM3 installer available at Google code
  • gege wrote a nice documentation how to use the script here.
  • The current code can be found here.


Here is a sample config file, which needs to be named WebSearch.xml and must be located in the main MM directory.

Code: Select all

<?xml version="1.0" encoding="ISO-8859-15"?>
<configuration>
  <site>
    <name>Google</name>
    <caption>Google</caption>
    <description>Search Google for Artist</description>
    <start>http://www.google.com</start>
    <url>http://www.google.com/search?q=%artist%</url>
  </site>

  <site>
    <name>Wikipedia</name>
    <caption>Wikipedia</caption>
    <description>Search Wikipedia for Artist</description>
    <start>http://www.wikipedia.org</start>
    <url>http://www.wikipedia.org/wiki/%artist%</url>
  </site>
</configuration>
The "url" parameter is the Web Search URL, and the placeholders %artist%, %title% ansd %album% are replaced accordingly.

Here is the script. Save if as WebSearch.vbs and copy it to MM's scripts/auto directory:

Code: Select all

New version, see below
Experienced users will notice that there is no kind of error handling whatsoever. So make sure that the XML file is in place and has no errors.

Feedback -- as well on the code and more configurations for more sites -- are greatly appreciated.


Jörg
Last edited by jn on Sun Feb 03, 2008 1:00 pm, edited 6 times in total.

MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Post by MoDementia » Mon Jul 24, 2006 4:47 pm

Very snazzy, now just have to think of a site/search that I would really like/need

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Mon Jul 24, 2006 10:44 pm

Funny. I was just thinking last night it would be cool to have something like this... and here it is!! Thank you... :)
Image

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

Post by jn » Tue Jul 25, 2006 2:42 am

I just discovered that this method works with local files as well. As a POC use the following HTML file, save it somewhere and make an entry to WebSearch.xml for the file like

Code: Select all

  <site>
    <name>SongInfo</name>
    <caption>SongInfo</caption>
    <description>Displays Information on the current song</description>
    <start>about:blank</start>
    <url>file:///C:/Programs/MediaMonkey/Scripts/Song.htm</url>
  </site>
Here's the HTML file:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>
      Song details
    </title>
    <style type="text/css">
/*<![CDATA[*/
body {
  background-color: White;
  font-family: Verdana;
  font-size: 8pt;
  margin: 0.1em;
}
/*]]>*/
    </style>
		
    <script type="text/vbscript" language="VBScript">
'<![CDATA[
Option Explicit

Sub Window_OnLoad  
    Dim SDB
    Dim item
    
    'Connect to MM
    Set SDB = CreateObject("SongsDB.SDBApplication") 
    Set item = SDB.Player.CurrentSong
 
    document.getElementById("artist").InnerHTML =  item.ArtistName 
    document.getElementById("title").InnerHTML =  item.Title 
    document.getElementById("album").InnerHTML =  item.AlbumName 

    Set SDB = Nothing
    Set item = Nothing
End Sub
//]]>
    </script>
  </head>
  
  <body>
    Artist: <span id="artist"></span>
    <br />
    Title: <span id="title"></span>
    <br />
    Album: <span id="album"></span>
  </body>
</html>
The only ugly thing is that an ActiveX warning pops up every time the song changes; but I assume this is due to restrictive/secure IE settings :-)
Last edited by jn on Tue Jul 25, 2006 3:06 am, edited 1 time in total.

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Tue Jul 25, 2006 3:02 am

Actually, I didn't get that ActiveX warning. This most likely is related to the 'My Computer' Security Zone.

Internet and Intranet Zones are configurable by the Control Panel - Internet Options - Security, but the Zone for "My Computer" is hidden in the Registry.

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0
Key 0="My Computer"

Changing the DWORD 1201 to 0 instead of 1 stops these ActiveX messages

BTW, I think you have started something huge here. Making it so easy to add panels.. Amazing! That is fine coding...
Image

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

Post by jn » Tue Jul 25, 2006 3:08 am

DiddeLeeDoo wrote:Changing the DWORD 1201 to 0 instead of 1 stops these ActiveX messages
That did the Trick, thanks!

DiddeLeeDoo wrote:BTW, I think you have started something huge here. Making it so easy to add panels.. Amazing! That is fine coding...
Thank you... However, I think the code could be brushed up (I don't like globals etc), so any help is appreciated :-)

Peke
Posts: 11936
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Post by Peke » Tue Jul 25, 2006 4:19 am

I really Like this, already have several ideas that can be easily done.
Some pulldown object in Toolbar beside search some Configuration in MM Options. Good really good I like this and totaly agree with DiddeLeeDoo about huge use of this I think from first look that it can be modified to support podcasts XML but I could be wrong.

I Noticed One Small thing that I misses BACK and FWD Buttons for navigating the links.

P.S. I forgot to wish you welcome here on MM Forum and I must notice that you made impresive entrance.
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Thu Jul 27, 2006 11:44 am

It's been smooth sailing with this script, and I've learned a lot about the artists I play by reading those Wikipedia pages.

I am sort of used to doing Right Click - Back to navigate backwards, or a Backspace will do too.

Not quite sure about those Global Variables you want to get rid of, but SDB.Objects may do the trick. Haven't had a play with the code yet.

Sub Dodo
SDB.Objects("Something")=MyVariable
Micky
End sub

Sub Micky
Msgbox SDB.Objects("Something")
End Sub

May work, dunno.
Image

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Thu Jul 27, 2006 2:03 pm

Wow, thats totally cool.

I really like the way that the undocked panels are hidden when MM is not active too. I don't know if thats something with the script or normal behavior for an un-docked dockable (might should be an optional behavior).

And welcome also, very nice script.

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Thu Jul 27, 2006 2:05 pm

Peke wrote:I Noticed One Small thing that I misses BACK and FWD Buttons for navigating the links.
Standard IE navigation keys are ALT + LEFT/RIGHT arrows, and backspace also works to go backwards.

They should work for any IE based inet control, I use them alot for google art finder and such.

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

Post by jn » Thu Jul 27, 2006 2:27 pm

First of all, thanks for your positive feedback.
Peke wrote:I Noticed One Small thing that I misses BACK and FWD Buttons for navigating the links.
I think they can be incorporated quite easily.
DiddeLeeDoo wrote:Not quite sure about those Global Variables you want to get rid of, but SDB.Objects may do the trick.
This is indeed a nice pointer, thank you.

The code was a one-day-work. Thinking about it later, I recognized that using globals, I would need only the panels array, so getting rid of the othe globals is a straightforward task. I'll try the Object stuff and see how it could help.

I must admit that I didn't find the API docs before adapting the last.fm script (the docs are very well-hidden ;-)). I'll post a rewrite of the above script in the next week (beign sure that I won't find any time before :-D)

Jörg

DiddeLeeDoo
Posts: 1017
Joined: Wed Mar 01, 2006 1:09 am
Location: In a jungle down under
Contact:

Post by DiddeLeeDoo » Fri Jul 28, 2006 10:09 pm

Tried this link

Code: Select all

http://www.google.com/search?hl=en&q=%artist%&btnI=I%27m+Feeling+Lucky
but I guess there's some illegal characthers there somehow... as it didn't work out.

Added:.... actually it was not such a great idea to use this, as I notice many artists web pages feature 'Auto Play Music'.. that play over the current song...:roll: got the link above to work using another technique
Image

Teknojnky
Posts: 5533
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky » Fri Aug 04, 2006 11:55 am

I am trying to use the following to do a google image seach (similar to google art finder script), but it's not working as expected..

Code: Select all

  <site> 
    <name>Google</name> 
    <caption>Google</caption> 
    <description>Search Google for Images</description> 
    <start>http://images.google.com</start> 
    <url>http://images.google.com/search?q="%artist%"+"%album%"</url> 
  </site> 

Also, please consider adding an %albumartist% variable.

What I am looking to accomplish is a replacment for the built in album art window, that dynamically loads images via google images.

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

Post by jn » Sun Aug 06, 2006 4:52 am

As promised, here is a new version. It turned out to be almost a complete rewrite of the original script. I am now using a class to store all related items in one place, making the code much cleaner (at last I hope so).

Things that were done:
  • The menu now appears as a submenu of the "search" toolbar only
  • Back and Forward buttons are implemented (credits to Peke), as well as a "Home" button to navigate back to the original search page
  • Globals are eliminated, using the above mentioned class and the "SDB.Objects" object (Credits to DiddeLeeDoo)
  • %albumartist% is now possible (Credits to Teknojnky)
Here is the code. The format of the config file hasn't changed, so I won't repost it here.

Code: Select all

New code below
Have fun with it!


Jörg
Last edited by jn on Sun Aug 13, 2006 4:02 pm, edited 1 time in total.

jn
Posts: 61
Joined: Mon Jul 24, 2006 2:50 pm
Location: Germany

Post by jn » Sun Aug 06, 2006 5:07 am

Teknojnky wrote:I am trying to use the following to do a google image seach
First, please make sure that as well the name and the caption are unique (this is a limitation of the script :-(). Next, you are using a slightly wrong URL -- the path should be image, not search. And last, I have added the %albumartist% variable.

Putting it all together, you have

Code: Select all

  <site>
    <name>GoogleImages</name>
    <caption>Google Images</caption>
    <description>Search Google for Images</description>
    <start>http://images.google.com</start>
    <url>http://images.google.com/images?q="%albumartist%"+"%album%"</url>
  </site> 
which seems to work here ;-)

Jörg

Post Reply