Page 1 of 1

How to determine music library path in a script?

Posted: Sat Dec 18, 2021 8:08 pm
by pokeefe0001
I have need to find the path to our music library in a script. Luckily, each of our instances of MediaMonkey has just one library. Unluckily, we have multiple instances of portable MediaMonkey with the library in various locations.

I found a chunk of code that works:

Code: Select all

  Set TrackData = SDB.Database.QuerySongs(" ")
  If Not TrackData.EOF Then
      'TrackData.Item is a SDBSongData Object
      TrackPath = TrackData.Item.Path
  End If
That works fine and doesn't have a noticeable delay. However, as near as I can tell, that extracts data for all tracks in the database (which for us is over 3000) and I really need only one. I don't know enough about QuerySongs to know how to limit the search to just one hit. Is there a way to do that? I'm sure there's a way search for a specific title (or some such), and I guess that would use less storage for the result, but it would still search the entire database so that's not much of an improvement.