[MM2+3] Search Google, Wikipedia, Last.fm, ...

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

[MM2+3] Search Google, Wikipedia, Last.fm, ...

Post by onkel_enno »

As a Wish of Mhesse, here is a small script which creates 2 Entries in the Find more From - Menu-Item to Search google for "the Artist" or "the Artist and the Album".
Maybe someone else needs it too.
BTW: The URL google.de can easily be changed :wink:

- Create a file Google.vbs in Scripts\Auto and paste the code into it.
- Start MM.
- Enjoy!

Code: Select all

Sub OnStartUp
	SDB.UI.AddMenuItemSep SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1
	SDB.UI.AddMenuItemSep SDB.UI.Menu_Pop_NP_MoreFrom, -1, -1
	
	Dim MenuItem
	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1)
	MenuItem.Caption = SDB.Localize("Artist") + " (google.de)"
	MenuItem.IconIndex = 37
	MenuItem.OnClickFunc = "Google"
	MenuItem.UseScript = Script.ScriptPath
	MenuItem.Hint = "Artist"
	
	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_MoreFrom, -1, -1)
	MenuItem.Caption = SDB.Localize("Artist") + " (google.de)"
	MenuItem.IconIndex = 37
	MenuItem.OnClickFunc = "Google"
	MenuItem.UseScript = Script.ScriptPath
	MenuItem.Hint = "Artist"
	
	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1)
	MenuItem.Caption = SDB.Localize("Album") + " (google.de)"
	MenuItem.IconIndex = 37
	MenuItem.OnClickFunc = "Google"
	MenuItem.UseScript = Script.ScriptPath
	MenuItem.Hint = "Album"
	
	Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_MoreFrom, -1, -1)
	MenuItem.Caption = SDB.Localize("Album") + " (google.de)"
	MenuItem.IconIndex = 37
	MenuItem.OnClickFunc = "Google"
	MenuItem.UseScript = Script.ScriptPath
	MenuItem.Hint = "Album"
	
	Set MenuItem = Nothing
End Sub

Sub Google(MenuItem)
	if SDB.SelectedSongList.Count > 0 then
		Dim Song
		Set Song = SDB.SelectedSongList.Item(0)
		Dim Artist
		Dim Album
	
		Artist = "%22" + Replace(Song.ArtistName, " ", "%20") + "%22"
		Artist = Replace(Artist, "&", "%26")
		Album = "%22" + Replace(Song.AlbumName, " ", "%20") + "%22"
		Album = Replace(Album, "&", "%26")
		
		Dim WshShell
		Set WshShell = CreateObject("WScript.Shell")
		if MenuItem.Hint = "Artist" then
			WshShell.Run("www.google.de/search?q=" + Artist + "")
		else
			WshShell.Run("www.google.de/search?q=" + Artist + "+" + Album)
		end if
		Set WshShell = Nothing
	end if
end Sub
Last edited by onkel_enno on Wed Sep 12, 2007 5:16 am, edited 3 times in total.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Useful script, I like it! :)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Sammy20
Posts: 110
Joined: Thu Feb 17, 2005 5:42 am

Post by Sammy20 »

Nice!

Request: Could you make a script so it searches http://www.allmusic.com/ for the artist profile.

Wait, not to sound too greedy, but it would be cool if it had 3 options in a sub-menu to display search results for:

Wikipedia
AMG All music
last.fm

This would be very handy.
onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

Thx you both. 8)

I'm not sure about these 3. I can't find something about URL I can put the Serach Criterias in :-?
Maybe someone else has an idea. Trix?
Sammy20
Posts: 110
Joined: Thu Feb 17, 2005 5:42 am

Post by Sammy20 »

I know of a script that has the search code for those 3 sites. I'll go fetch it now.....
Lowlander
Posts: 59281
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

Wikipedia:
http://en.wikipedia.org/wiki/Artist

lastfm:
http://www.last.fm/explore/explore.php? ... =[b]Artist[/b] for search and http://www.last.fm/music/Artist for artist page.

allmusic
works with a dll and encrypted url so a no go it seems.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

:) Wikipedia: Use the link

Code: Select all

WshShell.Run("http://en.wikipedia.org/wiki/Special:Search?search=" + Artist + "&go=Go")
:( Allmusic: Doesn't use open search links, not sure how you'd do that.

:) Last.fm: Use this link

Code: Select all

WshShell.Run("http://www.last.fm/explore/search.php?q=" + Artist + "&m=artists")
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Looks like Lowlander has beaten me to it! :oops:

Although, I'd recommend using the Wikipedia (and Last.fm) search links rather than the direct links, as you get more useful pages if your match does not exist.
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Lowlander
Posts: 59281
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

Sammy20
Posts: 110
Joined: Thu Feb 17, 2005 5:42 am

Post by Sammy20 »

Great, thanks guys.
onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

Nice work guys :lol:
Sammy20
Posts: 110
Joined: Thu Feb 17, 2005 5:42 am

Post by Sammy20 »

Well I suck.

I just tried making a script for all those sites. It added in MM successfully, but when I click on it I get a 'unknown name' error message. Here's the code

Code: Select all

 removed by request 

Can someone make them for me.
Last edited by Sammy20 on Mon Jan 30, 2006 7:22 pm, edited 1 time in total.
onkel_enno
Posts: 2158
Joined: Fri Jan 14, 2005 1:45 am
Location: Germany
Contact:

Post by onkel_enno »

Your OnClickFunc-Method points to Wikipedia, but there is no Wikipedia-Procedure. Rename Sub Google(Menuitem) to Sub Wikipedia(Menuitem).
Sammy20
Posts: 110
Joined: Thu Feb 17, 2005 5:42 am

Post by Sammy20 »

That fixed it. Thank you 8)


Could someone help me with allmusic. I tried your code lowlander and got this result:

http://www.allmusic.com/cg/amg.dll?P=am ... s%22&go=Go

Here's my code:

Code: Select all

 Removed by request 
Last edited by Sammy20 on Mon Jan 30, 2006 7:21 pm, edited 1 time in total.
Lowlander
Posts: 59281
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

For allmusic you would need to do this I think:

Code: Select all

Artist = Replace(Song.ArtistName, " ", "")
You also don't need this in the url

Code: Select all

&go=Go
Post Reply