Google Art Finder 2.7 [MM2+3]

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

Moderators: Peke, Gurus

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

Post by Teknojnky »

Another odd error.. happened when I was updating the album of a track which did not previously have an album entered.

Image

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

Post by Steegy »

hèhe, this "catastrophic fealure" error is funny, never had that one before :lol:
And look how descriptive the error message is...
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
PapaFrita
Posts: 8
Joined: Sun Feb 05, 2006 8:12 pm

Post by PapaFrita »

Yo Where the hell Do I download this script from I dont even see it am I blind????
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

Hello

MediaMonkey scripts have to be installed by copying the code in the previous page (there's code for 2 script files) to new script files for MediaMonkey's scripts folders. (as explained there, and on several other script pages).

Trixmoto supplies installers for his scripts at http://trixmoto.net/mm/scripts.php?id=1 so maybe it's just easier to download and run these. I don't know if these are the *latest* revisions however.

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

another feature suggestion:

right click any track and google search for art.

currently the script will only run on the 'now playing' track.

Alternatively, a toolbar button would work too, both would be even nicer.

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

Post by trixmoto »

@Steegy: The installers are almost always the latest versions. I normally paste the code on the forum about 5 mins before my site is updated (as that is how long it takes to update my website with a new script version!)

@Teknojnky:
1) You can run the script from "Tools, Scripts" and it will run for the currently selected track.
2) No idea about the error. From my published code that's the line that makes the form visible, so there should be no error. However if you've changed the code, maybe that's a different line now?
3) I found that medium images gave the best results, but of course so you remove this. I might add a variable in the next version.
4) I will update the NewWindow bit, although I don't think my script will cope very well with you browser yourself. I think it will get very confused if you hit any of the buttons after doing so.
5) A previous button is difficult. The next button searches through for another image through all the images on the page, so the first image shown might be image 5 in the list. Then next might end up being 8. Going forwards you just continue to search from where you last found one, going backwards might be more difficult. I'll look into it.
6) I have no idea how to navigate around the red cross, but if I can find a way, I'll do it!
7) I could add a monitor script which autocloses the window. Although I was assuming that the person would copy the art and close the window almost straight away, so I hadn't forseen this as a useful feature.

@jiri: Any help on saving the form position? I can't seem to get it to save when I want it to.
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.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

The only modifications I've done was to the search url (i think), I would not have affected any line numbers.

My script will only run on the now playing track.

