Page 1 of 1

SongData from track ID?

Posted: Tue Feb 17, 2009 12:56 am
by GuyScharf
Is there any way I can create a SongData object if all I have is the track ID? I know that I can find the database record using SQL, but I'd like to get a SongData object so that I have access to all methods and fields easily without laboring over the SQL.

Thanks.

Re: SongData from track ID?

Posted: Tue Feb 17, 2009 2:27 am
by Bex
Yes, use QuerySongs:
http://www.mediamonkey.com/wiki/index.p ... QuerySongs
See other scripts for examples, just search for querysongs.

Re: SongData from track ID?

Posted: Tue Feb 17, 2009 5:03 am
by GuyScharf
Great! Thank you.

Re: SongData from track ID?

Posted: Fri Nov 25, 2011 9:37 am
by Thanasis
Yes. Thank you too....

SDB.Database.QuerySongs :P (QueryWithoutSelectFrom)

Just filter your query so there is no SELECT or FROM Clauses and it is ok.... This is what I do
songsQuery = .... Your Full Query....
sQueryArr = Split(songsQuery, "WHERE")
sQueryArr(0) = ""
sQueryArr(1) = " Songs.IDAlbum = " & "{{NewAlbumID}}" & " AND " & sQueryArr(1)
songsQuery = Join(sQueryArr, "WHERE")
songsQuery = Right (songsQuery, Len(songsQuery) - Len("WHERE"))

Set SongsP = SDB.Database.QuerySongs (songsQuery)

' Do Until SongsP.EOF

SDB.Player.PlaylistAddTrack(songsP.Item)

songsP.next

' Loop