How to determine music library path in a script?

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

Moderators: Gurus, Addon Administrators

pokeefe0001
Posts: 97
Joined: Thu Oct 11, 2018 4:48 pm
Location: USA, Pacific Northwest

How to determine music library path in a script?

Post 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.
MMV4 (1919) Portable
MMW5 (2606) Portable
Multiple Win11 x64 21H2
Multiple Win7 x32, unknown builds