I can click a track in the now playing window, or the detail list window and neither will load with the script. I just re-verified just now. :(

As far as navigating the window, It does very well now... you can press the backspace key to go back (and it does), and you can right click on the html somewhere and navigate forward (if you've been forward). Standard IE control keys work fine. (assuming they arent in use by MM which obviously takes precedence)

In fact, with the window staying up, I can manually search for art while MM is playing and set the album art window to selected (instead of now playing) and drag and drop away.

Doesnt the IE control have a navigate.back and navigate.forward methods?

The current implentation closes the current window and opens a new one, ie if you have resized/moved the window it completely closes and opens an new one whenever the script runs. It either does this automatically from MM, or you explicitly do it (I havent checked). It does not reuse any currently open search window. (which could be another feature suggestion/option haha).

I am guessing that the script runs on track changes and checks for art and for the album tag then opens the new window. Based on my limited knowledge, I would expect you can either explicitly close a window if it exists, or possibly open a 'null' window which would force MM to close the window and display nothing.

So I would not think a monitor function would be necessary if the script does it during the checks at track change.

Normally I just leave the window open, one because I am too lazy to mouse over to the little bitty close icon, and two because the next time the script runs it will close and open a new window anyway.

Now, if there was a way to simply click on the image or a button to add it to the library (I think I saw that type of feature is coming in future betas) then the window could (optionally) close whenever the art or add art button is pressed.

Wheee I've blabbered on, hope some of this is helpful or helps you understand how its used or can be used.
trixmoto
Posts: 10024
Joined: Fri Aug 26, 2005 3:28 am
Location: Hull, UK
Contact:

Post by trixmoto »

@Teknojnky:

You are right, it only works for now playing. This has now been corrected.

The IE does have forward and back but I don't use them because i'm retrieving a list of images from the first page and then just recursing through the list.

There will be methods to add the images to the tracks in the next release. So I will update this script again then to incorporate the new functionality.
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 »

New version (1.2) should now store form size and location, although it's not working brilliantly yet. It should also keep form on top and keep the browser actions within form. Running the script from tools now finds art for selected track and you can select image size you want (detault=medium).

:o NEW CODE BELOW :o
Last edited by trixmoto on Mon Feb 20, 2006 5:54 am, edited 1 time in total.
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.
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

Super as always!

To help out and to learn, I've created a helper auto-script which adds a toolbar icon but I can't seem to get it to call the external function in the googleartfinder script.. (based off the favoritenodes script and the script help file)

Code: Select all

Sub OnStartup 


   SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0 'separates the toolbar icon

   Dim GoogleArtTBB 
       Set GoogleArtTBB = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0) 
   GoogleArtTBB.Caption = SDB.Localize("Google Art Search!") 
   GoogleArtTBB.IconIndex = 1

   GoogleArtTBB.UseScript = SDB.ApplicationPath & "Scripts\GoogleArtFinder.vbs" 

   GoogleArtTBB.OnClickFunc = "AutoArtFinder"

   GoogleArtTBB.Shortcut = "Ctrl+G"

End Sub
I get the error:

Error happened during script execution:
OLE Error 800A01C2

also, is there a list of the icon index or how do I find a better icon :(
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

@Teknojnky:

One error that may cause the problem you're having:

Code: Select all

GoogleArtTBB.OnClickFunc = "AutoArtFinder" 
In this line, you call the sub "AutoArtFinder( <SDBMenuItem> )", instead of the sub "AutoArtFinder()" in the GoogleArtFinder.vbs file.

That means, the program expects to find a sub that gives you a reference to the clicked SDBMenuItem, but it can't find it.



A little workaround would be:


in your autostart script file:

Code: Select all

GoogleArtTBB.OnClickFunc = "StartAutoArtFinderFromToolbar" 

in the GoogleArtFinder.vbs file:

Code: Select all

Sub StartAutoArtFinderFromToolbar(TBB)
  AutoArtFinder 
End Sub 

Sub AutoArtFinder 
  Dim song 
  Set song = SDB.Player.CurrentSong 
  If song.Album.AlbumArt is Nothing Then 
    ArtFinder(song) 
  End If 
  Set song = Nothing 
End Sub 
(I didn't test it, but it is supposed to work :wink: )


For the icon index: look at my signature --> "resources".

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

Wheeee

I couldnt get that to work, so I tried something different...

I added a button to the google art search window "Search Current" which is supposed to execute the sub "GoogleArtFinder", but I still get the OLE error.

Code: Select all

  Dim Btn3
  Set Btn3 = SDB.UI.NewButton(Head) 
  Btn3.Caption = "Search Selected" 
  Btn3.Common.Height = 25
  Btn3.Common.Width = Head.Common.Width 
  Btn3.Common.Top = 50
  Btn3.UseScript = Script.ScriptPath 
  Btn3.OnClickFunc = "GoogleArtFinder" 
This is within the Sub ArtFinder(song) section.

Unless I am missing something, this should call the same function as the menu?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

What I said above works for me...

Install latest "GoogleArtFinder.vbs" and "GoogleArtFinder2.vbs" (and add entries to Scripts.ini file)
also put your autostarting code in a file in the Scripts\Auto folder (I call it "GoogleArtToolbarButton.vbs" here)

In "GoogleArtFinder.vbs":
add

Code: Select all

Sub StartAutoArtFinderFromToolbar(TBB) 
  AutoArtFinder 
End Sub
In "Auto\GoogleArtToolbarButton.vbs":
replace

Code: Select all

GoogleArtTBB.OnClickFunc = "AutoArtFinder"
with

Code: Select all

GoogleArtTBB.OnClickFunc = "StartAutoArtFinderFromToolbar"
Restart MM and you should see that it works now...



ADDITION: Your latest posted code doesn't work for the same reason. Please read my explanation (first comment) again.

If you look to the syntax example for onClickFunc of a SDBButton:

Code: Select all

Sub OnbuttonClick( Btn)
  ' Some code here
End Sub
for a SDBMenuItem:

Code: Select all

Sub OnMenuItemClick( Item)
  ' Some code here
End Sub
Notice that both subs has (Must Have!) a reference (Btn or Item or something else), even if you don't need that reference in your own code.


If the subs were OnbuttonClick() or OnMenuItemClick(), the code wouldn't work (and give an OLE error as it seems). So you must use OnbuttonClick(Btn) and OnMenuItemClick(Item) instead.

The workaround I posted in the first comment takes care of this (it calls a sub OnMenuItemClick(Item) which then calls something like TheSubWithoutReference() )

Cheers
Steegy
Extensions: ExternalTools, ExtractFields, SongPreviewer, LinkedTracks, CleanImport, and some other scripts (Need Help with Addons > List of All Scripts).
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Post by Teknojnky »

Ah I think I understand, I have added:

Code: Select all


  Dim Btn3 
  Set Btn3 = SDB.UI.NewButton(Head) 
  Btn3.Caption = "Search Selected" 
  Btn3.Common.Height = 25 
  Btn3.Common.Width = Head.Common.Width 
  Btn3.Common.Top = 50 
  Btn3.UseScript = Script.ScriptPath 
  Btn3.OnClickFunc = "SearchCurrent" 

Sub SearchCurrent(ClickedBtn) 
  GoogleArtFinder() 
End Sub 
and of course change Btn3 to call "SearchCurrent" it works!

For some reason I will have to explore further the toolbar button still does not function.

GoogleArtToolbarButton.vbs

Code: Select all

Sub StartAutoArtFinderFromToolbar(TBB) 
  AutoArtFinder 
End Sub 

Sub AutoArtFinder 
  Dim song 
  Set song = SDB.Player.CurrentSong 
  If song.Album.AlbumArt is Nothing Then 
    ArtFinder(song) 
  End If 
  Set song = Nothing 
End Sub 

Sub OnStartup 

   SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0 'separates the toolbar icon 

   Dim GoogleArtTBB 

   Set GoogleArtTBB = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0) 

   GoogleArtTBB.Caption = SDB.Localize("Google Art Search!") 

   GoogleArtTBB.IconIndex = 55

   GoogleArtTBB.UseScript = SDB.ApplicationPath & "Scripts\GoogleArtFinder.vbs" 

   GoogleArtTBB.OnClickFunc = "StartAutoArtFinderFromToolbar" 

   GoogleArtTBB.Shortcut = "Ctrl+G" 

End Sub 
I tried it with and without the "AutoArtFinder" sub. :-?
Steegy
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

That's my code for "GoogleArtToolbarButton.vbs":

Code: Select all

Sub OnStartup 


   SDB.UI.AddMenuItemSep SDB.UI.Menu_TbStandard,0,0 'separates the toolbar icon 

   Dim GoogleArtTBB 
       Set GoogleArtTBB = SDB.UI.AddMenuItem(SDB.UI.Menu_TbStandard,0,0) 
   GoogleArtTBB.Caption = SDB.Localize("Google Art Search!") 
   GoogleArtTBB.IconIndex = 1 

   GoogleArtTBB.UseScript = SDB.ApplicationPath & "Scripts\GoogleArtFinder.vbs" 

   GoogleArtTBB.OnClickFunc = "StartAutoArtFinderFromToolbar"

   GoogleArtTBB.Shortcut = "Ctrl+G" 

End Sub 
This script is calling the StartAutoArtFinderFromToolbar(Btn) sub in the file SDB.ApplicationPath & "Scripts\GoogleArtFinder.vbs", so the method StartAutoArtFinderFromToolbar(Btn) must be added to the file "Scripts\GoogleArtFinder.vbs" instead of here.

(don't copy sub AutoArtFinder to "Scripts\GoogleArtFinder.vbs" because it's already there and would cause a duplicate error. Just delete sub AutoArtFinder from "GoogleArtToolbarButton.vbs".)

If it still doesn't work, then read the above comments again until it works........(it's all in there :) ).... or copy/examine the following adapted files:
http://home.tiscali.be/ruben.castelein/ ... Button.vbs (for Scripts folder)
http://home.tiscali.be/ruben.castelein/ ... Finder.vbs (for Scripts\Auto folder)


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