Pandora window

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

Moderators: Peke, Gurus

revbob
Posts: 22
Joined: Wed Feb 22, 2006 10:44 am
Location: Decatur AL, USA
Contact:

Pandora window

Post by revbob »

What better way to spend a rainy weekend than to write a script in a language you don't know to interface with an API you don't understand very well. :wink:

Here's a script that runs Pandora in either (a) your default browser or (b) a popup window.

[see follow-up for revised code]

Now a couple of questions.

First, is there a way to embed the MSIE ActiveX control in the main window of MM? I'm not entirely sure I want to do that, but I'd like to find out how anyhow. You never know when it might come in handy.

Second, am I even close to the way COM events will be handled in 2.5.2? How do you actually shut down the ActiveX control when you exit from its parent?
revbob
Posts: 22
Joined: Wed Feb 22, 2006 10:44 am
Location: Decatur AL, USA
Contact:

Version 1.1

Post by revbob »

Now, thanks to Steegy, it turns off the player when you close the window. This is so cool!

Code: Select all

'==========================================================================
'
' MediaMonkey Script
'
' NAME: PandoraNode v1.1
' DESCRIPTION:
'  Adds a node to the Web menu that opens Pandora (or substitute your
'  favorite web page) either in your default web browser or in a popup
'  child window of MM.
'
'  Heavily indebted to StreamsTreeNode by Steegy
'    http://www.mediamonkey.com/forum/viewtopic.php?t=8336
'  and openlink.vbs by tvjunky
'    http://www.mediamonkey.com/forum/viewtopic.php?t=5407
'  and jiri's application note on scripting features in 2.5.2
'    http://www.mediamonkey.com/forum/viewtopic.php?t=7660
'
' AUTHOR: Bob Crispen
' DATE  : 12.04.2006
'
' INSTALL:
' - Copy script to MediaMonkey's "Scripts\Auto" folder
'
'==========================================================================
'>> ForumURL: http://www.mediamonkey.com/forum/viewtopic.php?p=37961
'>> ScriptName: PandoraNode
'>> VersionNumber: 1.1
'>> Author: Bob Crispen
'>>>>EndOfProperties

'##############################################################################################

Dim Tree

' OnStartup event handler
Sub OnStartup

  ' Point to the main tree
  Set Tree = SDB.MainTree

  ' Create a node
  Dim PandoraNode
  Set PandoraNode = Tree.CreateNode

  ' Fill in the node label, icon, URL to open, this script, and the
  ' function to call when you click on the node.
  PandoraNode.Caption = "Pandora"
  PandoraNode.IconIndex = 37
  PandoraNode.CustomData = "http://www.pandora.com/"
  PandoraNode.UseScript = Script.ScriptPath
 
  ' Pick one
  Script.RegisterEvent PandoraNode, "OnNodeFocused", "OpenInPopup"
  ' Script.RegisterEvent PandoraNode, "OnNodeFocused", "OpenInDefaultBrowser"

  ' Under the Web main tree node seems like a logical place for Pandora
  Tree.AddNode Tree.Node_Web, PandoraNode, 2

End Sub

' OnClose event handler
Sub FormClose(Node)
  SDB.Objects("Pandora Window") = Nothing
  SDB.Objects("Pandora Browser").Navigate "about:blank"
  SDB.Objects("Pandora Browser") = Nothing
End Sub

' Open up the URL in your default web browser
Sub OpenInDefaultBrowser(Node)
  Dim WPandoraShell, Command
  Set WPandoraShell = CreateObject("WScript.Shell")
  Command = Node.CustomData
  Result = WPandoraShell.Run(Command, 0, 0)
End Sub

' Open the URL in a popup window containing a browser control.
Sub OpenInPopup(Node)
  Dim Form, BrowserControl, Command
  Command = Node.CustomData
  Set Form = SDB.UI.NewForm
  Form.Common.SetRect 100, 100, 900, 700
  Form.Caption = Command
  Set BrowserControl = SDB.UI.NewActiveX(Form, "Shell.Explorer")
  BrowserControl.Common.Align = 5         ' Fill all client rectangle
  BrowserControl.Interf.Navigate Command  ' Go to the specified URL
  Form.Common.Visible = True
  SDB.Objects("Pandora Window") = Form    ' Make the window hang about
  SDB.Objects("Pandora Browser") = BrowserControl.Interf
  Script.RegisterEvent Form, "OnClose", "FormClose"
End Sub
Probably lots of solecisms (like, why is Tree global? do you have to Dim stuff and then Set it?) because I know exactly zero Visual Basic. But it works and doesn't do stuff that's half as evil as a lot of programs I run all the time.

Thanks, Steegy.
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Post by rovingcowboy »

i was wondering if the child window memory leak i found about in winxp has caused you some trouble but since you got it working i guess not.

but you might want to check that out in the news and other stuff room. just to make sure.

8)


Also just a reminder.

but why not put the information for your script

you posted in the all scripts sticky thread so it is easier to find then looking through all the beta messages.
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
revbob
Posts: 22
Joined: Wed Feb 22, 2006 10:44 am
Location: Decatur AL, USA
Contact:

Post by revbob »

but why not put the information for your script you posted in the all scripts sticky thread so it is easier to find then looking through all the beta messages.
Uhh, because I didn't know? I posted a wish for a script in the script wishlist thread -- silly me -- and got growled at.

:wink:
wallstreetwalker
Posts: 150
Joined: Wed Dec 07, 2005 9:56 am

