sync - magic nodes - playlist

Post a reply

Smilies
:D :) :( :o :-? 8) :lol: :x :P :oops: :cry: :evil: :roll: :wink:

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: sync - magic nodes - playlist

Re: sync - magic nodes - playlist

by twinbee » Sat Nov 22, 2008 9:47 am

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

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 6:19 pm

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

Re: sync - magic nodes - playlist

by twinbee » Thu Sep 25, 2008 6:01 pm

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.

Re: sync - magic nodes - playlist

by ZvezdanD » Thu Sep 25, 2008 5:39 pm

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?

Re: sync - magic nodes - playlist

by ZvezdanD » Thu Sep 25, 2008 5:36 pm

Triponi wrote:[I'm afraid that doesn't exist in MegaDJ.
I don't know about MegaDJ, but the original poster asked for the Magic Nodes which has a support for mentioned Send to options for creating static playlists.

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 5:07 pm

Have you tried the right click on the node caption and Send to / Playlist / New playlist or Send to / .m3u Playlist?
I'm afraid that doesn't exist in MegaDJ. But there is a much more simple way. Just select all the songs in the list and then "sync selected". But then you have to empty the ipod first to make space of course. Oh, and make sure to sync it first to update all your play counts before deleting them. All a bit of faff. I was just hoping there was some "autosync" way of doing this, so I could just plug my device in as and when I wanted and know it was always up to date.

I'll eventually get round to writing a script myself I, but with a thesis to write up and a full-time job it's not going to be for AGES :-(

Oh well, I suppose my MM bubble had to burst at some point. This is the first time I've wanted something that doesn't exist!

Re: sync - magic nodes - playlist

by twinbee » Thu Sep 25, 2008 4:55 pm

Can someone point me in the direction of a script that will create a new static playlist from an arbitary node (i.e. MegaDJ or magic nodes)
Hope this further helps you along the path of syncing...

Using playlists, there are essentially two ways of adding tracks, by SongData type, or by track ID directly:

ISDBPlaylist::AddTrack
ISDBPlaylist::AddTrackById

The former (AddTrack) uses the SongData object:

Playlist manipulation can be done via these two links:
http://www.mediamonkey.com/wiki/index.php/SDBPlaylists
http://www.mediamonkey.com/wiki/index.php/SDBPlaylist

I'm not sure about MagicNodes, but MegaDJ stores ID numbers in the text files (inside the MegaDJ folder), and SongData objects (of all tracks) in memory, so you have a couple of ways of retrieving tracks from those nodes. 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.

To clarify, MegaDJ (and I presume MagicNodes) uses the TracksWindow object, which is a bit like a playlist, but outside MM's 'normal' playlists/autoplaylists.

Re: sync - magic nodes - playlist

by ZvezdanD » Thu Sep 25, 2008 1:57 pm

Triponi wrote:Can someone point me in the direction of a script that will create a new static playlist from an arbitary node (i.e. MegaDJ or magic nodes)
Have you tried the right click on the node caption and Send to / Playlist / New playlist or Send to / .m3u Playlist?

Re: sync - magic nodes - playlist

by nohitter151 » Thu Sep 25, 2008 10:24 am

This one creates a playlist: http://www.mediamonkey.com/forum/viewto ... cks#p92930

I'm really not aware of any that work when a sync operation is carried out.


Also: this thread is relevant in many ways - http://www.mediamonkey.com/forum/viewto ... &sk=t&sd=a

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 9:29 am

Ok, I was starting to get that feeling :-( I am of course happy to develop one myself as nothing seems to do the job.

The point is, that though I am an experienced programmer, I have very little experience with media monkey scripting syntax. Hence if I could find several scripts that have the parts I want I could cobble it together and infer the syntax pretty easily, but writing it from scratch myself is going to be tricky.

So I'm looking for a script (any script) that is automatically triggered by a sync operation. If I could also find a script that generates a playlist. And another one that got the contents of a magic node say I'd be laughing.

So, as most of you know far more about what is out there than me, would anyone be kind enough to start me off and point out some likely candidates for me to investigate?

Thanks very much

Re: sync - magic nodes - playlist

by nohitter151 » Thu Sep 25, 2008 9:11 am

Triponi wrote:I agree. That's my point. The restriction of "gold features" to scripts is inconsistent at best - i.e. my MegaDJ example. Hence, the restriction of certain API is almost pointless. IMO the original rationale for the gold stuff, and implementation needs to be thoughly rethought. But anyway, I don't expect anyone to listen to me and I digress.....

Benn - How?! :-)

Let me restate my question again as I got sidetracked ranting :-) Can someone point me in the direction of a script that will create a new static playlist from an arbitary node (i.e. MegaDJ or magic nodes). Ideally, this script would be automatically triggered to run just prior to a sync.
No such script exists, but you're welcome to try and create your own.

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 8:57 am

I agree. That's my point. The restriction of "gold features" to scripts is inconsistent at best - i.e. my MegaDJ example. Hence, the restriction of certain API is almost pointless. IMO the original rationale for the gold stuff, and implementation needs to be thoughly rethought. But anyway, I don't expect anyone to listen to me and I digress.....

Benn - How?! :-)

Let me restate my question again as I got sidetracked ranting :-) Can someone point me in the direction of a script that will create a new static playlist from an arbitary node (i.e. MegaDJ or magic nodes). Ideally, this script would be automatically triggered to run just prior to a sync.

Re: sync - magic nodes - playlist

by Benn » Thu Sep 25, 2008 7:22 am

To further help enhance the development of a great program? I don't think theres actually anything to stop you from developing your own script, which is one of the great features of MM - its almost "open source" approach. Also, to ask MM to copy something into a static playlist doesn't involve anything "gold" at all I believe.

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 6:56 am

Sorry as a further point. The architecture as it exists already fails to achieve its purpose. Consider the MegaDJ script. Using that script enables you to do absolutely everything it is possible to do with autoplaylists (and far more besides). In other words why upgrade to gold when you can get superior features for free?

Re: sync - magic nodes - playlist

by Triponi » Thu Sep 25, 2008 6:49 am

Thanks nohitter151 :-)

Sure I understand. But copying into a static list would be fine. Any ideas how I can do that with a background script, that would run just prior to a sync?

-------------------

On a separate note, I've seen that explanation on the forums quite a few times now and I find it very frustrating. I.e. "That can't be done because it would open up a backdoor for basic users to get gold features". In other words, MM is hampering the functionality of full paying users due to it's licensing terms. As a gold user, in principle I should be fully entitled to develop a script to do X, but I'm not allowed to do it, because someone else might use that script who hasn't paid. I am being restricted not for my actions, but for the possible actions of others. Classic dog in the manger.

I think this API (if that is where the restrictions are) should be thought out more effectively. Rather than "hiding" gold features from the scripting interface. Why not make everything fully available? It should then be up to the MM installation itself to enforce access to the APIs. Hence, if I try and run my script X as a basic user, MM will throw an error "you must upgrade to use this script", whereas if I try and run it as a gold user everything would be fine. Isn't that then win-win for everyone?

Triponi

Top