Last.FM Node: dynamic node based on last.fm 2020.04.19 [MM3][MM4]
Thanks Bex & Trix, it did not even dawn on me that the database fields were different than the object properties.. I will have to keep that in mind!
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Hmmm more questions...
I seem to be able to save the tracklist to an object, and I seem to be able to determine if the object exists, but I'm getting a type mismatch when trying to send the object back to the track list..
I've tried directly setting the object to the tracklist:
Set Tracks = SDB.Objects(Artist)
That didn't work, so I tried to setup a loop to read the items of the object (I may be falsely assuming that the tracklist has items before and after being placed into the object):
For Each Item In SDB.Objects(Artist)
Tracks.AddTrack = SDB.Objects(Artist).Item
Next
I'm pretty sure using the sdb.objects is the best way to 'cache' the track list, I don't really want be creating temporary playlists in the playlist node..
But I don't understand why I'm getting the type mismatch..
I seem to be able to save the tracklist to an object, and I seem to be able to determine if the object exists, but I'm getting a type mismatch when trying to send the object back to the track list..
Code: Select all
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 Tracks = SDB.Objects(Artist)
That didn't work, so I tried to setup a loop to read the items of the object (I may be falsely assuming that the tracklist has items before and after being placed into the object):
For Each Item In SDB.Objects(Artist)
Tracks.AddTrack = SDB.Objects(Artist).Item
Next
I'm pretty sure using the sdb.objects is the best way to 'cache' the track list, I don't really want be creating temporary playlists in the playlist node..
But I don't understand why I'm getting the type mismatch..
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
You seem to have some confusion here with the "Artist" variable. First it's an object......then if that's "Nothing" then you set it to a string......and use that string to save the songlist......however you're then using an object to retrieve an object, when it should be a string...
Basically, you need to have "oArtist" when it's an object and "sArtist" when it's a string and make sure you're using the right one at the right time!
Code: Select all
Set Artist = SDB.Objects(ArtistNode.Caption)
Code: Select all
Artist = ArtistNode.Caption
Code: Select all
Set SDB.Objects(Artist) = Tracks
Code: Select all
Set Tracks = SDB.Objects(Artist)
Download my scripts at my own MediaMonkey fansite.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
All the code for my website and scripts is safely backed up immediately and for free using Dropbox.
Ok I think your right.
What I was trying to accomplish was having a dynamically named 'object' to use as 'cached' track list... so if the tracklist object existed for that particular artist, then it would use it, otherwise it would query last.fm for the xml data and then add the tracks to the tracklist.
I will have to think some more on it.
What I was trying to accomplish was having a dynamically named 'object' to use as 'cached' track list... so if the tracklist object existed for that particular artist, then it would use it, otherwise it would query last.fm for the xml data and then add the tracks to the tracklist.
I will have to think some more on it.
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
This needs to be corrected toTeknojnky 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
Code: Select all
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
Regards,
Red
PS: I like the idie of this script
Thanks for the correction Red!
I think once I get this ball rolling, this script is gonna be awesome...
here is a little bit of a teaser of stuff yet to come..
I think once I get this ball rolling, this script is gonna be awesome...
here is a little bit of a teaser of stuff yet to come..
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Code updated, see first post, a usable artist tree so far, but alot more work to be done.. try it out and let me know what you think!
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
You have the secure your code againts parallel queuing last.fm servers!Teknojnky wrote:Code updated, see first post, a usable artist tree so far,
Try this out to see what i mean:
1) Add an artist
2) click on any other node
3) click on the artist name node again
4) repeat as many times as you wish ( recommend about 7) then you'll see what i mean
Plus hen the list is empty i get prompted to enter an artist name, but after there is initially an artist there i can't add any more.
As it seems none of the pop up windows work?
Nice script,
Red
-
- Posts: 1119
- Joined: Mon Apr 09, 2007 12:03 am
- Location: Boulder, Colorado, USA
I thought you said that you did not have time to develop this script....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.
Will you be be packaging this in an MMIP once everything is sussed out?
I am going to give it a go with what you have written. Will report back any problems.
Very nice work, Tekno!
D Rock
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
-
- Posts: 1119
- Joined: Mon Apr 09, 2007 12:03 am
- Location: Boulder, Colorado, USA
UM...................
WOW
Without even playing around with it beyond entering one artists' name, I gotta say I am blown away by the possibilities of this!
Good thing you did not have the time to work on it...
What do I do with the icon package, if I DL it?
WOW
Without even playing around with it beyond entering one artists' name, I gotta say I am blown away by the possibilities of this!
Good thing you did not have the time to work on it...
What do I do with the icon package, if I DL it?
D Rock
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
MediaMonkeyGoldv3.0.3.1183
Vista Home Basic|4thGen 20GPod
Zune Small Player Skin w/ Aqua 4 Player Mod
Backup | Last FM Node | Scrobbler DJ | TopTracks | StayInSameStyleDJ
RadioDJ | RadioFreeMonkey | PrettyPictures | MiniLyricsEmbedder
LyricsViewer | Lyricator | LyricsPlugin | VisualizationEmbedder | MonkeyRok
RightClickForWeb | WebSearchPanels | WebNodes | MagicNodes | FavoritesNodes
NowPlayingArtNode |AutoRateAccurate | TaggingInconsistencies
AdvancedDuplicateFind&Fix | CaseModify | PlayHistory&Stats | Etc...
Just place either icon in the script\auto folder.
Eventually, yea I'll figure out how to make MMIP package, still a long way to go... I have a couple more ideas I haven't even added yet that I will keep a surprise until I can see if its doable..
Regarding the parallel queries, yea thats pretty cool... if you notice the actual xml goes super fast, its the matching up to your library that takes some time.. on my library (~900gig) it take ~1-2 seconds per track... I am not sure if that can be sped up with a better/more efficient query or if that is simply because of the size of the library to query.
Also, once I get the 'cache' figured out, it wil only download an artist once per session (with a context menu to manually refresh).
Glad you enjoy it, I think its pretty freakin cool myself.
Edit: also, to add a new artist, you gotta collapse then expand the artist tree again... I will need to get the 'add artist node' context working and the save/load and it will be alot better.
I made a minor update where the artist input box is prepopulated with a default (you can still type whatever you want) if you just want to play around.
Eventually, yea I'll figure out how to make MMIP package, still a long way to go... I have a couple more ideas I haven't even added yet that I will keep a surprise until I can see if its doable..
Regarding the parallel queries, yea thats pretty cool... if you notice the actual xml goes super fast, its the matching up to your library that takes some time.. on my library (~900gig) it take ~1-2 seconds per track... I am not sure if that can be sped up with a better/more efficient query or if that is simply because of the size of the library to query.
Also, once I get the 'cache' figured out, it wil only download an artist once per session (with a context menu to manually refresh).
Glad you enjoy it, I think its pretty freakin cool myself.
Edit: also, to add a new artist, you gotta collapse then expand the artist tree again... I will need to get the 'add artist node' context working and the save/load and it will be alot better.
I made a minor update where the artist input box is prepopulated with a default (you can still type whatever you want) if you just want to play around.
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
-
- Posts: 291
- Joined: Mon Dec 11, 2006 9:45 pm
Another small update, did quite a bit of re-arranging code but I think I have the basics down now..
You can now collapse a node to clear it. (I had a several dozen deep tree and no way to clear it without restarting lol)
You can expand the related artists without selecting/loading the parent artist node.
I've yet to work on tags/user charts, but hopefully I will get some time this weekend, otherwise it may be next week.
You can now collapse a node to clear it. (I had a several dozen deep tree and no way to clear it without restarting lol)
You can expand the related artists without selecting/loading the parent artist node.
I've yet to work on tags/user charts, but hopefully I will get some time this weekend, otherwise it may be next week.
New script: Last.FM Node Now with DJ Mode!
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
Last.fm + MediaMonkey = Scrobbler DJ!
Tag with MusicBrainz ~ Get Album Art!
Tweak the Monkey! ~ My Scripts Page
-
- Posts: 7
- Joined: Thu Jan 18, 2007 9:13 pm
Whoa!
Whoa! This is fantastic!
Good idea, and it looks to be pretty well executed so far. Please keep up the good work.
Good idea, and it looks to be pretty well executed so far. Please keep up the good work.