Post by wallstreetwalker »

revbob, nice work

will you update the script?
like make it a dockable window or add some other options

thanks alot
PUNK IN DRUBLIC
RBasil
Posts: 14
Joined: Tue Jul 04, 2006 9:39 am

Post by RBasil »

I agree, I would love to have this shown in a dockable window. Any script artists want to give it a try?
---
Robert Basil
Fallen Heroes Car
A visible remembrance of our fallen heroes.
http://www.fallenheroescar.com
alexflorisca
Posts: 2
Joined: Sat Sep 02, 2006 7:17 am

Post by alexflorisca »

Very nice script, i use pandora at work and it's brilliant. One thing though - I use 2 different sound drivers on my PC - I have the default sound driver as my headphones and I set MM to use my speakers (different driver) to play music (mainly for playing games while listening to music). Pandora plays thrugh my headphones and not speakers. I know little about mm scripting but I'm thinking that if your using mm browser, you can set it to use the same audio driver as mm itself?

Just a thought, would be cool to see this change if possible
Vulgrin
Posts: 1
Joined: Tue Oct 03, 2006 12:47 pm

Post by Vulgrin »

I culled this version together from this script and another script example that I found in the forums that does the same thing, but loads it into the main web window.

Code: Select all

Sub OnStartup
  Set Tree = SDB.MainTree

  Set PandoraNode = Tree.CreateNode
  PandoraNode.Caption = "Pandora"
  PandoraNode.IconIndex = 37
  Script.RegisterEvent PandoraNode, "OnNodeFocused", "NodeFocus"
PandoraNode.HasChildren = False

Tree.AddNode Tree.Node_Web, PandoraNode, 2
  
End Sub

Function NodeFocus( PandoraNode)
  NodeFocus = 2
  SDB.WebControl.Navigate "http://www.Pandora.Com"
End Function
rovingcowboy
Posts: 14163
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)
Contact:

Re: Pandora window

Post by rovingcowboy »

labiteena wrote:How do I make it so that a song sounds correctly on my iPod when I only use one headphone? On some songs, I need to use both headphones for the song to sound right (for example, the vocals will only come through one headphone and the acoustics will come through the other one). I'd like to know if i can make it so the sound is evenly distributed so i can only use one headphone. This way i can still talk to my friends and hear what is going on around me.

what you want to do is get an dsp plugin that will make the song mono. one i have is found in the winamp plugin pages.
or was? its an old one called wide and dynamic, very simple one. has few things but does help on sound by making it wide stereo which when played through a plugin that is for surround sound, gives that more depth and makes it sound a little better in that mode. but on the same knob you can turn it the other way all the way back to mono, this will then put the sound to the one speaker or headphone speaker and you can turn the volume to your speaker you use. and off the other one. so you could then hear the song and your friends and still keep track of your surroundings.

:D
roving cowboy / keith hall. My skins http://www.mediamonkey.com/forum/viewto ... =9&t=16724 for some help check on Monkey's helpful messages at http://www.mediamonkey.com/forum/viewto ... 4008#44008 MY SYSTEMS.1.Jukebox WinXp pro sp 3 version 3.5 gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 2.WinXP pro sp3, vers 2.5.5 and vers 3.5 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 4.WinXp pro sp3, vers 3.5, dad's computer bought from computer store. )5. Samsung Galaxy A51 5G Android ) 6. amd a8-5600 apu 3.60ghz mm version 4 windows 7 pro bought from computer store.
mi0j

Re: Pandora window

Post by mi0j »

Thanks revbob and Vulgrin for the awesome script. Works perfectly.
maleorderbride

Re: Pandora window

Post by maleorderbride »

Script works great!

The only thing I might want is to be able to control the audio output channel. Right now, instead of using MM's output selection the pandora window seems to be using the default/primary sound device. I am sure that is fine 99.99% of the time, but this would be used for a HTPC and required to run multiple instances of MM to different rooms simultaneously.

Can anyone rework the script? Or is this a Pandora issue, not really a MM/script problem?

Thanks!
sickofusernames
Posts: 8
Joined: Sat Jan 08, 2011 6:20 pm

Re: Pandora window

Post by sickofusernames »

Nice work. I use Pandora a lot because I like a lot of different types of music, but am usually only in the mood for specific ones at any given time. I think the best script would be if you could somehow link your library to Pandora's database and get the information for the songs in your library so that you could do what Pandora does but only within your own library. Does that make sense? I don't know if it is possible, but something between this script and trixmoto's genrefinder that can get moods from Allmusic.com.

Is this possible? (I don't know anything about writing scripts.) And if it is possible, would you be interested in attempting to write the script?

Thanks for the Pandora script you wrote!
Demonduskk

Re: Pandora window

Post by Demonduskk »

I Copied the script to MediaMonkey's "Scripts\Auto" folder, but nothing appears under the Web Node.
&
cant we just right click on the Web Node & 'Add new bookmark' ?

Help please..!
yremogtnom

Re: Pandora window

Post by yremogtnom »

Awesome!

Just started using Pandora to get a feel for some music I'm just getting into, as I wouldn't have CDs for them yet... and had to keep it running through the browser. As I would rather NOT do that, I tried finding a gadget (Win 7 x64) for Pandora, but - alas - none work.

So this was WONDERFUL to come across - Not only can I use it in my music player, which makes sense, but I can even open a tab to search and see if I have something when it comes on!

Thank you!!!!!
Post Reply