sync - magic nodes - playlist

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

Moderators: Peke, Gurus

ZvezdanD
Posts: 3257
Joined: Thu Jun 08, 2006 7:40 pm

Re: sync - magic nodes - playlist

Post by ZvezdanD »

twinbee wrote:Though I'm guessing you may need to access the text files in the first place, since there seems to be no way of directly retrieving tracks from the 'tracklists' that MegaDJ/MagicNodes uses.
How about SDB.AllVisibleSongList?
Magic Nodes 4.3.3 / 5.2 RegExp Find & Replace 4.4.9 / 5.2  Invert Selection/Select None 1.5.1  Export/Create Playlists for Child Nodes 4.1.1 / 5.4.1  Expand Child Nodes/Expand All 1.1.2  Event Logger 2.7  Filtered Statistics Report 1.6  Track Redirection & Synchronization 3.4.2  Restore/Synchronize Database 3.1.8 / 4.0.1  Find Currently Playing Track 1.3.2  Queue List 1.2.1  Add to Library on Play 1.0.1  Tree Report for Child Nodes 1.1.1  Update Location of Files in Database 1.4.5 / 2.3  Inherit Child Playlists 1.0.3  Add Currently Playing/Selected Track(s) to Playlist 1.2
twinbee
Posts: 180
Joined: Tue May 13, 2008 2:36 am
Location: England
Contact:

Re: sync - magic nodes - playlist

Post by twinbee »

How about SDB.AllVisibleSongList?
Hey nice find. I suppose it makes sense to externalize the command due to the dynamic updating of tracks MM uses for tracklists. As long as one doesn't mind being on the actual list, then that's fine.

Triponi, by the way, as well as my previous post's way of getting MegaDJ's track data (and the above way more generally), these three links will help you on your way to syncing:
http://www.mediamonkey.com/wiki/index.p ... StartSynch
http://www.mediamonkey.com/wiki/index.php/SDBDevice
http://www.mediamonkey.com/wiki/index.p ... ynchStatus

A nice way of searching when looking for appropriate commands is to go to the Allpages. One can then use the in built browser's search to look for stuff more easily than Wiki's search allows.
MegaDJ v2 - Lightning fast and easy to use search to replace the standard AutoPlaylist. Features include random jukebox style playlists, along with syncing, weighting options, and logic complete querying.
Triponi
Posts: 22
Joined: Tue Sep 16, 2008 5:04 pm

Re: sync - magic nodes - playlist

Post by Triponi »

Okay, so further to my last message, I've had a look at some of the stuff you guys posted to see actually how much work would it be. Turns out I have managed to get something incredibly ugly working in about half an hour (for MegaDJ). Basically, I alter the fillList sub so that every time my "sync" node is filled it also fills a static playlist with the same data.

The problem is however, it turns out that writing to a static playlist is incredibly slow (of the order of minutes for a 1000 song list). So this is pretty much a nonstarter. Oh well, I'll post my code alterations here anyway. The search continues...

Triponi

Code: Select all

Sub fillList(subnode)

    'MsgBox("fillist")

    Dim filesys, path
    Set filesys = CreateObject("Scripting.FileSystemObject")
    path = filesys.GetAbsolutePathName(strMMPath & "MegaDJ\" & subnode.CustomNodeID)
    If filesys.FileExists(path) Then
   
        Const ForReading = 1
        Set objFSO = CreateObject("Scripting.FileSystemObject")

        Set objFile = objFSO.OpenTextFile(strMMPath & "MegaDJ\" & subnode.CustomNodeID, ForReading)

        MyString = objFile.Readall

        objFile.Close
        
        If InStr(MyString, "ERROR") Then
            MsgBox (MyString)
            Exit Sub
        End If
       
        'tr.AddTracksFromQuery("WHERE ID IN(" & MyString & ")") 'MyString
        
        '''''''''''''''''''''''''''''''
        'Triponi
        Const nodeToCopy = 0
        
        If (subnode.CustomNodeID = nodeToCopy) Then
            'Get the syncplaylist
            Dim syncList
            Set syncList = SDB.PlaylistByTitle("SyncMegaDJ")
            syncList.Clear
        End If
        ''''''''''''''''''''''''''''''

        fields = Split(MyString, ",")
        'MsgBox(UBound(fields))
        For i = 0 To UBound(fields)

            ' The CORE of the program :)
            If Not (SDB.Objects(fields(i)) Is Nothing) Then
                tr.AddTrack (SDB.Objects(fields(i)))

                 '''''''''''''''''''''''''''''''
                 'Triponi
                 If (subnode.CustomNodeID = nodeToCopy) Then                    
                     syncList.AddTrack (SDB.Objects(fields(i)))
                 End If
                 '''''''''''''''''''''''''''''''
                
            End If
            'MsgBox("i: " & i & ", ID not found: " & fields(i) & " ...so caching song data")

        Next
        Set fields = Nothing

        'tr.AddTracksFromQuery("WHERE ID IN(" & MyString & ")")


        tr.FinishAdding
    
    End If
End Sub
twinbee
Posts: 180
Joined: Tue May 13, 2008 2:36 am
Location: England
Contact:

Re: sync - magic nodes - playlist

Post by twinbee »

To further this topic, and to help copy to playlists generally:- I've found that using AddTracks instead of AddTrack (without the S) speeds up the process of copying to a playlist by a few orders of magnitude.

AddTracks takes a SongList object (collection of SongData objects), rather than a single SongData object as with AddTrack. The process of transferring them all at once with AddTracks somehow does the trick.

Info: http://www.mediamonkey.com/wiki/index.php/SDBPlaylist
MegaDJ v2 - Lightning fast and easy to use search to replace the standard AutoPlaylist. Features include random jukebox style playlists, along with syncing, weighting options, and logic complete querying.
Post Reply