Help me with script StreamsTreeNode , please

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus


Help me with script StreamsTreeNode , please

Post by Guest »

i edited this script and the problem is, that it doesn#t matter mm3 on which node i click .. everytime it opens the same radio .. only if i load a new one from the browser it loads it .. but then it loads this everytime on every node =/

Code: Select all

' MEDIAMONKEY SCRIPT: StreamsTreeNode v1.1   by   Steegy aka RC (Ruben Castelein)
'  Adds internet streams (or something else) as nodes, to the library node
'  ..released 22.02.2006 (last updated 2006-12-13)
'  You can manually change/add the streams using the "StreamsNodes.Add" lines (in Sub OnStartup)
'  e.g.    .Add "DI Trance", Array("", "Digitally Imported")
'          >> Shows a stream node "DI Trance" in the subnode "Digitally Imported", that links to ""
'  if there is no CATEGORY specified, the node is added to the main "Internet Streams" node
'  Set USE_EXTERNAL_PLAYER to True to use an external player (default is False: use internal MM player)
'  The location to the external player that can play internet streams (e.g. Winamp) must be set using PlayerEXE

Option Explicit

Dim StreamsNodes : Set StreamsNodes = CreateObject("Scripting.Dictionary")
Dim Categories : Set Categories = CreateObject("Scripting.Dictionary")

Const USE_EXTERNAL_PLAYER = False    ' If you set this to True, the player specified as PlayerEXE will be used to play the streams
Dim PlayerEXE : PlayerEXE = """" & "C:\Program Files\Winamp\Winamp.exe" & """"        ' As default, Winamp is set as external player

Dim Tree : Set Tree = SDB.MainTree

Sub OnStartup

    With StreamsNodes
        .Add "Rock/Metal/Alternative", Array("", "")
        ' shit (subcategory "shit") 
        .Add "ChroniX Aggression", Array("", "shit")
        .Add "The Buzz", Array("", "shit")
        .Add "Rock/Punk/Alternative", Array("", "shit")
    End With

    Dim BaseNode : Set BaseNode = Tree.CreateNode
    BaseNode.Caption = "Internet Streams"
    BaseNode.IconIndex = 56
    Tree.AddNode Tree.Node_MyComputer, BaseNode, 1

    Dim StreamsNodesKeys : StreamsNodesKeys = StreamsNodes.Keys

    Dim i, ChildNode, SubNode, Location, Category

    For i = 0 To StreamsNodes.Count - 1
        Location = StreamsNodes(StreamsNodesKeys(i))(0)
	    Category = StreamsNodes(StreamsNodesKeys(i))(1)
        Set ChildNode = Tree.CreateNode
        ChildNode.Caption = StreamsNodesKeys(i)
        ChildNode.IconIndex = 40
        ChildNode.CustomData = Location
        ChildNode.UseScript = Script.ScriptPath
        ChildNode.OnFillTracksFunct = "OpenStream"
	    If Category = "" Then
            Tree.AddNode BaseNode, ChildNode, 3
	        Set SubNode = CreateOrGetSubnode(BaseNode, Category, 56, 3)
	        Tree.AddNode SubNode, ChildNode, 3
	    End If

End Sub

Sub OpenStream(Node)

        Dim StreamSong : Set StreamSong = SDB.NewSongData
        StreamSong.Path = Node.CustomData
        StreamSong.Title = Node.Caption
        SDB.Player.PlaylistAddTrack StreamSong
        SDB.Player.PlaylistMoveTrack SDB.Player.PlaylistCount - 1, 0
        SDB.Player.CurrentSongIndex = 0
        Dim WShell : Set WShell = CreateObject("WScript.Shell")
        Dim Command : Command = PlayerEXE & " " & Node.CustomData
        Call WShell.Run(Command, 1, 0)
    End If
End Sub

Function CreateOrGetSubnode(ParentNode, Caption, IconIndex, RelativePosition)

    If Categories.Exists(Caption) Then
        Set CreateOrGetSubnode = Categories(Caption)
        Set CreateOrGetSubnode = Tree.CreateNode
        CreateOrGetSubnode.Caption = Caption
        CreateOrGetSubnode.IconIndex = IconIndex
        Tree.AddNode ParentNode, CreateOrGetSubnode, RelativePosition
        Categories.Add Caption, CreateOrGetSubnode
    End If
End Function

Post by Guest »

found something important:
when i play the normal playlist the "internet stream node takes the songs from the playlist i played before =/

sry for doublepost

Post by Guest »

What is the passage you edited?

Post by Guest »

hmm i just edited the "Sub OnStartup" ... can anyone help me please? =/
Posts: 3452
Joined: Sat Nov 05, 2005 7:17 pm

Post by Steegy »

MediaMonkey can't play PLS playlists and some other ShoutCast stream sources/formats. There's nothing you can do about that (except implementing a custom PLS file loading script).

For this particular reason there's the USE_EXTERNAL_PLAYER constant which you can set to True. Set PlayerEXE to the path of your Winamp application (or a similar capable player).

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