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

Post by onkel_enno »

I think the + "&go=Go" is unnecessary.

@Sammy
Could you please remove your code from your posts if you solved all problems - for the clearness. Thx
Lowlander
Posts: 59284
Joined: Sat Sep 06, 2003 5:53 pm

Post by Lowlander »

If you want to do an album search you'll need to change album to:

Code: Select all

Album = Replace(Song.AlbumName, " ", "")
and the WshShell.Run to:

Code: Select all

WshShell.Run("http://www.allmusic.com/cg/amg.dll?P=amg&OPT1=2&SQL=" + Album) 
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas »

Lowlander, you're almost right in those replace lines for allmusic.com...but the spaces need to be replaced by a "+" not blank "", so the correct syntax is:

Code: Select all

      Artist = Replace(Song.ArtistName, " ", "+") 
      Album = Replace(Song.AlbumName, " ", "+")
there you go, and thanks for the help!!

btw...I'm having problems with artists that have a & in their name, like Hootie & THE BLOWFISH, as allmusic.com doesnt seem to understand the &. if & is replaced by AND it works, but i had no luck doing this in the script as replacing & breaks the string...it sure is how the language handles '&'

can you help me on that one please??

thanks,


judas
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Try:

Code: Select all

Artist = Replace(Song.ArtistName,"&","%26")
This is how most weblinks work (26 is the hexidecimal value for the & character).
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.
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas »

still no luck...it's breaking the string and the urls its sending to the browser is:

Code: Select all

http://www.allmusic.com/cg/amg.dll?P=amg&uid=SEARCH&opt1=1&sql=HOOTIE
one question: is this correct?

Code: Select all

      Artist = Replace(Song.ArtistName, " ", "+")
      Artist = Replace(Song.ArtistName,"&","%26")
      Album = Replace(Song.AlbumName, " ", "+")
thanks trix
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Turns out allmusic are a bit non-standard and simply use % to represent &, so this should work:

Code: Select all

Artist = Replace(Song.ArtistName,"&","%")
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.
MarineBrat
Posts: 490
Joined: Tue Jun 14, 2005 12:12 am
Location: Loony left coast, USA.

Post by MarineBrat »

Has anyone bundled this up into a complete script yet?
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas »

@Marinebrat
This is what i use to get info from artist or album from allmusic.com

Just put the script (*.vbs) on mediamonkey\scripts\auto folder...and restart the monkey

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") + " (allmusic.com)" 
   MenuItem.IconIndex = 37 
   MenuItem.OnClickFunc = "allmusic" 
   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") + " (allmusic.com)" 
   MenuItem.IconIndex = 37 
   MenuItem.OnClickFunc = "allmusic" 
   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") + " (allmusic.com)" 
   MenuItem.IconIndex = 37 
   MenuItem.OnClickFunc = "allmusic" 
   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") + " (allmusic.com)" 
   MenuItem.IconIndex = 37 
   MenuItem.OnClickFunc = "allmusic" 
   MenuItem.UseScript = Script.ScriptPath 
   MenuItem.Hint = "Album" 
    
   Set MenuItem = Nothing 
End Sub 

Sub allmusic(MenuItem) 
   if SDB.SelectedSongList.Count > 0 then 
      Dim Song 
      Set Song = SDB.SelectedSongList.Item(0) 
      Dim Artist 
      Dim Album 
    
      Artist = Replace(Song.ArtistName, " ", "+")
      Artist = Replace(Artist,"&","%")
      Album = Replace(Song.AlbumName, " ", "+")
      Album = Replace(Album,"&","%")
       
      Dim WshShell 
      Set WshShell = CreateObject("WScript.Shell") 
      if MenuItem.Hint = "Artist" then 
         WshShell.Run("http://www.allmusic.com/cg/amg.dll?P=amg&uid=SEARCH&opt1=1&sql=" + Artist) 
      else 
         WshShell.Run("http://www.allmusic.com/cg/amg.dll?P=amg&uid=SEARCH&opt1=2&sql=" + Album) 
      end if 
      Set WshShell = Nothing 
   end if 
end Sub
hope is what ur looking for...


judas
kanski
Posts: 80
Joined: Fri Mar 10, 2006 11:18 am
Location: Russian Fed.
Contact:

Post by kanski »

Good!
Please upgrade this script to get info from ALL POSSIBLE SITES. It's real?
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

Define "all possible sites" :-?
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.
kanski
Posts: 80
Joined: Fri Mar 10, 2006 11:18 am
Location: Russian Fed.
Contact:

Post by kanski »

