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?

