

Dim List, Tracks, Artist
Set Artist = SDB.Objects(ArtistNode.Caption)
Set Tracks = SDB.MainTracksWindow
If Artist is Nothing Then
logme "Tracklist not cached, going to query last.fm"
Artist = ArtistNode.Caption
Set StatusBar = SDB.Progress
StatusBar.Text = "Fill Artist Node: "
If LoadXML(ArtistNode.Caption, "TopTracks") Then 'queryies last.fm returns xmldoc of top tracks'
logme "OnFillArtistNode(): LoadXML returned true"
Dim ele,TrackTitle
For Each ele In xmlDoc.getElementsByTagName("name")
TrackTitle = ele.ChildNodes.Item(0).Text
'If debug then msgbox ("Top Track " & count & ": " & TrackTitle)
logme " xmlDoc tracktitle: " & TrackTitle
StatusBar.Text = "Matching " & Artist & " - " & TrackTitle
StatusBar.Increase
Dim Iter, Qry, TrackListQ
Qry = "Artist LIKE '%" & CorrectST(Artist) & _
"' AND SongTitle LIKE '%" & _
CorrectST(TrackTitle) &"'"
Set Iter = SDB.Database.QuerySongs(Qry)
SDB.ProcessMessages
Do While Not Iter.EOF
SDB.ProcessMessages
logme " Query Match Loop entered with AvoidDupes: " & AvoidDupes
StatusBar.Increase
Tracks.AddTrack (Iter.Item)
SDB.ProcessMessages
If AvoidDupes Then 'add only first result'
Exit Do
End If
SDB.ProcessMessages
Iter.Next
SDB.ProcessMessages
Loop
logme " Query Match Loop exited"
SDB.ProcessMessages
If StatusBar.Terminate Then
Exit For
End If
Next
' For Each Item In TrackListQ
Tracks.FinishAdding
Set SDB.Objects(Artist) = Tracks
Else
logme "FillArtistNode(): LoadXML returned false"
msgbox ("LastFM did not return with data")
End If
StatusBar.Text = "Fill Artist Node: Finished"
' msgbox ("FillArtistNode(): finished")
Else
logme " Using Cached Tracklist"
msgbox ("Using Cached list")
' Set Tracks = SDB.Objects(Artist)
For Each Item In SDB.Objects(Artist)
Tracks.AddTrack = SDB.Objects(Artist).Item
Next
End If

Set Artist = SDB.Objects(ArtistNode.Caption)Artist = ArtistNode.CaptionSet SDB.Objects(Artist) = TracksSet Tracks = SDB.Objects(Artist)

Teknojnky wrote:
- Code: Select all
Function DecToUtf(d)
Dim b : b = DecToBin(d)
Dim a : a = "110"&Left(b,5)
b = "10"&Mid(b,6)
DecToUtf = "%"&BinToHex(a)&"%"&BinToHex(b)
End Function
Function DecToUtf(d)
Dim b : b = DecToBin(d)
Dim a : a = "110"&Left(b,5)
b = "10"&Mid(b,6)
//THIS LINE
DecToUtf = BinToHex(a)&"%"&BinToHex(b)
End Function



Teknojnky wrote:Code updated, see first post, a usable artist tree so far,
Teknojnky wrote:I don't really have the time to research and make this script, tho it could probly done by combining code from several of the existing scripts, so I'm just putting the idea out there in case anyone else see's the usefulness and has the time/ability to take the idea and run with it.




Users browsing this forum: Bing [Bot], Google [Bot] and 13 guests