2trixmoto:

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("Album") + " [allmusic.com]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   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") + " [allmusic.com]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "Album"


   Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1)
   MenuItem.Caption = SDB.Localize("Artist") + " [allmusic.com]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   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") + " [allmusic.com]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "Artist"


   Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1)
   MenuItem.Caption = SDB.Localize("Artist") + " [Wikipedia.org]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "ArtistWikipedia"
   
   Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_MoreFrom, -1, -1)
   MenuItem.Caption = SDB.Localize("Artist") + " [Wikipedia.org]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "ArtistWikipedia"


   Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_TrackList_MoreFrom, -1, -1)
   MenuItem.Caption = SDB.Localize("Artist") + " [Last.fm]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "ArtistFM"
   
   Set MenuItem = SDB.UI.AddMenuItem(SDB.UI.Menu_Pop_NP_MoreFrom, -1, -1)
   MenuItem.Caption = SDB.Localize("Artist") + " [Last.fm]"
   MenuItem.IconIndex = 37
   MenuItem.OnClickFunc = "allmusic"
   MenuItem.UseScript = Script.ScriptPath
   MenuItem.Hint = "ArtistFM"
   
 
   Set MenuItem = Nothing
End Sub

Sub allmusic(MenuItem)
   if SDB.SelectedSongList.Count > 0 then
      Dim Song
      Set Song = SDB.SelectedSongList.Item(0)
      Dim Artist
      Dim Album
   
      Artist = Replace(Song.ArtistName, " ", "+")
      Artist = Replace(Artist,"&","%")
      Album = Replace(Song.AlbumName, " ", "+")
      Album = Replace(Album,"&","%")
       
      Dim WshShell
      Set WshShell = CreateObject("WScript.Shell")
      if MenuItem.Hint = "Artist" then
         WshShell.Run("http://www.allmusic.com/cg/amg.dll?P=amg&uid=SEARCH&opt1=1&sql=" + Artist)
      end if 

      if MenuItem.Hint = "ArtistWikipedia" then
         WshShell.Run("http://en.wikipedia.org/wiki/Special:Search?search=" + Artist + "&go=Go")
      end if 
      if MenuItem.Hint = "ArtistFM" then
        WshShell.Run("http://www.last.fm/explore/search.php?q=" + Artist + "&m=artists")
      end if 

      if MenuItem.Hint = "Album" then
         WshShell.Run("http://www.allmusic.com/cg/amg.dll?P=amg&uid=SEARCH&opt1=2&sql=" + Album)
      end if 
    
      Set WshShell = Nothing
   end if
end Sub
urlwolf
Posts: 179
Joined: Sun Mar 05, 2006 6:58 am

Post by urlwolf »

Now that you seem to communicate with Allmusic all right, how difficult would it be to get the album art and other info from them as well?
judas
Posts: 572
Joined: Thu Jun 02, 2005 11:26 pm
Location: Bogotá, Colombia

Post by judas »

this has been requested (me included) many times, but they dont provide an apy and i think is against their licence or something like that...besides that, the script doesnt actually communicates with allmusic...it just sends the search query to a browser.

i dont think this is coming in the near future...some players that USED to allow this sort of thing stopped working since allmusic changed...


judas
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

how difficult would it be to get the album art and other info from them as well
For people who don't know yet:
A solution exists to tag your files from web resources, using "Web Sources Tagger": http://www.mediamonkey.com/forum/viewto ... 1069#41069
For more information (history, possibilities), please take a look in that thread.

It currently works for Amazon (all sites), All Music Guide (AMG), FreeDB, Discogs, Walmart (covers) and DarkTown (covers).
Other scripts already exist but have to be improved (e.g. iTunes (covers), ArtistDirect and MusicBrainz.)

If you want other sites to be supported, please let us know. Or take a look at the above linked forum page to find information on how to create/edit sources scripts yourself (documentation from Mp3Tag).

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
jatsad

Google search vbs proble

Post by jatsad »

I have tried to run the google search script, as well as the wikipedia,lastfm and allmusic.
In all cases I get the following error.

Error#-2147023241
File "E:\Program Files\MediaMonkey\Scripts\Auto\Google.vbs" Line: 50, Column: 9

When you press the OK button, the following is displayed.

Error happened during script execution:
No application is associated with the specified file for this operation.

The code with associated line numbers is:

37 Sub Google(MenuItem)
38 if SDB.SelectedSongL ist.Count > 0 then
39 Dim Song
40 Set Song = SDB.Se lectedSongList.Item(0)
41 Dim Artist
42 Dim Album
43
44 Artist = "%22" + Replace(Song.ArtistName, " ", "%20") + "%22"
45 Album = "%22" + R eplace(Song.AlbumName, " ", "%20") + "%22"
46
47 Dim WshShell
48 Set WshShell = Cr eateObject("WScript.Shell")
49 if MenuItem.Hint = "Artist" then
50 WshShell.Run(" www.google.com/search?q=" + Artist + "")
51 else
52 WshShell.Run(" www.google.com/search?q=" + Artist + "+" + Album)
53 end if
54 Set WshShell = No thing
55 end if
56 end Sub


Your help is appreciated in advance.
Post Reply