Page 1 of 2
A script to modify the Web-feature in MediaMonkey; Need help
Posted: Mon Jan 07, 2008 4:48 am
by MonkeyBone
Hello!
I really want to make use of the web-function..
I want it to support last.fm, and wikipedia.org and others, but these two as number 1 priority!
I would also like the ability to remove the amazon.com, and AllMusic and the others, and replace/add the two sites (+) I've listed above..
And I want it to support Firefox (with installed plugin's)
So my goal is; I want the function to work just like webseach-panel functions.. So, when I go to the last.fm page in the web-tree, I want to come to the page on last.fm which displays information about the artist that's being played atm.. Just like the websearch-panel -scripts!
Hope you understand what I mean.. and, pardon my English!
So, if any of you want to make this thing, I would be very happy! And I would happily donate when it's complete!
But, I would also appreciate if you could help me on my way to make it myself; show me the directions.. (Because I REALLY want this thing to come true!!)
I have never coded scripts before (actually, I've never coded that much in general, but I've have some tiny-tiny-tiny knowledge of some C++ and Turbo Assembly).
So, if you could link some pages to where I can get some knowledge of script-making for MM, that would be great! More precisely how to edit the web-function..
Thank you very much!

Posted: Mon Jan 07, 2008 5:41 am
by trixmoto
Well this is probably possible, but not using Firefox, only IE.
Firstly you need to add the node...
Code: Select all
Sub OnStartup
Dim Tree : Set Tree = SDB.MainTree
Dim Node : Set Node = Tree.CreateNode
Node.Caption = "Last.Fm"
Node.IconIndex = 55
Script.RegisterEvent Node, "OnNodeFocused", "NodeFocus"
Tree.AddNode Tree.Node_Web, Node, 1
Node.HasChildren = False
End Sub
Then you need to define what to do when the node is clicked on...
Code: Select all
Function NodeFocus(Node)
Call SDB.WebControl.Navigate("http://www.last.fm")
NodeFocus = 2
End Function
That should be enough to get you started!

Posted: Mon Jan 07, 2008 5:42 am
by trixmoto
Sorry, I assumed you wanted it to open the webpage within MM - did you mean you wanted it to open the page on your browser externally?
Posted: Mon Jan 07, 2008 10:06 am
by Guest
MonkeyBone here;
I've not tried it yet, but yes, I wanted it to open within the MM, and not in an external browser..
Thank you! I will look into it a little later!
Thanks!!

Posted: Mon Jan 07, 2008 11:00 am
by MonkeyBone
hmm.. How do I add a / the node?

Posted: Tue Jan 08, 2008 4:21 am
by trixmoto
Sorry, all the code I gave you needs to go into a .vbs file in the "Scripts\Auto\" folder, then when you startup MM the node should be there.
Posted: Tue Jan 08, 2008 6:43 am
by MonkeyBone
Thank you!
This is REALLY!! starting to look like something!!
It's (almost) just what I'm looking for!
All i need now is to make it go to the %Arist% being played when I press the link, instead of the constant link;
http://www.last.fm
I've tried
http://www.last.fm/music/%Artist%, but I couldn't get that to work.. I've also tried some other twists, but no luck there either..
Could you help me with this as well?
Thank you SO!! much!!

Posted: Tue Jan 08, 2008 10:07 am
by RedX
MonkeyBone wrote:Thank you!
This is REALLY!! starting to look like something!!
All i need now is to make it go to the %Arist% being played when I press the link, instead of the constant link;
http://www.last.fm
I've tried
http://www.last.fm/music/%Artist%, but I couldn't get that to work..
Try
Code: Select all
Function NodeFocus(Node)
' This should work as long as the artist name does not have % or + in it's name.
Call SDB.WebControl.Navigate("http://www.last.fm/music/" + replace(SDB.player.currentsong.artist.name," ","+") )
NodeFocus = 2
End Function
This should work as long as the artist name does not have % or + in it's name.
For correct encoding use the fixurl function that is used in some scripts and has been coded by trix.
Regards,
Red
Posted: Tue Jan 08, 2008 10:30 am
by MonkeyBone
Ooh..
This is just TOO good!!
Thank you VERY MUCH, guys!!

Posted: Tue Jan 08, 2008 11:07 am
by MonkeyBone
Just one more thing..
Sorry for the trouble, guys.. but I've started to get real excited here now..
I've made another node with the functions of Wikipedia.. just changed something from the last.fm -node..
Code: Select all
Function NodeFocus(Node)
' This should work as long as the artist name does not have % or + in it's name.
Call SDB.WebControl.Navigate("http://en.wikipedia.org/wiki/" + replace(SDB.player.currentsong.artist.name," ","+") )
NodeFocus = 2
End Function
Anyway.. It works fine when the Artist is just ONE word, but when the artist name is separated by one or more spaces, the wikipedia reacts to the + -sign.. Artists like "Black Sabbath", "Tom Jones", "Guano Apes", etc..
Could you help me with this as well?
Really sorry for my lack of knowledge and for my eagerness, but this is just so great I can't help myself..
Thanks!!
Posted: Tue Jan 08, 2008 11:13 am
by m_bojangles
I don't have access to test this right now, but what if you tried this:
Code: Select all
Function NodeFocus(Node)
' This should work as long as the artist name does not have % or + in it's name.
Call SDB.WebControl.Navigate("http://en.wikipedia.org/wiki/" + SDB.player.currentsong.artist.name )
NodeFocus = 2
End Function
Posted: Tue Jan 08, 2008 11:56 am
by MonkeyBone
Oh, man..
You guys are my heroes!!
Thanks!! It worked!!

Posted: Tue Jan 08, 2008 1:05 pm
by trixmoto
I'm glad we could help.

Posted: Tue Jan 08, 2008 6:20 pm
by The Crow
Just getting fun to create such nodes as well...
I noticed that if such a node is clicked the search setting automatically changes to "current selection", in contrast to all other nodes. Would it be possible to keep (automatically) "entire library" or can I modify the search generally so that it always looks up in the entire library?
Posted: Wed Jan 09, 2008 5:46 am
by trixmoto
I don't think this is currently available via scripting, but then the scripting changes for MM3 are mostly undocumented at the moment so it might be possible now or in the future.