Get all titles in the library

Download and get help for different MediaMonkey for Windows 4 Addons.

Moderators: Peke, Gurus

asaf-g
Posts: 15
Joined: Sat Sep 27, 2008 10:40 am

Get all titles in the library

Post by asaf-g »

Hi all,
Is there an easy way using the API, to get an object that holds a list of all the tracks I have in my library?

Thanks!
asaf-g
Posts: 15
Joined: Sat Sep 27, 2008 10:40 am

Re: Get all titles in the library

Post by asaf-g »

and is there a way to start the sync process ? (Simulate clicking on the sync button)
raybeau528
Posts: 401
Joined: Thu Sep 27, 2007 4:19 pm
Location: Connecticut

Re: Get all titles in the library

Post by raybeau528 »

What exactly are you trying to do and what (code) have you tried so far?

A simple way to get all tracks in the library is to select the 'title' node, ctrl-a to select all tracks and in a script you call use this code

Dim list : Set List = SDB.CurrentSongList ' Method to process each track in a selection
Dim i
For i = 0 to list.count-1

' do some processing here

next

It also works for any selection of tracks.

Ray
asaf-g
Posts: 15
Joined: Sat Sep 27, 2008 10:40 am

Re: Get all titles in the library

Post by asaf-g »

I want to do exactly what you said, without the need to manually select the songs.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Get all titles in the library

Post by Bex »

The key is to use QuerySongs which returns songdata objects which you can add to a SongList.
You can do something like this: (Not tested)

Code: Select all

Set List = SDB.NewSongList
Set iter = SDB.Database.QuerySongs("ID> 0")
Do While Not iter.EOF
  List.Add iter.Item
  iter.Next
Loop
Set iter= Nothing
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
asaf-g
Posts: 15
Joined: Sat Sep 27, 2008 10:40 am

Re: Get all titles in the library

Post by asaf-g »

Works!
And do you happen to know how to start a sync?
There's SDBDevice::StartSynch who gets a SDBSongList, but I can't find a code example that uses it, and have't successfully manage to do it myself.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Get all titles in the library

Post by Bex »

No sorry, I haven't written any sync scripts so I never investigated how the SDBDevice members works. But there was a post recently which claimed that they missed a start sync event, so it seems that it is missing...
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
asaf-g
Posts: 15
Joined: Sat Sep 27, 2008 10:40 am

Re: Get all titles in the library

Post by asaf-g »

I think they support triggering the sync yourself somehow, but not signing up for the event.
Post Reply