Getting playlist WITHOUT using Player.CurrentPlaylist?

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Getting playlist WITHOUT using Player.CurrentPlaylist?

Postby Degeim » Tue May 08, 2012 2:14 pm

Hi there!

I'm trying to get the list of songs in the "Now Playing" section of MediaMonkey using C#. Currently, I do it as follows:

Code: Select all
            var list = new List<SDBSongData>();
            var c = SDBA.Player.CurrentPlaylist.Count;
            for (int i = 0; i < c; i++)
                list.Add(SDBA.Player.CurrentPlaylist.get_Item(i));
            return list;


This usually works alright (around 4 milliseconds per song), but some times it takes between 50 and 100 milliseconds for each song. Each time this happens, it takes almost as long time to extract information from the SDBSongData objects (like s.Artist.Name or s.Album.Name). That means that this operation takes around 15 seconds for a playlist of 60-70 songs, and that is far too much time.

So, is there any way to get the list of currently playing songs without going through these classes? I have found that direct SQL queries often are quicker than the built in SDBApplication functions, so I would like to run something like:
Code: Select all
SDBA.Database.OpenSQL("SELECT SongTitle FROM NowPlaying");


But I can't find anywhere in the database where currently playing songs are stored. As far as I can see, only smart lists and static lists are stored there. And I can't find any configuration files that holds this information either, except for the %appdata%/MediaMonkey/mediamonkey.m3u8, but this only gets updated when MediaMonkey is closed.

I really need a way to speed up this process. Any ideas?
Degeim
 
Posts: 39
Joined: Fri Sep 02, 2011 3:34 am
Location: Trondheim, Norway

Re: Getting playlist WITHOUT using Player.CurrentPlaylist?

Postby mcow » Tue May 22, 2012 8:30 pm

Instead of copying it to the list<>, can't you just hold the ref to CurrentSongList and use it directly? My Python code just uses PLY.CurrentSongList (where PLY is a constant ref to SDB.Player). I haven't done any timing analysis, but the response has always been plenty fast for my purposes.
mcow
 
Posts: 442
Joined: Sun Sep 21, 2008 9:35 pm
Location: Cupertino, California


Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 3 guests