Teknojnky wrote:Why trying to query for all tracks in one query, instead of iterating thru the toptrack list and querying each individually and adding them to the matched list if we find an accessible match?
Exactly what i thought
replace
- Code: Select all
If Not TopTracksDict.Exists(TrackTitle)Then
count = count+1
TopTracksDict.Add count, TrackTitle
If count = MaxTracks Then
Exit For
End if
End If
with
- Code: Select all
If Not TopTracksDict.Exists(TrackTitle) And InDB(artist,TrackTitle,True)=True Then
count = count+1
TopTracksDict.Add count, TrackTitle
If count = MaxTracks Then
Exit For
End if
End If
and add
- Code: Select all
'This function checks if a track exists in the db and also checks if is accessible
Function InDB(Artist,SongTitle,CheckAccess)
InDB = False
Dim SQL
If artist <> "" Then
SQL = "Artists.Artist = '" & artist & "' "
End If
If Songtitle = "" Then
MsgBox "No track title specified!"
Exit Function
End If
If SQL <> "" Then
SQL = SQL & " AND songs.songtitle like '" & songtitle & "'"
Else
SQL = "songs.songtitle like '" & songtitle & "'"
End If
'only do for 1 item!
Set QueryMatch = SDB.Database.QuerySongs (SQL)
if Not QueryMatch.EOF Then
If checkaccess = True Then
If IsAccessible(QueryMatch.item) Then
InDB = True
Exit Function
End If
Else
InDB = True
Exit Function
End If
End If
InDB = False
End Function
and update in Matchtracks
- Code: Select all
Do While Not QueryMatch.EOF Or i = MaxTracks
to
- Code: Select all
Do While Not QueryMatch.EOF AND i <= MaxTracks


