Popularity of Tracks

Download and get help for different MediaMonkey Addons.

Moderators: Peke, Gurus

Akinonyx Popularity of Tracks

Post by Akinonyx » Fri Jun 06, 2008 12:16 pm

I'm looking for something to automatically tag (in one of the custom fields) tracks with the "popularity value" that AudioScrobbler returns (looks to be the "reach" field in the XML webservices). It would be similar to what the Last.FM Node does when you click on the Favorite Artists node, where it returns a playlist of tracks by that artist in order of popularity. But, if there were a way to store those values, one wouldn't be limited to a playlist of just one artist. I'm guessing Last.FM Node gets its data from the Artist Top Tracks XML ( ... tracks.xml), but then you're limited to only those tracks that are returned. To get data for all albums, you would have to use the Album Info XML ( ... g/info.xml), for each album. Any ideas anyone?


C# solution

Post by Akinonyx » Sat Jun 07, 2008 6:28 pm

Well, I put together a lame C# solution to this problem. It tags on a song by song basis, so to prevent thousands of calls to the audioscrobbler server, I adjusted the JustListAlbums script to make a list of links to the XML's that I downloaded to a folder. It's slow going, but it's getting the job for me. Perhaps though someone would like to enhance it to make it run out of MM. Here's the code I used in C#:

Code: Select all

            SongsDB.SDBApplication SDB = new SongsDB.SDBApplication();
            SDB.ShutdownAfterDisconnect = false;
            for (int i = 0; i < SDB.SelectedSongList.Count; i++ )
                SongsDB.ISDBSongData sd = SDB.SelectedSongList.get_Item(i);
                string artist = sd.ArtistName;
                string album = sd.AlbumName;
                string title = sd.Title;

                string path = @"F:\Music\XML\1.0\album\" + artist + "\\" + album + "\\" + artist + "___" + album + ".xml";
                XmlTextReader reader = new XmlTextReader(path);
                reader.WhitespaceHandling = WhitespaceHandling.Significant;
                string xmlTitle = "";
                while (reader.Read())

                    // Print out info on node  
                    Console.WriteLine("{0}: {1}", reader.NodeType.ToString(), reader.Name);
                    if (reader.Name == "track" && reader.NodeType.ToString() == "Element")
                        xmlTitle = reader.GetAttribute(0);

                    if (reader.Name == "reach" && reader.NodeType.ToString() == "Element")
                        string reach = reader.Value;
                        if (xmlTitle == "")
                            sd.Custom5 = reach;
                        else if (xmlTitle.ToLower() == title.ToLower())
                            sd.Custom4 = reach;


Post by Akinonyx » Sat Jun 07, 2008 6:32 pm

P.S. This is kind of a way to see which tracks aren't tagged correctly (ie. misspelled), at least according to AudioScrobbler's data, which would also be a nice script.

Posts: 63
Joined: Mon Feb 12, 2007 6:25 am

Post by GuHu » Mon Jun 09, 2008 3:22 am


nice idea. I think the scrobbling number of a song is an important information. Unfortunately, it is not reachable from webservices to my knowledge. A song can be on different albums, and you have to add all number from all albums.

I think you have to read the plain html page of the song and to fiddle out the number.


Post Reply